LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-31-2012, 09:29 AM   #1
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Rep: Reputation: 22
Post Is SELinux hard to understand?


Hello all.
Is Selinux hard to understanding?

Thanks.
 
Old 07-31-2012, 09:33 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
it depends who's doing the understanding really. It's generally classed as an "advanced" subject, so compared to other areas, yes it's probably fair to say it's complicated.
 
Old 07-31-2012, 09:34 AM   #3
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
is it Complex?
 
Old 07-31-2012, 09:47 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I already answered your question. Use of synonyms don't change anything.
 
Old 07-31-2012, 12:50 PM   #5
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
If your looking to try to understand it, I think that Gentoo has some pretty good documentation with a good mix of both theory and practice. Link to enough reading material to keep you busy for a while.
 
Old 07-31-2012, 03:59 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Complex ? yes
but Hard ? NO !!
and is VERY EASY VERY EASY to use now

back in 2005 not so much
but now in 2012 - VERY EASY to use
 
Old 08-06-2012, 09:14 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You could try reading the relevant chapters here http://www.linuxtopia.org/online_boo...ion/index.html.
It certainly takes a while to get your head around, unless you are already familiar with the general concepts/theory.
 
Old 08-07-2012, 01:44 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
RBAC has been used "forever" in some other universes.
SELinux is not hard to understand when it's working - just look at Fedora; these days most people probably don't even disable it, they don't even know it's there. But it can be a mongrel when it's not (working). Although as @John VV points out above, things is better these days. There are even tools that accept the error message and give you a proposed solution - which is generally pretty close to the mark.
 
Old 08-07-2012, 04:56 AM   #9
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
SElinux is easy if you just want to protect services (for example apache).
You only need to give the correct context to the files/dirs and enable some booleans for using php db connects for example.

If you want to create own policies it might be more complex. But that is not the use for most users.
 
Old 08-09-2012, 05:39 AM   #10
hawk1278
LQ Newbie
 
Registered: Aug 2012
Posts: 12

Rep: Reputation: Disabled
It is not nearly as difficult as it use to be. Get a copy of CENTOS or something like that and google around for some documentation and just play around with it. As another user said working with selinux with the services that it protects out of the box is pretty straightforward. Having to write your own custom policies can be tricky. You can always put selinux in permissive mode, see what get's blocked and figure out a policy rule from that.

The tools to manage selinux have improved significantly over the years.
 
Old 08-22-2012, 03:55 PM   #11
dcarrington
Member
 
Registered: Dec 2011
Distribution: RHEL, CentOS, Ubuntu
Posts: 61

Rep: Reputation: 2
IMHO, the part about how SELinux works is fairly straightforward. Contexts, booleans and such don't take much to understand.

The more complicated part, and I still haven't found a sufficient explanation for this, has more to do with how/when to create custom policies.

I have several servers that have had SELinux either Disabled or Permissive for a long time and now I'm trying to sift through the audit logs to make sure I don't break everything when I turn it on.

While it's easy enough to use commands like ausearch and audit2allow, the issue is whether or not some of the activity is SUPPOSED to be allowed and if it IS, then why is SELinux trying to block it? I haven't found a way to identify what the various things are trying to do in order to know whether it's supposed to be able to do that or not.

So, while SELinux is not very difficult or complex in one sense, it can be very complex in a completely different sense.

For example:

type=SYSCALL msg=audit(1345667559.692:219271): arch=40000003 syscall=11 success=yes exit=0 a0=8a8f130 a1=8a8ad70 a2=8a8cd18 a3=40 items=0 ppid=938 pid=939 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ifconfig" exe="/sbin/ifconfig" subj=system_u:system_r:ifconfig_t:s0 key=(null)
type=AVC msg=audit(1345667559.692:219271): avc: denied { read write } for pid=939 comm="ifconfig" path="socket:[13363]" dev=sockfs ino=13363 scontext=system_u:system_r:ifconfig_t:s0 tcontext=system_u:system_r:initrc_t:s0 tclass=tcp_socket


So, should I create a policy to allow this? Should I not audit this event at all? Will this break something if I set SELinux to Enforcing? I really don't know.

Last edited by dcarrington; 08-22-2012 at 04:13 PM. Reason: Additional info
 
Old 08-22-2012, 07:22 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try audit2why http://linux.die.net/man/8/audit2why to get some detailed msgs
 
Old 08-22-2012, 07:44 PM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by dcarrington View Post
So, should I create a policy to allow this?
If you want the syscall to succeed, yes.
Would have been better if you would have started your own thread for your own questions BTW.


Quote:
Originally Posted by dcarrington View Post
Should I not audit this event at all?
Not if you want to know if ifconfig_t tries to do something in the initrc_t context.


Quote:
Originally Posted by dcarrington View Post
Will this break something if I set SELinux to Enforcing?
Audit2allow returns "allow ifconfig_t initrc_t:tcp_socket { read write };" meaning ifconfig socket calls would fail during system boot, that is processes started in the initrc_t context AFAIK.
 
Old 08-23-2012, 12:05 PM   #14
dcarrington
Member
 
Registered: Dec 2011
Distribution: RHEL, CentOS, Ubuntu
Posts: 61

Rep: Reputation: 2
@unSpawn,

The purpose of my post was not necessarily to get answers to this issue it was to help jokar, the original poster, by giving an example of how SELinux can be complicated in one sense and not that complicated in another sense. The questions were rhetorical and meant to simply make the point that these are the things that need to be considered. That is why I did not create my own post for this issue...I wasn't seeking a solution, just sharing what I have found to be somewhat challenging with regards to why/when/how to determine of custom policies are needed.

In hindsight, I can see why it might have been perceived as attempting to hijack the thread, but I wanted to clarify that.
 
Old 08-23-2012, 12:16 PM   #15
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Ah, OK. I was only trying to see it as another question deserving an answer :-]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Understand hard drive failure log gacanepa Linux - Hardware 4 08-01-2012 02:20 PM
[SOLVED] Very high SLAB usage, hard to understand nwrk Linux - Server 17 10-01-2011 10:04 PM
Help to understand how to automount a usb ntfs hard drive gwagchunks Linux - Newbie 2 07-31-2009 01:57 PM
selinux hard link count blues jmjaffe Fedora 1 06-23-2006 12:33 PM
Hard to understand how to install gui(mplayer) akihandyman Linux - Newbie 3 12-30-2003 02:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration