SELinux
#セキュリティ #Linux #CentOS #Linuxアクセス制御
semanage login -l
https://linux.die.net/man/8/semanage
code:sh
sestatus
ps -eZ  #実行中のコンテキスト
semanage fcontext -l #定義されているコンテキスト
ls -Z
chcon -t httpd_sys_content_t /var/www
semanage
# context変更
# semanage fcontext -a "/var/www(/.*)?" --seuser system_u -R object_r -t httpd_sys_content_t
#再帰リセット
restorecon -FR
# 確認
matchpathcon -V /var/www # verified. check
semanage fcontext -l | grep /var/www/
code:sh
#avcstat
#seinfo
seinfo -usystem_u -x -all
sesearch
https://linux.die.net/man/1/sesearch
# httpd_tドメインによるパーミッションの検索
sesearch -A --source httpd_t --perm read --class file
# httpd_sys_content_tに対応するドメインを検索
sesearch -t httpd_sys_content_t --allow -d
FTP
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-managing_confined_services-file_transfer_protocol-booleans
参考
SELinuxのセキュリティポリシーを確認する | Think IT(シンクイット)
13.3. ブール値 - Red Hat Customer Portal
ファイル作成時に付与されるSELinuxのセキュリティコンテキスト - めもめも
ディレクトリやファイルの「セキュリティコンテキスト」を表示すると、「httpd_sys_content_t」というキーワードが見えます。(lsに「-Z」オプションを付けるとディレクトリやファイルのセキュリティコンテキストが表示されます。)
Using NGINX and NGINX Plus with SELinux