Cent 7 - SELinux

Change mode settings in config:

sudo vim /etc/selinux/config

Find errors:

cat /var/log/messages | grep "SELinux is preventing"

Change file and folders contexts aka labels:

chcon -R --reference=/[ REFERENCE ] /[ THING TO BE CHANGED ]
chcon -R -t httpd_tmp_t /var/www/[ ]
chcon -R -u system_u /var/www/kduk/application/config/config.php

Set booleans to take effect immedatiely:

setsebool httpd_can_sendmail 1

Set permanent booleans which take effect only after a (service) restart:

setsebool -P httpd_can_sendmail 1

Set ports:

semanage port -a -t ssh_port_t -p tcp [ ]

Completely reset:

setenforce 0
yum erase selinux-policy selinux-policy-targeted
mv /etc/selinux/targeted /etc/selinux/targeted.backup
yum install selinux-policy selinux-policy-targeted
touch /.autorelabel && reboot