danwalsh


Dan Walsh's Blog

Got SELinux?


Previous Entry Add to Memories Share Next Entry
SELinux kernel parameters
danwalsh
Just a quick blog entry about the SELinux kernel parameters.  There are three kernel parameters that you can pass on boot to change the way SELinux runs.  

selinux=0  (Bad idea :^))
        If you want to Disable SELinux entirely.  You can boot the system with the SELINUX=0 kernel parameter.  This will cause the kernel to not load any of the SELinux infrastructure.  The init scripts will notice that you booted with SELINUX=0 and will touch /.autorelabel themselves.  This will cause the machine to automatically relabel the next time you boot with SELINUX enabled.  We do this because anytime you are booted with SELNUX=0 files will not get a label.  So the next time the system boots the SELinux would report these files as file_t and almost no domains can interfact with a file_t (Unlabeled file).  Files like /etc/resolv.conf get recreated at boot time and probably would get this label and the next time SELinux booted, all heck would break loose.

enforcing=0
    Setting this parameter will cause the machine to boot in permissive mode.  If your machine will not boot in enforcing mode, this can allow you to boot it and figure out what is wrong.  Sometimes you file system can get so messed  up that this parameter is your only option.  The nice thing about this option, the system continues to create the labels correctly.  The AVC messages that are created via this command can be different then in enforcing mode.    There are two differences in enforcing mode, every access denial is reported, in permissive only the first denial is reported.  However in Enforcing mode you might get a denial on reading a directory and the app will stop.  In permissive mode you would get the same avc message but then you would get an avc for each denial when the app continues reading files in the directory.

autorelabel=1
This parameter will force the system to relabel.  It does the same thing as "touch /.autorelabe; reboot".    Sometimes, if the machines labeling is really bad, you will need to boot in permissive mode in order for the autorelabel to succeed.  An example of this is switching from strict to targeted policy.  In strict policy shared libraries are labeled as shlib_t while ordinary files in /lib directories are labeled lib_t.  strict policy only allows confined apps to execute shlib_t.  In targeted policy shlib_t and lib_t are aliases.  (Having these files labeled differently is of little security importance and leads to labeling problems in my opinion). So every file in /lib directories gets the label lib_t. 
When you boot a machine that is labeled for targeted with strict policy the confined apps try to execute lib_t labeled shared libraries so and they are denied.  /sbin/init tries this and blows up.  So booting in permissive mode allows the system to relabel the shared libraries as shlib_t and then the next boot can be done in enforcing.

Hello.

(Anonymous)

2007-07-12 05:52 pm (UTC)

Hi. Me very much to like here. I shall advise this site to the friends.
I am sorry for my English. I only learn this language.

Kernel parameters

(Anonymous)

2007-07-30 01:20 pm (UTC)

ok, very explicite, (http://hardclic.com/) thx.

Informativ blog

(Anonymous)

2007-08-10 03:49 pm (UTC)

Very useful and informative blog. Recommended for all to see.
http://medsdrugs.blogspot.com/

xcoXAVFlAisdyvkRSAq

(Anonymous)

2008-02-20 01:22 pm (UTC)

licking the cock

hello

(Anonymous)

2008-03-24 03:10 pm (UTC)

Good site! My site about Kasinos

hello

(Anonymous)

2008-03-26 04:19 pm (UTC)

Good site! My site about adipex pills

You are viewing danwalsh