Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selinux type super_t not given on our cluster #242

Closed
schlichtanders opened this issue Aug 26, 2024 · 10 comments
Closed

selinux type super_t not given on our cluster #242

schlichtanders opened this issue Aug 26, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@schlichtanders
Copy link

schlichtanders commented Aug 26, 2024

Hi there, I think this is just asking for some documentation about how mountpoint-s3 depends on selinux.
The default config sets the type to super_t, however on our k8s cluster there isn't such a policy setup.

Would be great to know which other type to use instead or how to define it.

EDIT: for others to find this easier. The actual error is quite confusing it looks like

error during container init: write /proc/self/attr/keycreate: invalid argument: unknown"

And this other issue was helping me to pin down that it might have something todo with the selinux type

/triage support

@schlichtanders
Copy link
Author

Is this an attack done twice by different users/bots? Looks weird

@awslabs awslabs deleted a comment Aug 26, 2024
@awslabs awslabs deleted a comment from rphmauriciodev Aug 26, 2024
@awslabs awslabs deleted a comment Aug 26, 2024
@unexge
Copy link
Contributor

unexge commented Aug 26, 2024

SELinux is not fully supported at the moment and the support is tracked with #169.

I think the type to use depends on your OS and the SELinux policies you install (it seems like super_t mainly targets Bottlerocket). For example, if you install container-selinux, you could try using container_t or spc_t. spc_t is similar to super_t and gives more access - which might be needed until we fully support SELinux as we mount /proc/mounts currently.

The other comments indeed seem like spam, I removed them.

@schlichtanders
Copy link
Author

Thank you for pointing to spc_t. Indeed that is available on our machines. 👍

@schlichtanders
Copy link
Author

schlichtanders commented Aug 26, 2024

I tried using spc_t, but now run into another permission problem.

mount-s3-1.8.0-0a115c2c-e0fc-4cb2-9a5b-536171ad00e7.service: Failed to set up standard output: Permission denied
mount-s3-1.8.0-0a115c2c-e0fc-4cb2-9a5b-536171ad00e7.service: Failed at step STDOUT spawning /opt/mountpoint-s3-csi/bin/mount-s3: Permission denied

unfortunately those services are super short lived, so I have no clue what STDOUT is actually set to and why the permissions may be wrong... any help is highly appreciated.

EDIT: it seems that mount-s3 is actually never run, but this permission problem makes the systemd process fail immediately.

@schlichtanders
Copy link
Author

I also tried using container_t now, it is also available. But even fails earlier within the s3 daemonset

failed to start systemd supervisor: Failed to connect to systemd: dial unix /run/systemd/private: connect: permission denied

@schlichtanders
Copy link
Author

schlichtanders commented Aug 27, 2024

I found out that ausearch -m avc -ts recent lists the selinux denials.

type=AVC msg=audit(1724744095.232:385753): avc:  denied  { open } for  pid=21922 comm="(mount-s3)" path="/dev/pts/6" dev="devpts" ino=9 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:devpts_t:s0 tclass=chr_file permissive=0

I have a hard time to parse this... any help is highly appreciated


ausearch -m avc -ts recent | audit2allow further outputs the following

#============= init_t ==============
allow init_t devpts_t:chr_file open;

not sure what to do out of this either

@schlichtanders
Copy link
Author

Apparently a similar issue is already reported at another issue #108 (comment) so this really seems to be the thing :)

@unexge
Copy link
Contributor

unexge commented Aug 27, 2024

We currently create pseudo-terminal to get stdout/stderr of mount-s3 process and most SELinux installations blocks it I think. We'll handle that as part of #169, but meanwhile, would you be able to use the workaround from the comment you shared using audit2allow?

@schlichtanders
Copy link
Author

yes indeed that workaround seems to work 👍

@unexge unexge added the bug Something isn't working label Aug 28, 2024
@unexge
Copy link
Contributor

unexge commented Sep 2, 2024

Closing this issue for now. Will be sharing updates regarding SELinux in #169.

@unexge unexge closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants