Your visual how-to guide for SELinux policy enforcement (opensource.com)
SElinux is a labeling system. Every process has a label. Every file/directory object in the operating system has a label. Even network ports, devices, and potentially hostnames have labels assigned to them. We write rules to control the access of a process label to an a object label like a file. We call this policy. The kernel enforces the rules."
Posted Nov 14, 2013 20:42 UTC (Thu)
by NightMonkey (subscriber, #23051)
[Link] (43 responses)
Ever since I saw it just slam a NAS farm via shared NFS mounts with its lumbering scans after a ruleset upgrade, no more, said I.
Or maybe that's just me, or maybe there are places that really, really use it and would be lost without it. But I don't want it to be enabled by default. Ever.
Posted Nov 14, 2013 21:10 UTC (Thu)
by Henning (subscriber, #37195)
[Link] (39 responses)
I can feel that it does force you to do it the Red Hat way (I have not tried the policies of other distros to know how they work) or you will be forced to deal with special written policies and exceptions, but that is for me a small price to pay to unify administration and setup.
Posted Nov 14, 2013 21:51 UTC (Thu)
by NightMonkey (subscriber, #23051)
[Link] (16 responses)
Posted Nov 14, 2013 22:10 UTC (Thu)
by raven667 (subscriber, #5198)
[Link] (11 responses)
Posted Nov 15, 2013 2:40 UTC (Fri)
by dlang (guest, #313)
[Link] (2 responses)
the default RHEL policies cause so few problems because they enforce so little. (note that this is after they were opened repeatedly because the tighter limits did cause grief)
If your custom apps aren't affected by SELinux, then does it really help? in a reasonable network setup, the only thing that the outside world should be able to get at is your custom app, and if it's running as an unconfined user, so will any exploits that get sent to your app.
For a LSM, you really need something that a good admin can use to lock down your custom app without going crazy. SELinux doesn't seem to be meeting this requirement.
Posted Nov 15, 2013 3:21 UTC (Fri)
by raven667 (subscriber, #5198)
[Link] (1 responses)
The pre-built policies are comprehensive, covering most or all of the daemons and software which comes with the system. Of course if you don't have a policy for your custom application then this doesn't provide a benefit, but it also isn't a hindrance which was the main point. You can write a policy for your in-house apps if you want and take advantage and they are complicated because they are comprehensive and fine grained. I don't think that another system with the same comprehensive fine grained control would be any less complicated, just different, so this kind of sandboxing does require effort and attention to detail.
Posted Nov 16, 2013 14:31 UTC (Sat)
by PaXTeam (guest, #24616)
[Link]
fortunately there is, available for over a decade now :).
Posted Nov 15, 2013 14:07 UTC (Fri)
by epa (subscriber, #39769)
[Link] (7 responses)
So to check the permissions you 'ls -l' the file. That shows it readable. This is all most confusing unless you know in advance to look out for SELinux. If SELinux is to be turned on by default, then for sanity:
- error messages should give useful information, not just stock error strings (and yes I know that replacing the ancient errno mechanism will be a big job, but it is decades overdue). And no, some weird GUI thing that floats up alerts over your desktop is not an acceptable substitute.
- classic Unix permission tools such as chmod need to be SELinux-aware. If you ask for 'a+r' (readable by all) then it should either give you that, modifying the SELinux policies if necessary, or give a warning that 'readable by all' is not a possible setting for this file.
- and of course, tools that report permissions such as ls must report SELinux settings that affect those permissions, as far as is possible.
Posted Nov 15, 2013 15:32 UTC (Fri)
by raven667 (subscriber, #5198)
[Link] (6 responses)
This part is done, tools like ls, ps, etc. support the -Z option which shows SELinux types
> error messages should give useful information
As you point out that is a system wide inheritance from UNIX and may be very difficult or impossible to change while maintaining compatibility with the last 30yrs of already written software. I dunno. There is a utility, selinux-troubleshooter, which should probably be running by default on any enforcing system not just GUI ones, which reads the audit logs and writes out human readable error messages to syslog.
Posted Nov 15, 2013 18:51 UTC (Fri)
by epa (subscriber, #39769)
[Link] (3 responses)
Posted Nov 15, 2013 23:54 UTC (Fri)
by nix (subscriber, #2304)
[Link] (2 responses)
Posted Nov 16, 2013 2:59 UTC (Sat)
by robertm (subscriber, #20200)
[Link]
Posted Nov 16, 2013 9:13 UTC (Sat)
by epa (subscriber, #39769)
[Link]
While it would be great to have a carefully specified 'error struct' with inheritance hierarchies, template-based localization and all the rest, that is icing on the cake compared to the basic task of getting some more useful information into error messages. Let's not let the best be the enemy of the good.
Posted Nov 16, 2013 9:02 UTC (Sat)
by oldtomas (guest, #72579)
[Link] (1 responses)
Thus rendering lots of little utils binary-dependent on some obscure libselinux. Thanks for reminding us of that.
Posted Dec 8, 2013 16:40 UTC (Sun)
by nix (subscriber, #2304)
[Link]
Posted Nov 14, 2013 22:27 UTC (Thu)
by rahulsundaram (subscriber, #21946)
[Link] (2 responses)
http://source.android.com/devices/tech/security/enhanceme...
If you are running Fedora or RHEL where there is a well tested and extremely well maintained set of SELinux policies, there aren't many reasons to go out of your way to turn it off when it is possible to tweak policies or run specific daemons in a unconfined manner as a incremental step towards full enforcement.
Posted Nov 15, 2013 3:40 UTC (Fri)
by duffy (guest, #31787)
[Link] (1 responses)
Posted Nov 15, 2013 4:11 UTC (Fri)
by rahulsundaram (subscriber, #21946)
[Link]
http://source.android.com/devices/tech/security/enhanceme...
Posted Nov 14, 2013 22:35 UTC (Thu)
by Henning (subscriber, #37195)
[Link]
I can agree that poorly designed software can be problematic to lock down but then you almost always have the option of running it unconfined while letting the rest of the system to benefit from the extra layer of security.
But, to me, disabling SELinux as a solution is basically the same response as setting the file permissions to 777 when stumbling on a file access problem. It will solve the problem and no time is needed to research the it, but there is usually a better and more well confined solution.
Posted Nov 15, 2013 4:03 UTC (Fri)
by lamawithonel (subscriber, #86149)
[Link] (21 responses)
The number of recent, highly publicized vulns which SELinux can mitigate is astounding. My only complaint is the userspace CLI. I would really like to see it unified into a smaller set of commands with a sub-command interface, like Git, iproute2, Puppet, Ganeti, etc. I think that would soften the learning curve, if only a little.
Posted Nov 15, 2013 4:46 UTC (Fri)
by NightMonkey (subscriber, #23051)
[Link] (7 responses)
Is SELinux the ONLY way to mitigate these vulnerabilities you reference? Would just updating the packages do the same?
Posted Nov 15, 2013 5:29 UTC (Fri)
by raven667 (subscriber, #5198)
[Link]
Why wouldn't you want to use all of the effective tools at your disposal, especially with no effort on your part?
Posted Nov 15, 2013 9:12 UTC (Fri)
by khim (subscriber, #9252)
[Link] (5 responses)
Do you really think patches can affect systems where they are not installed yet but will be installed soon? Causality does not work this way.
Posted Nov 15, 2013 19:08 UTC (Fri)
by NightMonkey (subscriber, #23051)
[Link] (4 responses)
Adding more noise doesn't help us be more secure. I believe that my time, in the environments that I support, is better spent taking packages out of the default install. The easiest software to administer is software that is never installed. :)
Posted Nov 15, 2013 20:38 UTC (Fri)
by FranTaylor (guest, #80190)
[Link] (3 responses)
Yeah I need to get back the whole second I spent deciding whether or not to check selinux in the installer.
"and an organizational willingness to encourage and support sysadmins to investigate every alert line emitted by SELinux. "
Yeah I also need to get back all the time I've spent (none!) looking over all those logs in all the systems where I've enabled selinux, because the bugs that happen on my machine don't ever happen on any other machine and there is no chance that any redhat engineer will ever find it.
Posted Nov 16, 2013 22:42 UTC (Sat)
by pboddie (guest, #50784)
[Link] (2 responses)
It's a harder sell when you have people being pestered by dialogues on their desktop about something linking to zlib in the wrong way, where they have no idea how it is being caused, no idea how to avoid it, and no means of stopping it or turning the dialogues off. I remember this "fondly" from RHEL a couple of releases back.
Sometimes I think that the "feature" of RHEL to shove dialogues in unprivileged users' faces is some kind of teaser: here's what you could do if you were root. New updates available? Sorry, you can't do that! Please don't press this button again. To be fair, I do wonder whether other distributions check to see whether a user could elevate their privileges before dangling such things in front of them.
Posted Nov 17, 2013 17:01 UTC (Sun)
by apoelstra (subscriber, #75205)
[Link] (1 responses)
Well, there is no way the OS can tell whether or not the human at the terminal knows the root password.
But I agree these messages are irritating when there's nothing you can do about them.
Posted Nov 28, 2013 19:56 UTC (Thu)
by Wol (subscriber, #4433)
[Link]
Cheers,
Posted Nov 15, 2013 12:43 UTC (Fri)
by spender (guest, #23067)
[Link] (12 responses)
Oh wait, I've never said that.
http://www.youtube.com/watch?v=WI0FXZUsLuI
Please tell me how SELinux could prevent exploitation of the PERF_EVENTS vulnerability given that it has no control whatsoever over the perf_event_open syscall? How about vmsplice? Or perf_counter? Or move_pages? It matters not one whit how complex or supposedly "locked down" a policy is when the TCB is so wide open that the same exploitation techniques I used 6 years ago still work today.
Red Hat loves to promote this illusion: http://farm1.static.flickr.com/223/481929076_959cdef97d_o...
I am so tired of this blind faith in SELinux created out of a combination of appeal to NSA authority/"expertise", the equivocation that if it's not bothering you that it's somehow enforcing secure policies (because it's SELinux after all!), the false belief that SELinux has full control over the system, and the complete ignorance of kernel exploits. Stupid cartoons and metaphors that abstract out the important details do nothing but promote fetishism of the technology.
-Brad
Posted Nov 15, 2013 13:41 UTC (Fri)
by rmayr (subscriber, #16880)
[Link]
Posted Nov 15, 2013 22:02 UTC (Fri)
by walters (subscriber, #7396)
[Link] (9 responses)
> Red Hat loves to promote this illusion
I work for Red Hat and have contributed to SELinux, and just for what it's worth, I completely agree that the kernel flaws diminish the value of SELinux (they also diminish the value of DAC, of course).
There are mitigations of course for some of them; userspace can make use of the seccomp mode 2 bits to disallow Apache access to perf for example.
But I think your rants about SELinux are misplaced; the exploitable holes don't exist *because* of SELinux in any way.
You maintain a number of out-of-tree patches, I know, but still: I think you'd find it a more rewarding use of time trying to figure out how to better prevent new API from being exploitable than ranting in an LWN comment.
For example, helping Dave Jones with on Trinity, joining in code review upstream, etc.
Posted Nov 15, 2013 22:20 UTC (Fri)
by NightMonkey (subscriber, #23051)
[Link] (2 responses)
Posted Nov 15, 2013 22:24 UTC (Fri)
by walters (subscriber, #7396)
[Link]
Posted Nov 15, 2013 22:35 UTC (Fri)
by walters (subscriber, #7396)
[Link]
And before I forget to say - I am certainly not speaking on behalf of Red Hat here in any way. I contributed to SELinux on my free time before working at Red Hat, and my response to Brad was from that perspective; I don't think a useful article on SELinux merited the *tone* of his response.
Posted Nov 16, 2013 1:52 UTC (Sat)
by spender (guest, #23067)
[Link] (5 responses)
> There are mitigations of course for some of them; userspace can make use of the seccomp mode 2 bits to disallow Apache access to perf for example.
What's Red Hat doing about it?
> But I think your rants about SELinux are misplaced; the exploitable holes don't exist *because* of SELinux in any way.
I guess if you don't count that whole thing about SELinux making otherwise unexploitable null ptr dereferences exploitable for a year or so (between RHEL 5.2 and 5.4):
The problem is you come here and give these token admissions about kernel vulnerabilities, but what is Red Hat doing about it other than fixing individual bugs after the fact? SELinux is your hammer and you consider everything in security to be nails. You can deny it all day, but it's evident from what Red Hat has produced in the past decade, what they keep presenting at each Linux Security Summit: SELinux, SELinux, SElinux, and the occasional poor NIH-version of techniques developed by others (often us). Red Hat lacks security vision -- there's no innovation going on and no proactive approach; it's a joke. It's even obvious from your final sentence that mimics what upstream thinks is best effort (https://www.youtube.com/watch?v=VDsHxJjvKSk&t=34m20s): the horribly buggy 1992AD-style fuzzer Trinity, auditing code, and source analyzers.
I've taken your message about finding more rewarding use of my time to heart, so I wanted to share this image with you from tonight regarding the non-existent security benefit of Red Hat's prized module signing enforcement (billed as some kind of rootkit defense since 2006 or so):
Thanks,
Posted Nov 21, 2013 20:37 UTC (Thu)
by flewellyn (subscriber, #5047)
[Link] (4 responses)
Posted Dec 3, 2013 19:53 UTC (Tue)
by BenHutchings (subscriber, #37955)
[Link] (3 responses)
Presumably something like:
Posted Dec 3, 2013 20:02 UTC (Tue)
by mjg59 (subscriber, #23239)
[Link] (2 responses)
Posted Dec 3, 2013 20:40 UTC (Tue)
by BenHutchings (subscriber, #37955)
[Link] (1 responses)
Posted Dec 3, 2013 21:00 UTC (Tue)
by mjg59 (subscriber, #23239)
[Link]
Posted Nov 15, 2013 22:09 UTC (Fri)
by deepfire (guest, #26138)
[Link]
Posted Nov 14, 2013 22:02 UTC (Thu)
by rwmj (subscriber, #5474)
[Link]
Posted Nov 14, 2013 22:14 UTC (Thu)
by raven667 (subscriber, #5198)
[Link] (1 responses)
Anything that recurses through a directory tree looking at the file metadata is going to have that effect, there isn't anything the tool is doing wrong, find / -ls would do the same thing.
Posted Nov 17, 2013 21:06 UTC (Sun)
by k8to (guest, #15413)
[Link]
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
In my experience it is very good at catching cases where the setup has not been thought out or where people try to do odd things which preferably should be done other ways (like working as root when you deal with user-content).
By enforcing everything to be done in certain ways helps me enforce security policies and helps a lot in documentation.
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
> they can do anything but there is no security technology which can
> prevent that from happening.
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Of course, the problem with errstr is that now you have to translate it.
While user-facing error messages should of course be translated, I think this is a false consideration for system-call-level errors. They do not need to be translated any more than open() needs to be renamed abrir(). The existing errno is still there, and can be looked up in translation tables as before; then the full errstr is available for more technical reporting of what went wrong. If you do not speak English you are unlikely to understand SELinux configuration either.
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
There might be some knobs you have to hit or some special directory labling you have to define as part of installing a certain software (for example a ftp server), but that is very little time spent on SELinux in comparison with the time spent on configuring the rest of the solution and making it secure.
SELinux helps me making sure that everything is working as intended and helps detect corner cases or oddities that might have been flaws or issues not thought of when designing the solution and that is well worth the extra time on SELinux for the few cases when it is needed.
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Is SELinux the ONLY way to mitigate these vulnerabilities you reference? Would just updating the packages do the same?
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Wol
Your visual how-to guide for SELinux policy enforcement (opensource.com)
"If it weren't for SELinux, this exploit would have worked!"
http://www.youtube.com/watch?v=EXDwyezuOOM
http://www.youtube.com/watch?v=jt81NvaOj5Y
http://www.youtube.com/watch?v=KvREwhfQmbc
http://www.youtube.com/watch?v=fUNE5t-bqsQ
http://www.youtube.com/watch?v=arAfIp7YzZ4
http://www.youtube.com/watch?v=iN1fdvktRbk
http://www.youtube.com/watch?v=UdkpJ13e6Z0
but this is the reality: http://grsecurity.net/~spender/pics/mac_security_sesamest...
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
https://access.redhat.com/site/articles/17995
Only fixed because of the release of one of my exploits, who knows how long it would have stayed exploitable otherwise.
http://grsecurity.net/~spender/modulesigning.png
-Brad
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
addr="$(awk '$3 == "signedonly" { print $1 }' /proc/kallsyms)"
# exploit bug to write 0 to $addr
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
Your visual how-to guide for SELinux policy enforcement (opensource.com)
