httpd_selinux(8)
π Bestieβs guide to httpd_selinux(8) π
β¨ NAME β¨
httpd_selinux β Security Enhanced Linux Policy for the httpd processes
π¦ DESCRIPTION π¦
Okay so Security-Enhanced Linux secures the httpd processes via flexible mandatory access control. Thatβs the whole vibe.
The httpd processes execute with the httpd_t SELinux type. Wanna check if youβve got these processes running? Execute the ps command with the -Z qualifier.
For example:
ps -eZ | grep httpd_t
πΈ ENTRYPOINTS πΈ
The httpd_t SELinux type can be entered via the httpd_exec_t file type.
The default entrypoint paths for the httpd_t domain are the following:
/usr/bin/httpd(.worker)?, /usr/bin/apache(2)?, /usr/bin/httpd2-.*,
/usr/bin/apache-ssl(2)?, /usr/lib/apache-ssl/.+, /usr/bin/nginx,
/usr/bin/thttpd, /usr/bin/php-fpm, /usr/bin/cherokee, /usr/bin/lighttpd,
/usr/bin/apachectl, /usr/bin/httpd.event, /usr/bin/htcacheclean,
/usr/bin/httpd-worker, /usr/bin/httpd-prefork, /usr/bin/mongrel_rails
π PROCESS TYPES π
SELinux defines process types (domains) for each process running on the system.
You can see the context of a process using the -Z option to ps.
Policy governs the access confined processes have to files. SELinux httpd policy is very flexible, allowing users to set up their httpd processes in as secure a method as possible.
The following process types are defined for httpd:
httpd_t, httpd_helper_t, httpd_php_t, httpd_rotatelogs_t, httpd_suexec_t, httpd_sys_script_t, httpd_user_script_t, httpd_passwd_t, httpd_unconfined_script_t
Note:semanage permissive -a httpd_tcan be used to make the process typehttpd_tpermissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated.
π BOOLEANS π
SELinux policy is customizable based on least access required. The httpd policy is extremely flexible and has several booleans that allow you to manipulate the policy and run httpd with the tightest access possible.
httpd_builtin_scriptingβ if you want to allow httpd to use built in scripting (usually php), you must turn this on. Enabled by default.setsebool -P httpd_builtin_scripting 1httpd_can_check_spamβ if you want to allow http daemon to check spam, you must turn this on. Disabled by default.setsebool -P httpd_can_check_spam 1httpd_can_connect_ftpβ if you want to allow httpd to act as a FTP client connecting to the ftp port and ephemeral ports, you must turn this on. Disabled by default.setsebool -P httpd_can_connect_ftp 1httpd_can_connect_ldapβ if you want to allow httpd to connect to the ldap port, you must turn this on. Disabled by default.setsebool -P httpd_can_connect_ldap 1httpd_can_connect_mythtvβ if you want to allow http daemon to connect to mythtv, you must turn this on. Disabled by default.setsebool -P httpd_can_connect_mythtv 1httpd_can_connect_zabbixβ if you want to allow http daemon to connect to zabbix, you must turn this on. Disabled by default.setsebool -P httpd_can_connect_zabbix 1httpd_can_network_connectβ if you want to allow HTTPD scripts and modules to connect to the network using TCP, you must turn this on. Disabled by default.setsebool -P httpd_can_network_connect 1httpd_can_network_connect_cobblerβ if you want to allow HTTPD scripts and modules to connect to cobbler over the network, you must turn this on. Disabled by default.setsebool -P httpd_can_network_connect_cobbler 1httpd_can_network_connect_dbβ if you want to allow HTTPD scripts and modules to connect to databases over the network, you must turn this on. Disabled by default.setsebool -P httpd_can_network_connect_db 1httpd_can_network_memcacheβ if you want to allow httpd to connect to memcache server, you must turn this on. Disabled by default.setsebool -P httpd_can_network_memcache 1httpd_can_network_redisβ if you want to allow httpd to connect to redis, you must turn this on. Disabled by default.setsebool -P httpd_can_network_redis 1httpd_can_network_relayβ if you want to allow httpd to act as a relay, you must turn this on. Disabled by default.setsebool -P httpd_can_network_relay 1httpd_can_sendmailβ if you want to allow http daemon to send mail, you must turn this on. Disabled by default.setsebool -P httpd_can_sendmail 1httpd_dbus_avahiβ if you want to allow Apache to communicate with avahi service via dbus, you must turn this on. Enabled by default.setsebool -P httpd_dbus_avahi 1httpd_dbus_sssdβ if you want to allow Apache to communicate with sssd service via dbus, you must turn this on. Disabled by default.setsebool -P httpd_dbus_sssd 1httpd_dontaudit_search_dirsβ if you want to dontaudit Apache to search dirs, you must turn this on. Disabled by default.setsebool -P httpd_dontaudit_search_dirs 1httpd_enable_cgiβ if you want to allow httpd cgi support, you must turn this on. Enabled by default.setsebool -P httpd_enable_cgi 1httpd_enable_ftp_serverβ if you want to allow httpd to act as a FTP server by listening on the ftp port, you must turn this on. Disabled by default.setsebool -P httpd_enable_ftp_server 1httpd_enable_homedirsβ if you want to allow httpd to read home directories, you must turn this on. Disabled by default.setsebool -P httpd_enable_homedirs 1httpd_execmemβ if you want to allow httpd scripts and modules execmem/execstack, you must turn this on. Disabled by default.setsebool -P httpd_execmem 1httpd_graceful_shutdownβ if you want to allow HTTPD to connect to port 80 for graceful shutdown, you must turn this on. Disabled by default.setsebool -P httpd_graceful_shutdown 1httpd_manage_ipaβ if you want to allow httpd processes to manage IPA content, you must turn this on. Disabled by default.setsebool -P httpd_manage_ipa 1httpd_mod_auth_ntlm_winbindβ if you want to allow Apache to use mod_auth_ntlm_winbind, you must turn this on. Disabled by default.setsebool -P httpd_mod_auth_ntlm_winbind 1httpd_mod_auth_pamβ if you want to allow Apache to use mod_auth_pam, you must turn this on. Disabled by default.setsebool -P httpd_mod_auth_pam 1httpd_read_user_contentβ if you want to allow httpd to read user content, you must turn this on. Disabled by default.setsebool -P httpd_read_user_content 1httpd_run_preupgradeβ if you want to allow Apache to run preupgrade, you must turn this on. Disabled by default.setsebool -P httpd_run_preupgrade 1httpd_run_stickshiftβ if you want to allow Apache to run in stickshift mode, not transition to passenger, you must turn this on. Disabled by default.setsebool -P httpd_run_stickshift 1httpd_serve_cobbler_filesβ if you want to allow HTTPD scripts and modules to server cobbler files, you must turn this on. Disabled by default.setsebool -P httpd_serve_cobbler_files 1httpd_setrlimitβ if you want to allow httpd daemon to change its resource limits, you must turn this on. Disabled by default.setsebool -P httpd_setrlimit 1httpd_ssi_execβ if you want to allow HTTPD to run SSI executables in the same domain as system CGI scripts, you must turn this on. Disabled by default.setsebool -P httpd_ssi_exec 1httpd_tmp_execβ if you want to allow Apache to execute tmp content, you must turn this on. Disabled by default.setsebool -P httpd_tmp_exec 1httpd_tty_commβ if you want to unify HTTPD to communicate with the terminal. Needed for entering the passphrase for certificates at the terminal, you must turn this on. Disabled by default.setsebool -P httpd_tty_comm 1httpd_unifiedβ if you want to unify HTTPD handling of all content files, you must turn this on. Disabled by default.setsebool -P httpd_unified 1httpd_use_cifsβ if you want to allow httpd to access cifs file systems, you must turn this on. Disabled by default.setsebool -P httpd_use_cifs 1httpd_use_fusefsβ if you want to allow httpd to access FUSE file systems, you must turn this on. Disabled by default.setsebool -P httpd_use_fusefs 1httpd_use_gpgβ if you want to allow httpd to run gpg, you must turn this on. Disabled by default.setsebool -P httpd_use_gpg 1httpd_use_nfsβ if you want to allow httpd to access nfs file systems, you must turn this on. Disabled by default.setsebool -P httpd_use_nfs 1httpd_use_opencryptokiβ if you want to allow httpd to use opencryptoki, you must turn this on. Disabled by default.setsebool -P httpd_use_opencryptoki 1httpd_use_openstackβ if you want to allow httpd to access openstack ports, you must turn this on. Disabled by default.setsebool -P httpd_use_openstack 1httpd_use_saslβ if you want to allow httpd to connect to sasl, you must turn this on. Disabled by default.setsebool -P httpd_use_sasl 1httpd_verify_dnsβ if you want to allow Apache to query NS records, you must turn this on. Disabled by default.setsebool -P httpd_verify_dns 1daemons_dontaudit_schedulingβ if you want to dontaudit all daemons scheduling requests (setsched, sys_nice), you must turn this on. Enabled by default.setsebool -P daemons_dontaudit_scheduling 1deny_ptraceβ if you want to deny any process from ptracing or debugging any other processes, you must turn this on. Disabled by default.setsebool -P deny_ptrace 1fips_modeβ if you want to allow all domains to execute in fips_mode, you must turn this on. Enabled by default.setsebool -P fips_mode 1git_system_use_cifsβ if you want to determine whether Git system daemon can access cifs file systems, you must turn this on. Disabled by default.setsebool -P git_system_use_cifs 1git_system_use_nfsβ if you want to determine whether Git system daemon can access nfs file systems, you must turn this on. Disabled by default.setsebool -P git_system_use_nfs 1kerberos_enabledβ if you want to allow confined applications to run with kerberos, you must turn this on. Enabled by default.setsebool -P kerberos_enabled 1nis_enabledβ if you want to allow system to run with NIS, you must turn this on. Disabled by default.setsebool -P nis_enabled 1use_nfs_home_dirsβ if you want to support NFS home directories, you must turn this on. Enabled by default.setsebool -P use_nfs_home_dirs 1use_samba_home_dirsβ if you want to support SAMBA home directories, you must turn this on. Disabled by default.setsebool -P use_samba_home_dirs 1
β¨ NSSWITCH DOMAIN β¨
okay so listen π β if you want your httpd_t peeps to resolve user passwd entries directly from ldap instead of going through a sssd server, you gotta flip on the authlogin_nsswitch_use_ldap boolean. no cap.
setsebool -P authlogin_nsswitch_use_ldap 1
and if you want confined apps to run with kerberos for httpd_t? that's the kerberos_enabled boolean, bestie:
setsebool -P kerberos_enabled 1
π₯ PORT TYPES π₯
so SELinux defines port types to represent TCP and UDP ports, periodt. you can peek at the types chillin' with a port by running:
semanage port -l
policy governs the access confined processes have to these ports, and ngl SELinux httpd policy is very flexible β it lets users set up their httpd processes in as secure a method as possible. iconic behavior honestly π
the following port types are defined for httpd:
http_cache_port_t
Default Defined Ports:
tcp 8080,8118,8123,10001-10010
udp 3130
http_port_t
Default Defined Ports:
tcp 80,81,443,488,8008,8009,8443,9000
udp 80,443
π MANAGED FILES π
so the SELinux process type httpd_t can manage files labeled with the following file types. the paths listed are the default paths for these file types. heads up though β the processes UID still need to have DAC permissions, so don't come for me if it's not working π
abrt_retrace_spool_t
/var/spool/faf(/.*)?
/var/spool/abrt-retrace(/.*)?
/var/spool/retrace-server(/.*)?
cifs_t
cluster_conf_t
/etc/cluster(/.*)?
cluster_var_lib_t
/var/lib/pcsd(/.*)?
/var/lib/cluster(/.*)?
/var/lib/openais(/.*)?
/var/lib/pengine(/.*)?
/var/lib/corosync(/.*)?
/usr/lib/heartbeat(/.*)?
/var/lib/heartbeat(/.*)?
/var/lib/pacemaker(/.*)?
cluster_var_run_t
/run/crm(/.*)?
/run/cman_.*
/run/rsctmp(/.*)?
/run/aisexec.*
/run/heartbeat(/.*)?
/run/pcsd-ruby.socket
/run/corosync-qnetd(/.*)?
/run/corosync-qdevice(/.*)?
/run/pcsd.socket
/run/corosync.pid
/run/cpglockd.pid
/run/rgmanager.pid
/run/cluster/rgmanager.sk
cobbler_var_lib_t
/var/lib/cobbler(/.*)?
/var/www/cobbler(/.*)?
/var/cache/cobbler(/.*)?
/var/lib/tftpboot/etc(/.*)?
/var/lib/tftpboot/ppc(/.*)?
/var/lib/tftpboot/boot(/.*)?
/var/lib/tftpboot/grub(/.*)?
/var/lib/tftpboot/s390x(/.*)?
/var/lib/tftpboot/images(/.*)?
/var/lib/tftpboot/aarch64(/.*)?
/var/lib/tftpboot/images2(/.*)?
/var/lib/tftpboot/pxelinux.cfg(/.*)?
/var/lib/tftpboot/yaboot
/var/lib/tftpboot/memdisk
/var/lib/tftpboot/menu.c32
/var/lib/tftpboot/pxelinux.0
fusefs_t
/run/user/[0-9]+/gvfs
httpd_cache_t
/var/cache/rt(3|4)(/.*)?
/var/cache/ssl.*.sem
/var/cache/mod_.*
/var/cache/php-.*
/var/cache/httpd(/.*)?
/var/cache/mason(/.*)?
/var/cache/nginx(/.*)?
/var/cache/mod_ssl(/.*)?
/var/cache/lighttpd(/.*)?
/var/cache/mediawiki(/.*)?
/var/cache/mod_proxy(/.*)?
/var/cache/mod_gnutls(/.*)?
/var/cache/php-mmcache(/.*)?
/var/cache/php-eaccelerator(/.*)?
httpd_lock_t
httpd_squirrelmail_t
/var/lib/squirrelmail/prefs(/.*)?
httpd_tmp_t
/run/user/apache(/.*)?
/var/www/openshift/console/tmp(/.*)?
httpd_tmpfs_t
httpd_user_rw_content_t
httpd_var_lib_t
/var/lib/rt(3|4)/data/RT-Shredder(/.*)?
/var/lib/dav(/.*)?
/var/lib/php[0-9]*(/.*)?
/var/lib/glpi(/.*)?
/var/lib/httpd(/.*)?
/var/lib/nginx(/.*)?
/var/lib/z-push(/.*)?
/var/lib/ganglia(/.*)?
/var/lib/ipsilon(/.*)?
/var/lib/cherokee(/.*)?
/var/lib/lighttpd(/.*)?
/var/lib/mod_security(/.*)?
/var/lib/roundcubemail(/.*)?
/var/opt/rh/rh-nginx18/lib/nginx(/.*)?
httpd_var_run_t
/run/mod_.*
/run/wsgi.*
/run/httpd.*
/run/nginx.*
/run/apache.*
/run/php-fpm(/.*)?
/run/fcgiwrap(/.*)?
/run/lighttpd(/.*)?
/var/lib/php/session(/.*)?
/run/dirsrv/admin-serv.*
/var/lib/php/wsdlcache(/.*)?
/var/opt/rh/rh-nginx18/run/nginx(/.*)?
/var/www/openshift/broker/httpd/run(/.*)?
/var/www/openshift/console/httpd/run(/.*)?
/opt/dirsrv/var/run/dirsrv/dsgw/cookies(/.*)?
/run/thttpd.pid
/run/gcache_port
/run/cherokee.pid
httpdcontent
hugetlbfs_t
/dev/hugepages
/usr/lib/udev/devices/hugepages
jetty_cache_t
/var/cache/jetty(/.*)?
jetty_log_t
/var/log/jetty(/.*)?
jetty_tmp_t
jetty_unit_file_t
/usr/lib/systemd/system/jetty.service
jetty_var_lib_t
/var/lib/jetty(/.*)?
jetty_var_run_t
/run/jetty(/.*)?
krb5_host_rcache_t
/var/tmp/krb5_0.rcache2
/var/cache/krb5rcache(/.*)?
/var/tmp/nfs_0
/var/tmp/DNS_25
/var/tmp/host_0
/var/tmp/imap_0
/var/tmp/HTTP_23
/var/tmp/HTTP_48
/var/tmp/ldap_55
/var/tmp/ldap_487
/var/tmp/ldapmap1_0
memcached_var_run_t
/run/memcached(/.*)?
/run/ipa_memcached(/.*)?
named_cache_t
/var/lib/softhsm(/.*)?
/var/lib/unbound(/.*)?
/var/lib/named/data(/.*)?
/var/lib/named/slaves(/.*)?
/var/lib/named/dynamic(/.*)?
/var/lib/named/chroot/var/tmp(/.*)?
/var/lib/named/chroot/var/named/data(/.*)?
/var/lib/named/chroot/var/named/slaves(/.*)?
/var/lib/named/chroot/var/named/dynamic(/.*)?
nfs_t
passenger_tmp_t
passenger_var_lib_t
/var/lib/passenger(/.*)?
passenger_var_run_t
/run/passenger(/.*)?
pkcs_slotd_lock_t
/run/lock/opencryptoki(/.*)?
pkcs_slotd_tmpfs_t
/dev/shm/var.lib.opencryptoki.*
pkcs_slotd_var_lib_t
/var/lib/opencryptoki(/.*)?
pki_apache_config
pki_apache_var_lib
pki_apache_var_log
postfix_spool_t
/var/spool/postfix.*
/var/spool/postfix/defer(/.*)?
/var/spool/postfix/flush(/.*)?
/var/spool/postfix/deferred(/.*)?
/var/spool/postfix/maildrop(/.*)?
preupgrade_data_t
/var/lib/preupgrade(/.*)?
/var/log/preupgrade(/.*)?
root_t
/sysroot/.aleph-version.json
/sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
/
/initrd
/var/lib/ntp
security_t
/selinux
squirrelmail_spool_t
/var/spool/squirrelmail(/.*)?
systemd_passwd_var_run_t
/run/systemd/ask-password(/.*)?
/run/systemd/ask-password-block(/.*)?
zarafa_var_lib_t
/var/lib/zarafa(/.*)?
/var/lib/zarafa-webapp(/.*)?
/var/lib/zarafa-webaccess(/.*)?
zoneminder_var_lib_t
/var/lib/zoneminder(/.*)?
πΈ FILE CONTEXTS πΈ
SELinux requires files to have an extended attribute to define the file type. yes, literally every file needs a lil label π·οΈ
you can see the context of a file using the -Z option to ls
policy governs the access confined processes have to these files, and SELinux httpd policy is very flexible allowing users to setup their httpd processes in as secure a method as possible. we love a flexible icon π
π¦ EQUIVALENCE DIRECTORIES π¦
httpd policy stores data with multiple different file context types under the /var/lib/httpd directory. if you'd like to store the data in a different directory you can use the semanage command to create an equivalence mapping. if you wanted to store this data under the /srv directory you'd execute the following command:
semanage fcontext -a -e /var/lib/httpd /srv/httpd
restorecon -R -v /srv/httpd
httpd policy stores data with multiple different file context types under the /var/log/php-fpm directory. want it in a different directory? same deal, use semanage to create an equivalence mapping. if you wanted to store this data under the /srv directory you'd run:
semanage fcontext -a -e /var/log/php-fpm /srv/php-fpm
restorecon -R -v /srv/php-fpm
httpd policy stores data with multiple different file context types under the /var/www directory. relocating again? you already know β semanage + equivalence mapping. storing under /srv looks like:
semanage fcontext -a -e /var/www /srv/www
restorecon -R -v /srv/www
β STANDARD FILE CONTEXT β
SELinux defines the file context types for the httpd, so if you wanted to store files with these types in different paths, you need to execute the semanage command to specify alternate labeling and then use restorecon to put the labels on disk. like so:
semanage fcontext -a -t httpd_exec_t '/srv/httpd/content(/.*)?'
restorecon -R -v /srv/myhttpd_content
Note: SELinux often uses regular expressions to specify labels that match multiple files. π§
the following file types are defined for httpd:
httpd_cache_t
- Set files with the
httpd_cache_ttype, if you want to store the files under the/var/cachedirectory.
Paths:
/var/cache/rt(3|4)(/.*)?, /var/cache/ssl.*.sem, /var/cache/mod_.*,
/var/cache/php-.*, /var/cache/httpd(/.*)?, /var/cache/mason(/.*)?,
/var/cache/nginx(/.*)?, /var/cache/mod_ssl(/.*)?,
/var/cache/lighttpd(/.*)?, /var/cache/mediawiki(/.*)?,
/var/cache/mod_proxy(/.*)?, /var/cache/mod_gnutls(/.*)?,
/var/cache/php-mmcache(/.*)?, /var/cache/php-eaccelerator(/.*)?
httpd_config_t
- Set files with the
httpd_config_ttype, if you want to treat the files as httpd configuration data, usually stored under the/etcdirectory.
Paths:
/etc/httpd(/.*)?, /etc/nginx(/.*)?, /etc/apache(2)?(/.*)?,
/etc/cherokee(/.*)?, /etc/lighttpd(/.*)?, /etc/apache-ssl(2)?(/.*)?,
/var/lib/openshift/.httpd.d(/.*)?, /etc/opt/rh/rh-nginx18/nginx(/.*)?,
/var/lib/stickshift/.httpd.d(/.*)?, /etc/vhosts, /etc/thttpd.conf
httpd_exec_t
- Set files with the
httpd_exec_ttype, if you want to transition an executable to thehttpd_tdomain.
Paths:
/usr/bin/httpd(.worker)?, /usr/bin/apache(2)?, /usr/bin/httpd2-.*,
/usr/bin/apache-ssl(2)?, /usr/lib/apache-ssl/.+, /usr/bin/nginx,
/usr/bin/thttpd, /usr/bin/php-fpm, /usr/bin/cherokee,
/usr/bin/lighttpd, /usr/bin/apachectl, /usr/bin/httpd.event,
/usr/bin/htcacheclean, /usr/bin/httpd-worker, /usr/bin/httpd-prefork,
/usr/bin/mongrel_rails
httpd_helper_exec_t
httpd_helper_exec_t
- slap this type on files with the
httpd_helper_exec_ttype if you want to transition an executable to thehttpd_helper_tdomain. β¨
httpd_initrc_exec_t
- set files with the
httpd_initrc_exec_ttype if you want to transition an executable to thehttpd_initrc_tdomain β init script vibes fr.
Paths:
/etc/init.d/cherokee, /etc/rc.d/init.d/httpd,
/usr/bin/start_apache2, /etc/rc.d/init.d/lighttpd
httpd_keytab_t
- set files with the
httpd_keytab_ttype if you want to treat the files as kerberos keytab files. π
httpd_lock_t
- set files with the
httpd_lock_ttype if you want to treat the files as httpd lock data, stored under the/var/lockdirectory.
httpd_log_t
- set files with the
httpd_log_ttype if you want to treat the data as httpd log data, usually stored under the/var/logdirectory. the way this list is LONG β iconic honestly π
Paths:
/srv/([^/]*/)?www/logs(/.*)?, /var/www(/.*)?/logs(/.*)?,
/var/log/glpi(/.*)?, /var/log/cacti(/.*)?, /var/log/httpd(/.*)?,
/var/log/nginx(/.*)?, /var/log/apache(2)?(/.*)?, /var/log/php-fpm.log,
/var/log/horizon(/.*)?, /var/log/php-fpm(/.*)?,
/var/log/cherokee(/.*)?, /var/log/lighttpd(/.*)?,
/var/log/suphp.log.*, /var/log/thttpd.log.*, /var/log/apache-ssl(2)?(/.*)?,
/var/log/cgiwrap.log.*,
/var/www/stickshift/[^/]*/log(/.*)?, /var/log/graphite-web(/.*)?,
/var/www/miq/vmdb/log(/.*)?, /var/log/roundcubemail(/.*)?,
/var/log/php_errors.log.*, /var/log/dirsrv/admin-serv(/.*)?,
/var/opt/rh/rh-nginx18/log(/.*)?,
/var/lib/openshift/.log/httpd(/.*)?,
/var/www/openshift/console/log(/.*)?,
/var/www/openshift/broker/httpd/logs(/.*)?,
/var/www/openshift/console/httpd/logs(/.*)?
httpd_modules_t
- set files with the
httpd_modules_ttype if you want to treat the files as httpd modules. π₯
Paths:
/usr/lib/httpd(/.*)?, /usr/lib/apache(/.*)?,
/usr/lib/cherokee(/.*)?, /usr/lib/lighttpd(/.*)?,
/usr/lib/apache2/modules(/.*)?
httpd_passwd_exec_t
- set files with the
httpd_passwd_exec_ttype if you want to transition an executable to thehttpd_passwd_tdomain.
httpd_php_exec_t
- set files with the
httpd_php_exec_ttype if you want to transition an executable to thehttpd_php_tdomain. π
httpd_php_tmp_t
- set files with the
httpd_php_tmp_ttype if you want to store httpd php temporary files in the/tmpdirectories.
httpd_rotatelogs_exec_t
- set files with the
httpd_rotatelogs_exec_ttype if you want to transition an executable to thehttpd_rotatelogs_tdomain.
httpd_squirrelmail_t
- set files with the
httpd_squirrelmail_ttype if you want to treat the files as httpd squirrelmail data. πΏοΈ
httpd_suexec_exec_t
- set files with the
httpd_suexec_exec_ttype if you want to transition an executable to thehttpd_suexec_tdomain.
Paths:
/usr/lib/apache(2)?/suexec(2)?, /usr/lib/cgi-bin/(nph-)?cgiwrap(d)?, /usr/bin/suexec
httpd_suexec_tmp_t
- set files with the
httpd_suexec_tmp_ttype if you want to store httpd suexec temporary files in the/tmpdirectories.
httpd_sys_content_t
- set files with the
httpd_sys_content_ttype if you want to treat the files as httpd sys content. this is like, the classic one bestie π
Paths:
/srv/([^/]*/)?www(/.*)?, /var/www(/.*)?, /etc/htdig(/.*)?,
/srv/gallery2(/.*)?, /var/lib/trac(/.*)?, /var/lib/htdig(/.*)?,
/var/www/icons(/.*)?, /usr/share/glpi(/.*)?,
/usr/share/htdig(/.*)?, /usr/share/drupal.*, /usr/share/z-push(/.*)?,
/var/www/svn/conf(/.*)?, /usr/share/icecast(/.*)?,
/var/lib/cacti/rra(/.*)?, /usr/share/ntop/html(/.*)?,
/usr/share/nginx/html(/.*)?, /usr/share/doc/ghc/html(/.*)?,
/usr/share/openca/htdocs(/.*)?, /usr/share/selinux-policy[^/]*/html(/.*)?
httpd_sys_htaccess_t
- set files with the
httpd_sys_htaccess_ttype if you want to treat the file as a httpd sys access file.
httpd_sys_ra_content_t
- set files with the
httpd_sys_ra_content_ttype if you want to treat the files as httpd sys read/append content.
httpd_sys_rw_content_t
- set files with the
httpd_sys_rw_content_ttype if you want to treat the files as httpd sys read/write content. the read/write girlies, we love you π«Ά
Paths:
/etc/rt(/.*)?, /etc/glpi(/.*)?, /etc/horde(/.*)?, /etc/drupal.*,
/etc/z-push(/.*)?, /var/lib/svn(/.*)?, /var/www/svn(/.*)?,
/etc/owncloud(/.*)?, /var/www/html(/.*)?/uploads(/.*)?,
/var/www/html(/.*)?/wp-content(/.*)?,
/var/www/html(/.*)?/wp_backups(/.*)?,
/var/www/html(/.*)?/sites/default/files(/.*)?,
/var/www/html(/.*)?/sites/default/settings.php,
/etc/mock/koji(/.*)?, /etc/nextcloud(/.*)?, /var/lib/drupal.*,
/etc/zabbix/web(/.*)?, /var/lib/moodle(/.*)?, /var/log/z-push(/.*)?,
/var/spool/gosa(/.*)?, /etc/WebCalendar(/.*)?,
/usr/share/joomla(/.*)?, /var/lib/dokuwiki(/.*)?,
/var/lib/httpd/md(/.*)?, /var/lib/owncloud(/.*)?,
/var/spool/viewvc(/.*)?, /var/lib/nextcloud(/.*)?,
/var/lib/pootle/po(/.*)?, /var/lib/phpMyAdmin(/.*)?,
/var/www/moodledata(/.*)?, /srv/gallery2/smarty(/.*)?,
/var/www/moodle/data(/.*)?, /var/lib/graphite-web(/.*)?,
/var/log/shibboleth-www(/.*)?, /var/www/gallery/albums(/.*)?,
/var/www/html/owncloud/data(/.*)?,
/var/www/html/nextcloud/apps(/.*)?,
/var/www/html/nextcloud/data(/.*)?,
/var/www/html/nextcloud/config(/.*)?, /usr/share/wordpress-mu/wp-content(/.*)?,
/usr/share/wordpress/wp-content/upgrade(/.*)?,
/usr/share/wordpress/wp-content/uploads(/.*)?,
/var/www/html/configuration.php
httpd_sys_script_exec_t
- set files with the
httpd_sys_script_exec_ttype if you want to transition an executable to thehttpd_sys_script_tdomain.
Paths:
/opt/.*.cgi, /usr/.*.cgi, /var/www/[^/]*/cgi-bin(/.*)?,
/var/www/perl(/.*)?, /var/www/html/[^/]*/cgi-bin(/.*)?,
/usr/lib/cgi-bin(/.*)?, /var/www/cgi-bin(/.*)?,
/var/www/svn/hooks(/.*)?, /usr/share/wordpress/.*.php,
/usr/local/nagios/sbin(/.*)?, /usr/share/wordpress/wp-includes/.*.php,
/usr/share/wordpress-mu/wp-config.php
httpd_tmp_t
- set files with the
httpd_tmp_ttype if you want to store httpd temporary files in the/tmpdirectories.
Paths:
/run/user/apache(/.*)?, /var/www/openshift/console/tmp(/.*)?
httpd_tmpfs_t
- set files with the
httpd_tmpfs_ttype if you want to store httpd files on a tmpfs file system. π§
httpd_unconfined_script_exec_t
- set files with the
httpd_unconfined_script_exec_ttype if you want to transition an executable to thehttpd_unconfined_script_tdomain. unconfined? main character energy ngl π
httpd_unit_file_t
- set files with the
httpd_unit_file_ttype if you want to treat the files as httpd unit content.
Paths:
/usr/lib/systemd/system/httpd.*, /usr/lib/systemd/system/nginx.*,
/usr/lib/systemd/system/thttpd.*, /usr/lib/systemd/system/php-fpm.*
httpd_user_content_t
- set files with the
httpd_user_content_ttype if you want to treat the files as httpd user content.
httpd_user_htaccess_t
- set files with the
httpd_user_htaccess_ttype if you want to treat the file as a httpd user access file.
httpd_user_ra_content_t
- set files with the
httpd_user_ra_content_ttype if you want to treat the files as httpd user read/append content.
httpd_user_rw_content_t
- set files with the
httpd_user_rw_content_ttype if you want to treat the files as httpd user read/write content.
httpd_user_script_exec_t
- set files with the
httpd_user_script_exec_ttype if you want to transition an executable to thehttpd_user_script_tdomain.
httpd_var_lib_t
- set files with the
httpd_var_lib_ttype if you want to store the httpd files under the/var/libdirectory. β¨
Paths:
/var/lib/rt(3|4)/data/RT-Shredder(/.*)?, /var/lib/dav(/.*)?,
/var/lib/php[0-9]*(/.*)?, /var/lib/glpi(/.*)?,
/var/lib/httpd(/.*)?, /var/lib/nginx(/.*)?, /var/lib/z-push(/.*)?,
/var/lib/ganglia(/.*)?, /var/lib/ipsilon(/.*)?,
/var/lib/cherokee(/.*)?, /var/lib/lighttpd(/.*)?,
/var/lib/mod_security(/.*)?, /var/lib/roundcubemail(/.*)?,
/var/opt/rh/rh-nginx18/lib/nginx(/.*)?
httpd_var_run_t
- set files with the
httpd_var_run_ttype if you want to store the httpd files under the/runor/var/rundirectory.
Paths:
/run/mod_.*, /run/wsgi.*, /run/httpd.*, /run/nginx.*,
/run/apache.*, /run/php-fpm(/.*)?, /run/fcgiwrap(/.*)?,
/run/lighttpd(/.*)?, /var/lib/php/session(/.*)?, /run/dirsrv/admin-serv.*,
/var/lib/php/wsdlcache(/.*)?, /var/opt/rh/rh-nginx18/run/nginx(/.*)?,
/var/www/openshift/broker/httpd/run(/.*)?,
/var/www/openshift/console/httpd/run(/.*)?,
/opt/dirsrv/var/run/dirsrv/dsgw/cookies(/.*)?, /run/thttpd.pid,
/run/gcache_port, /run/cherokee.pid
Note: file context can be temporarily modified with thechconcommand. If you want to permanently change the file context you need to use thesemanage fcontextcommand. This will modify the SELinux labeling database. You will need to userestoreconto apply the labels. no cap βchconis the temporary girlie,semanage fcontextis the forever one π
π SHARING FILES π
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and public_content_rw_t. These context allow any of the above domains to read the content. If you want a particular domain to write to the public_content_rw_t domain, you must set the appropriate boolean. π«Ά
Allow httpd servers to read the /var/httpd directory by adding the public_content_t file type to the directory and by restoring the file type.
semanage fcontext -a -t public_content_t "/var/httpd(/.*)?"
restorecon -F -R -v /var/httpd
Allow httpd servers to read and write /var/httpd/incoming by adding the public_content_rw_t type to the directory and by restoring the file type. You also need to turn on the httpd_anon_write boolean.
semanage fcontext -a -t public_content_rw_t "/var/httpd/incoming(/.*)?"
restorecon -F -R -v /var/httpd/incoming
setsebool -P httpd_anon_write 1
If you want to allow Apache to modify public files used for public file transfer services. Directories/Files must be labeled public_content_rw_t., you must turn on the httpd_anon_write boolean.
setsebool -P httpd_anon_write 1
π οΈ COMMANDS π οΈ
semanage fcontext can also be used to manipulate default file context mappings.
semanage permissive can also be used to manipulate whether or not a process type is permissive.
semanage module can also be used to enable/disable/install/remove policy modules.
semanage port can also be used to manipulate the port definitions
semanage boolean can also be used to manipulate the booleans
system-config-selinux is a GUI tool available to customize SELinux policy settings. point and click era π±οΈβ¨
π AUTHOR π
This manual page was auto-generated using sepolicy manpage .
πΈ SEE ALSO πΈ
okay bestie, you made it to the link hub π
these are the manual pages that live in the same orbit β go man around and enjoy the lore:
selinux(8)β the big-picture SELinux page, your next stop π¦httpd(8)β the main character herself, Apache httpd πsemanage(8)β the policy-management girlie β¨restorecon(8)β for putting file contexts back where they belong πchcon(1)β the quick-change file-context icon πsepolicy(8)β policy tooling, very demure, very mindful πΈsetsebool(8)β flip those booleans, no cap π₯httpd_helper_selinux(8)β helper-domain lore π«Άhttpd_passwd_selinux(8)β password-related httpd SELinux vibes πhttpd_php_selinux(8)β PHP + httpd SELinux, iykyk πhttpd_rotatelogs_selinux(8)β rotatelogs SELinux moment πhttpd_suexec_selinux(8)β suexec SELinux behavior, periodt π«httpd_sys_script_selinux(8)β system-script SELinux energy βοΈhttpd_unconfined_script_selinux(8)β unconfined-script SELinux, lowkey wild πhttpd_user_script_selinux(8)β user-script SELinux, the final link in the chain π§
and thatβs a wrap, bestie π«Ά this page is httpd_selinux(8), from the httpd set, dated 26-10-06 β you literally ate that whole manual up πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: selinux-policy-doc 20250627+git412.dbf877ab7-160000.1.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms