22 SELinux file system labels | man -k _selinux | mandb | yum provides */sepolicy | semanage fcontext -l
[root@localhost www]# ls -Zl
total 0
drwxr-xr-x. 2 system_u:object_r:httpd_sys_script_exec_t:s0 root root 6 Apr 12 17:04 cgi-bin
drwxr-xr-x. 2 system_u:object_r:httpd_sys_content_t:s0 root root 24 Sep 20 17:00 html
[root@localhost www]#
total 0
drwxr-xr-x. 2 system_u:object_r:httpd_sys_script_exec_t:s0 root root 6 Apr 12 17:04 cgi-bin
drwxr-xr-x. 2 system_u:object_r:httpd_sys_content_t:s0 root root 24 Sep 20 17:00 html
[root@localhost www]#
List all file contexts
[root@localhost www]# semanage fcontext -l | more
SELinux fcontext type Context
/.* all files system_u:object_r:default_t:s0
/[^/]+ regular file system_u:object_r:etc_runtime_t:s0
/a?quota\.(user|group) regular file system_u:object_r:quota_db_t:s0
/nsr(/.*)? all files system_u:object_r:var_t:s0
/sys(/.*)? all files system_u:object_r:sysfs_t:s0
/xen(/.*)? all files system_u:object_r:xen_image_t:s0
/mnt(/[^/]*)? directory system_u:object_r:mnt_t:s0
[root@localhost www]# semanage fcontext -l | grep httpd | more
/usr/.*\.cgi regular file system_u:object_r:httpd_sys_script_exec_t:s0
/opt/.*\.cgi regular file system_u:object_r:httpd_sys_script_exec_t:s0
/srv/([^/]*/)?www(/.*)? all files system_u:object_r:httpd_sys_content_t:s0
/srv/([^/]*/)?www/logs(/.*)? all files system_u:object_r:httpd_log_t:s0
/var/www(/.*)? all files system_u:object_r:httpd_sys_content_t:s0
/var/www(/.*)?/logs(/.*)? all files system_u:object_r:httpd_l og_t:s0
=========================
Generate SELinux manpages
[root@localhost www]# man -k _selinux
pam_selinux (8) - PAM module to set the default security context
[root@localhost www]#
there are no SELinux manuals by default, we need to generated them by ourselves by using sepolicy utility which isn't installed by default
=========================
[root@localhost www]# yum provides */sepolicy
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 6987.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 108 M RSS (439 MB VSZ)
Started: Sat Sep 23 09:16:19 2017 - 00:11 ago
State : Running, pid: 6987
Loading mirror speeds from cached hostfile
* base: centos.ip-connect.vn.ua
* extras: centos.ip-connect.vn.ua
* updates: centos.ip-connect.vn.ua
policycoreutils-devel-2.5-8.el7.i686 : SELinux policy core policy devel utilities
Repo : base
Matched from:
Filename : /usr/share/bash-completion/completions/sepolicy
Filename : /usr/bin/sepolicy
policycoreutils-devel-2.5-8.el7.x86_64 : SELinux policy core policy devel utilities
Repo : base
Matched from:
Filename : /usr/share/bash-completion/completions/sepolicy
Filename : /usr/bin/sepolicy
policycoreutils-devel-2.5-9.el7.i686 : SELinux policy core policy devel utilities
Repo : updates
Matched from:
Filename : /usr/share/bash-completion/completions/sepolicy
Filename : /usr/bin/sepolicy
=========================
[root@localhost www]# yum install -y policycoreutils-devel
=========================
[root@localhost www]# sepolicy manpage -a
update mandb index
[root@localhost www]# mandb
=========================
[root@localhost tmp]# mv * /usr/share/man/man8
[root@localhost www]# mandb
=========================
[root@localhost tmp]# man -k _selinux | more
_selinux (8) - Security Enhanced Linux Policy for the processes
abrt_dump_oops_selinux (8) - Security Enhanced Linux Policy for the abrt_dump_oops p...
abrt_handle_event_selinux (8) - Security Enhanced Linux Policy for the abrt_handle_e...
abrt_helper_selinux (8) - Security Enhanced Linux Policy for the abrt_helper processes
=========================
[root@localhost tmp]# man -k httpd | grep selinux
apache_selinux (8) - Security Enhanced Linux Policy for the httpd processes
httpd_helper_selinux (8) - Security Enhanced Linux Policy for the httpd_helper proce...
httpd_passwd_selinux (8) - Security Enhanced Linux Policy for the httpd_passwd proce...
httpd_php_selinux (8) - Security Enhanced Linux Policy for the httpd_php processes
httpd_rotatelogs_selinux (8) - Security Enhanced Linux Policy for the httpd_rotatelo...
httpd_selinux (8) - Security Enhanced Linux Policy for the httpd processes
httpd_suexec_selinux (8) - Security Enhanced Linux Policy for the httpd_suexec proce...
httpd_sys_script_selinux (8) - Security Enhanced Linux Policy for the httpd_sys_scri...
httpd_unconfined_script_selinux (8) - Security Enhanced Linux Policy for the httpd_u...
httpd_user_script_selinux (8) - Security Enhanced Linux Policy for the httpd_user_sc...
[root@localhost tmp]#
Comments
Post a Comment