Linux/SELinux.md
... ...
@@ -249,7 +249,7 @@ sub sortInBracket
249 249
```
250 250
251 251
# コンテキスト設定
252
-- /var/www/html, /var/www/cgi-bin 以外にコンテンツを配置する場合、ディレクトリに適切なタイプを設定する必要がある。
252
+- /var/www/html, /var/www/cgi-bin 以外にApacheのコンテンツを配置する場合、ディレクトリに適切なタイプを設定する必要がある。
253 253
- コンテキスト確認
254 254
```
255 255
# ls -lZ
... ...
@@ -267,6 +267,12 @@ sub sortInBracket
267 267
```
268 268
# chcon --no-dereference -t httpd_sys_script_exec_t <シンボリックリンク>
269 269
```
270
+- Apacheで新規ディレクトリや新規ファイルを作成する必要がある場合は、書き込まれるディレクトリに対してパーミッション設定に加えてfcontext設定が必要。<br>その際、パスはフルパスで指定すること。<br>[SELinux コンテキスト: ファイルのラベル付け](https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-working_with_selinux-selinux_contexts_labeling_files#sect-Security-Enhanced_Linux-SELinux_Contexts_Labeling_Files-Persistent_Changes_semanage_fcontext)
271
+ ```
272
+ # chmod 777 /var/www/vh1-html/Service1/store/
273
+ # semanage fcontext -a -t httpd_sys_rw_content_t /var/www/vh1-html/Service1/store/
274
+ # restorecon -vR /var/www/vh1-html/Service1/store/
275
+ ```
270 276
271 277
# バグ
272 278
## ps コマンドが /proc/<pid> にアクセスしようとしてブロックされる