Skip to content

Instantly share code, notes, and snippets.

@xardit
Created May 25, 2016 21:13
Show Gist options
  • Save xardit/4802ac2b03e28baef92575fc0bfbb290 to your computer and use it in GitHub Desktop.
Save xardit/4802ac2b03e28baef92575fc0bfbb290 to your computer and use it in GitHub Desktop.
selinux stuff with security-contex
#check if is enabled
getenforce
# disable
setenforce 0
#RESET recursive
restorecon -Rv /site/logs
setfacl -Rb /site
# set security-contex copying from another file/dir
chcon -R --reference=/var/www /site
# set for WWW
chcon -Rt httpd_sys_content_t /site/www
# set for logs
chcon -Rt httpd_log_t /site/logs
# set for ssl
chcon -Rt httpd_config_t /site/ssl
# set for conf
chcon -Rt httpd_config_t /etc/nginx/conf*
# CONTEXTS
# www: httpd_sys_content_t
# logs: httpd_log_t
# conf: httpd_config_t
# etc conf: etc_t
# tmp: httpd_sys_content_rw_t
# get boolean values
getsebool -a
# set network
setsebool -P httpd_can_network_connect on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment