Live data from Hacker News

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

ctrl.blog

51–60 of 461 posts

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

#51

How does SElinux compare to Secure Boot / SIP?

Security-Enhanced Linux (SELinux) is a security architecture for Linux systems that allows administrators to have more control over who can access the system. It was originally developed by the NSA.

Secure Boot and SIP are about boot integrity preventing malware early on in the boot process [1]

[1] https://www.rodsbooks.com/refind/secureboot.html

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

#52
This 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.

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

#53
post #12

Well, Android has it always turned on for several years now.

Mobile applications require various permissions which can be enforced via SELinux.

SELinux policy can also be written to mitigate many vulnerabilities and vulnerability classes/vectors. Over 40% [1] of Android users may no longer be receiving important security updates, potentially putting them at risk of malware, data loss and cyber attacks.

Seems to make sense to have it enabled on Android based on the above.

[1] https://www.which.co.uk/news/2020/03/more-than-one-billion-a...

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

#54

My advice is to ALWAYS turn it off. As soon as you install a new system, turn it off (together with systemd).

> turn it off (together with systemd) How practical is just turning off systemd today? I hate it too, but hasn't Red Hat basically strong-armed so many important Linux components into adding a hard-dep on it that your only way of avoiding it is to use a distro purpose-built to (e.g., Devuan)?

Systemd is only really required if you want to run gnome or kde easily. It's not an issue otherwise. Probably more trouble than it's worth to replace it in a distro that uses it by default though!

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

#55
post #38

I have to say, for sysadmin work I find this view sorta overblown. My experience is with RHEL and derivatives, not Fedora, and for the most part those are very straightforward and while selling does rear it's head every once in a while, it's usually not that problematic to work around. When you have something failing that you need to fix and isn't an upstream problem (i.e. your own app or some third party vendor), yo…

[deleted]

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

#56
post #2

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

A couple sysadm red flags:

1) The article author is Testing in PROD

2) selinux debugging relies on auditd, so sanity checks required.

  df -P /var/log/audit # has space?
  tail -1 /var/log/audit/audit.log # is recent?
  semodule -DB  # disable dontaudit
  setenforce 0
  # run the failing test
  audit2allow -l
After which the selinux debugging experience boils down to:

    mk_semod() {
        module_name=$1; shift
        audit2allow -l -m ${module_name} -a > ${module_name}.te
        $EDITOR ${module_name}.te || return
        checkmodule -M -m -o ${module_name}.mod ${module_name}.te
        semodule_package -o ${module_name}.pp -m ${module_name}.mod
        semodule -i ${module_name}.pp
    }

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

#57

I've always preferred apparmor. SELinux has always seemed radically more complex for very little benefit, unless you have a tightly constrained OS (like Android, where the VM does most of the work and every app has the same sort of security policy) or a team of admins working full time to maintain it (again, like Android). Apparmor is weak in all the same ways SELinux is weak, at least in terms of the ways that actua…

This is exactly my experience.

To expand a little, for a vertically integrated OS like Android or RHEL (official packages only!) SELinux can work.

For a sysadmin trying to configure a custom service or anything outside official repositories then AppArmor is actually usable where SELinux isn't.

But what you probably want is a Docker (or Podman) container, which gets you 90% of the hardening with 1% of the effort.

If a container isn't viable for whatever reason, then a systemd "contained" service is also very easy to configure. See `man systemd.exec`.

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

#58
The question is: what good is a security system that tells me to "just allow whatever the problem is", once a problem comes up? Without being able to see the specifics of a request and blindly following the whitelisting I could end up allowing some hacked module access to critical files without knowing. Opening the system to exactly the dangers I'm seeking to stop.

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

#59
post #12

Well, Android has it always turned on for several years now.

Mobile applications require various permissions which can be enforced via SELinux. SELinux policy can also be written to mitigate many vulnerabilities and vulnerability classes/vectors. Over 40% [1] of Android users may no longer be receiving important security updates, potentially putting them at risk of malware, data loss and cyber attacks. Seems to make sense to have it enabled on Android based on the above. [1] h…

Another reasons it is turned on, alongside seccomp, is to make sure app developers don't mistake Android for Linux, something that Termux guys aren't very found of.

https://android-developers.googleblog.com/2016/06/android-ch...

https://android-developers.googleblog.com/2017/07/seccomp-fi...

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

#60
post #38

I have to say, for sysadmin work I find this view sorta overblown. My experience is with RHEL and derivatives, not Fedora, and for the most part those are very straightforward and while selling does rear it's head every once in a while, it's usually not that problematic to work around. When you have something failing that you need to fix and isn't an upstream problem (i.e. your own app or some third party vendor), yo…

In my experience creating and applying new policies with audit2allow is almost always the wrong thing to do. Most SELinux issues are either a SELinux boolean that needs enabling, or SELinux file type that needs changing.

The few times where you do need to create new policies then audit2allow is useful but still requires you to review and understand the changes it's going to make before applying them.

Post reply on HN