Bookmark this page

Changing SELinux Booleans

  • setsebool activates/deactivates SELinux policy rules.

  • semanage boolean -l displays the persistent value of SELinux Booleans.

  • Man pages that end with _selinux often provide useful information about SELinux Booleans.

Objectives

After completing this section, students should be able to use SELinux Booleans to make adjustments to policy behavior.

Managing SELinux Booleans

SELinux Booleans

SELinux Booleans are switches that change the behavior of the SELinux policy. SELinux Booleans are rules that can be enabled or disabled. They can be used by security administrators to tune the policy to make selective adjustments.

The selinux-policy-devel package provides many manual pages, *_selinux(8), which explain the purpose of the Booleans available for various services. If this package has been installed, the man -k '_selinux' command can list these documents.

The getsebool command is used to display SELinux Booleans and setsebool is used to modify them. setsebool -P modifies the SELinux policy to make the modification persistent. semanage boolean -l will show whether or not a Boolean is persistent, along with a short description of the Boolean.

[root@serverX ~]# getsebool -a
abrt_anon_write --> off
abrt_handle_event --> off
abrt_upload_watch_anon_write --> on
antivirus_can_scan_system --> off
antivirus_use_jit --> off
...
[root@serverX ~]# getsebool httpd_enable_homedirs
httpd_enable_homedirs --> off
[root@serverX ~]# setsebool httpd_enable_homedirs on
[root@serverX ~]# semanage boolean -l | grep httpd_enable_homedirs
httpd_enable_homedirs          (on   ,  off)  Allow httpd to enable homedirs
[root@serverX ~]# getsebool httpd_enable_homedirs
httpd_enable_homedirs --> on
[root@serverX ~]# setsebool -P httpd_enable_homedirs on
[root@serverX ~]# semanage boolean -l | grep httpd_enable_homedirs
httpd_enable_homedirs          (on   ,   on)  Allow httpd to enable homedirs

To only list local modifications to the state of the SELinux booleans (any setting that differs from the default in the policy), the command semanage boolean -l -C can be used.

[root@serverX ~]# semanage boolean -l -C
SELinux boolean                State  Default Description

cron_can_relabel               (off   ,   on)  Allow cron to can relabel

References

booleans(8), getsebool(8), setsebool(8), semanage(8), semanage-boolean(8) man pages

Revision: rh134-7-63a207e