Live data from Hacker News

SELinux is unmanageable; just turn it off if it gets in your way

ctrl.blog

311–320 of 461 posts

Re: SELinux is unmanageable; just turn it off if it gets in your way

#311
post #134

The 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…

Honestly, the bigger issue is that most SWEs just aren’t very good. It’s extremely telling that when you spend time in tech forums most people dread system design questions as the harder side of interviewing for senior level SWE roles… System design, though, is the actual point of SW ENGINEERING. That’s the part that is responsible for creating a foundation of quality to build on. The other side is that sysadmins hav…

>System design, though, is the actual point of SW ENGINEERING.

I thought system design was the point of system engineering?

Re: SELinux is unmanageable; just turn it off if it gets in your way

#312

Earlier quoted context omitted.

Sysadmin Rule #1 - Is it SELinux? Sysadmin Rule #2 - Is it systemd? Sysadmin Rule #3 - Have you checked the logs?

Where's the time where you could just assume it was DNS.

That's covered by rule #2 (systemd-resolved)

Re: SELinux is unmanageable; just turn it off if it gets in your way

#313

Earlier quoted context omitted.

> The 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. There are many many problems. One of the biggest problem with SELinux is that it is trying to graft Mandatory Access Controls on a userland that is not designed for it. Unix, frankly, is not designed for security. It is designed to get work done by writing a bunch of…

My android phone came without a calculator app. I recently realized this in a setting where I needed a calculator. I commented out loud about the lack of calculator and got some responses from the group I was in at the time. "Just download one from the app store," I was told. "But be prepared to grant it network access, file access, contacts access, camera access, and email privileges."

That's really an app store problem.

Nothing says that Google couldn't prioritize applications that need the least permissions, or make it easy to filter by permissions, or even have an acceptance policy that said "A calculator app can't look into your contacts".

The system could favor the user in this regard, Google just doesn't want it to.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#314
post #134

The 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…

/etc/resolv.conf is a funny one.

Used to be, you could update it manually. Then NetworkManager (or whatever its successor is) came along and would change it back on you. Oh well, you could still edit it for a quick test.

Then I set up a Wireguard tunnel. And it changed /etc/resolv.conf. Oh, but an entry is missing, I'll just add that and test. Nope, read-only. But I'm root! What gives?

Turns out the wg-quick script mounts a file on top of /etc/resolv.conf! I didn't even know that was possible until I saw it. Nobody messes with wg-quick's resolv.conf, and that's final! Until some other tool ups the ante and gets code to undo that.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#315

I see a few obvious areas of improvement, all of which are "implementation details" and don't undermine the core principles of SELinux. > The SELinux denial audit log messages are too vague. You’re told that a label was denied reading from another label. Okay, what do those labels mean? Which programs? Which files, sockets, or whatever? Improve logging in the SELinux system. Clearly it was able to map the program/fil…

Policy should be included with the software package

I don't agree with this. When you do this, any malicious package can just ship a new policy that allows the maliciousness it's planning to do.

By all means, split up the mega-policy into usable app-sized chunks, but shipping the policy in the same rpm as the application is self-defeating.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#316

I see a few obvious areas of improvement, all of which are "implementation details" and don't undermine the core principles of SELinux. > The SELinux denial audit log messages are too vague. You’re told that a label was denied reading from another label. Okay, what do those labels mean? Which programs? Which files, sockets, or whatever? Improve logging in the SELinux system. Clearly it was able to map the program/fil…

> I see a few obvious areas of improvement, all of which are "implementation details" and don't undermine the core principles of SELinux.

Totally agree, except as you say, no one in the SELinux camp has bothered since 2000.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#317
post #315

I see a few obvious areas of improvement, all of which are "implementation details" and don't undermine the core principles of SELinux. > The SELinux denial audit log messages are too vague. You’re told that a label was denied reading from another label. Okay, what do those labels mean? Which programs? Which files, sockets, or whatever? Improve logging in the SELinux system. Clearly it was able to map the program/fil…

Policy should be included with the software package I don't agree with this. When you do this, any malicious package can just ship a new policy that allows the maliciousness it's planning to do. By all means, split up the mega-policy into usable app-sized chunks, but shipping the policy in the same rpm as the application is self-defeating.

The distro ships the packages and the SELinux policy. You're always trusting the distro. The mega policy also comes in an RPM.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#318
post #225

Earlier quoted context omitted.

Is Windows much better with its VMS legacy kernel? It has a complex permission model with ACLs and everything but that trades inadequate permissions for something like the SELinux problem. There are too many knobs. (For this discussion leave aside the backward compatibility baggage which is another issue.) The only approach that I see as viable without rebuilding the entire compute universe is VMs, either the web bro…

"We have an isolation problem. Let's use a VM!" Congratulations, you have just introduced an L1TF attack surface, and the bad guys are now freely reading all physical memory.

You have traded an absolutely enormous attack surface of hundreds of syscalls and a whole system full of files and apps for a much narrower attack surface involving the CPU and whatever the hypervisor exposes which can just be virtio-style pseudo-devices. Besides if the CPU is vulnerable than regular apps can probably exploit it too.

Also I didn't say the best approach would necessarily be hardware VMs, though that is one option and is valuable to let you just plug and play existing applications unmodified. I personally think we need to get away from shipping all software as raw hardware-tied binaries in favor of something like WASM. Java and the .NET CLR had the right idea decades ago, but these were insufficiently versatile and too tied to just one language or platform instead of being a general purpose VM bytecode. WASM is heading in the right direction but doesn't seem to quite be there yet.

Only apps that actually need to use e.g. special CPU features or run tightly optimized ASM code should ship with native binaries or native modules/libraries for the high-performance parts, and that should be something you have to approve.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#319

I've advocated for years that each program should be ran as its own user and group, isolated from the rest of the system. So let's say you run Firefox, is should run as firefox_username user and group. This way any exploit is ran with the user/group permissions, and unexploited it has no read write access outside its own user and group. Selinux is a beast but there are tools to help with determining which settings ne…

You can't do that, the permissions system isn't flexible enough, and the system will fight you.

Eg, pulseaudio runs as the logged in user, and your firefox won't be able to talk to it. No youtube for you.

Once you figure out the flexibility needed, you're back to SELinux pretty much.

Re: SELinux is unmanageable; just turn it off if it gets in your way

#320

the linux fiefdoms have a serious UX problem. SELinux being a prime example. As the article articulates, no wonder why people just turn it off. If your subsystems are not consistent, discoverable, palpable, and most important logical your setting yourself up for lousy adoption. And just "reading the docs" does not solve this problem. Your subsystem does not get to consume my professional time slice. The reason docker…

Right, right, and right. Even after mastering all the fundamentals of SELinux, six month later a different audit-related problem surfaced and “what was that command again?” This link often saves me: https://access.redhat.com/documentation/en-us/red_hat_enterp... In fact, I condensed it to the following steps (outlined elsewhere in this OP by patrck, new HN user): couple sysadm red flags: 1) The article author is Test…

The article author is Testing in PROD

when you acknowledge this, then continuing your advice with

  setenforce 0
is a spectacularly bad idea. You can make individual domains permissive using

  semanage permissive -a ${context}
and then run the failing test using only that permissive domain.

Of course, the story becomes much more complicated if the failing test requires type transitions -- but blanket advising people to put an entire PROD system in permissive mode is not a good idea.

Post reply on HN