Like others here, I had a similar experience. I setup a simple minecraft server on a SELinux secured OS. So far, so good. I wanted to setup a systemd service to startup and shutdown the minecraft server. After ~1 hour of work later, I came to the conclusion that I was going to disable SELinux. Another hour later, I disabled SELinux. Much as the article mentions, there didn't seem to be much good help, especially w.r.…
SELinux is unmanageable; just turn it off if it gets in your way
151–160 of 461 posts
Re: SELinux is unmanageable; just turn it off if it gets in your way
#152The problem is not so much that selinux is too complicated (it is as complicated as it needs to be), but that we all run software we don't understand. The whole IT ecosystem has become a hail mary. Even admins usually have no idea what a certain program actually wants to do. If the admin knows how to install the app so that it actually runs, you call them a good admin. From a security point of view, an application is…
Take for instance something like xscreensaver. Something in there needs to be setuid so that it can verify your password to unlock the screen. That something is fortunately a dedicated binary, and not every single screensaver, but still, that's bad. Writing that executable is a delicate thing. Get one of them wrong, and it's a glaring hole.
And /usr/libexec/xscreensaver/xscreensaver-auth is quite the thing. It links to a whole bunch of graphical libraries and talks to X11 to read your password, so that thing has a huge potential attack surface. Far more than seems comfortable.
What we should have instead is some sort of authentication service. A program confined by SELinux to only interact with a socket and the password database, speaking a simple but well designed protocol.
With that in place we'd have much simpler security. Policies get simpler because random stuff doesn't link to PAM anymore, and so doesn't end up touching a whole bunch of critical security related files. There's one thing on the system that deals with that, and it ends up with a small, understandable policy.
And the policy for the users is now expressed in terms of "Do we want this program to be able to validate user passwords?", which is also far simpler.
With that kind of redesign over time we could have much smaller and more understandable policies, and a more secure system as a result.
Re: SELinux is unmanageable; just turn it off if it gets in your way
#153The problem is not so much that selinux is too complicated (it is as complicated as it needs to be), but that we all run software we don't understand. The whole IT ecosystem has become a hail mary. Even admins usually have no idea what a certain program actually wants to do. If the admin knows how to install the app so that it actually runs, you call them a good admin. From a security point of view, an application is…
This almost looks like a hint to OpenBSD's pledge and unveil system calls.
I'm just a hobbyist, but regarding
we all run software we don't understand
what I like (again) in OpenBSD is that I feel I can largely understand/control what's happening in my system, it quite fits in my head.
Just my 2 cents.
Re: SELinux is unmanageable; just turn it off if it gets in your way
#154Redhat has co-opted and has become an IBM of consulting firm: use obscured notation of an error code as a corporate revenue flow.
This is not a knock against SELinux nor against the inventor (NSA) thereof.
SELinux is a great privilege boundary setter at an extreme granulated level. SELinux is superior over many other system audit approaches in all area but one: that one is ease of use.
Another fault is that the Buy-ins of SELinux was placed upon the group of distro/package maintainers instead of upon the developer.
Another aspect on the ease of use is that There are no auto generation of SELinux policy given one executable file. No tools have attempted to adequately scan the code or object files for such its needed audit policy file. But this mapping of code to resource is often a skimped step of software development.
Unlike the development of apps for a GUI/WindowsManager environment, SELinux is NOT mandated by its own library to say “thou shall use all of me” or you don’t get go to heaven (or be seen on the computer).
Re: SELinux is unmanageable; just turn it off if it gets in your way
#155Let me just assure everyone that it's not broken by design. Many of us use SElinux to harden systems and services on a regular. But that said, it's not user friendly either. It's definitely a skill I list on my CV. Either learn it and feel better about it, or set it to permissive mode and live with that. I agree with mindwok, SElinux defaults from distro + containers work just fine. Rarely any policy issues, and you…
Re: SELinux is unmanageable; just turn it off if it gets in your way
#156Earlier quoted context omitted.
It still has the same gotchas as a user though. I was daemonizing a uvicorn (Python) process using systemd and could not get the Python script to write its log file anywhere. Not the current directory owned by the user, not elsewhere, and no errors showing up in the system logs. After a few hours banging my head against the wall I discovered systemd's ReadWritePaths. Once I set that, it would log to any directory I s…
Most systemd services log to stdout and let systemd put it in the journal, or they log to syslog and let systemd put it in the journal. Most don’t write their own log files any more. I really recommend going that route because it is nice to be able to search the journal, especially if you provide extra metadata for each log message. It sounds like you were using the DynamicUser=, ProtectSystem=, or ProtectHome= setti…
What a great time to be a Linux system administrator.
Re: SELinux is unmanageable; just turn it off if it gets in your way
#157Re: SELinux is unmanageable; just turn it off if it gets in your way
#158This is bad advice. SELinux might be hard, but it's neither unmanageable, nor it gets in your way when configured correctly. I've deployed both AppArmor and SELinux in high security environments, and they're nice layers of security to have. Yes, it has a learning curve, but it's worth it.
> Yes, it has a learning curve, but it's worth it. That depends wholly on the circumstances in which those tradeoffs must be considered - additional security vs ease of use. For people who don't work in banks and whatnot, the choice is probably rather simple to make, they'll just prefer to do whatever will let their code and software run as they want (be it permissive mode or disabling it). In those circumstances, SE…
Of course, horses for courses. That's always implied, and I always keep that in mind.
However, if there's a case which needs that level of security, telling "Nah, just disable it, we'll do containers instead" is wrong at best, very dangerous at worst.
Also, I find having a background knowledge about these technologies beneficial. Having more tools under one's belt is never a disadvantage. It'll give you abilities in the best case, and provide you perspective in the worst.
Re: SELinux is unmanageable; just turn it off if it gets in your way
#159As an experienced RHEL admin, a few years ago I probably would have said this is very bad advice in any professional context, and you should spend the time to learn it because it will save you one day. Now, I think my advice would be: Put everything in a container, and learn how to run Docker or Podman (or k8s) in a secure way (ie no root containers, be very careful with volume mounts, etc). Yes, they aren’t as matur…
As a lightweight alternative to Docker-based (or any container-based) solutions: Try firejail. You can set up a directory that will be the "home" of the sandboxed application you're running, then you can do something like `firejail --private="${HOME}/my_firefox_jail" firefox`. There are built-in profiles for many applications already, and you can customize them (by adding `.local` files, not editing the existing `.pr…
Also, afaik firejail runs as suid, making any possible escape much more serious.
Re: SELinux is unmanageable; just turn it off if it gets in your way
#160I've never had a job that would allow me to take a week to solve a production issue.