FC4/Apache/一般ユーザのウェブ表示
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
#contents
----
* 一般ユーザのウェブ表示 [#zcd47f9b]
** Apache の設定 [#oaa2c4b2]
一般ユーザのウェブを公開するには Apache の設定ファイル...
httpd.conf の 340 行目前後を書き換えます。
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confir...
# of a username on the system (depending on home dir...
# permissions).
#
UserDir disable
#
# To enable requests to /~user/ to serve the user's ...
# directory, remove the "UserDir disable" line above...
# the following line instead:
#
#UserDir public_html
</IfModule>
【 UserDir disable 】と初期状態では一般ユーザのウェブ表...
許可するためには disable の行をコメントし、【 UserDir p...
変更後)
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confir...
# of a username on the system (depending on home dir...
# permissions).
#
#UserDir disable
#
# To enable requests to /~user/ to serve the user's ...
# directory, remove the "UserDir disable" line above...
# the following line instead:
#
UserDir public_html
</IfModule>
また、この状態ではウェブの公開ができても CGI や SSI の...
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews -Indexes SymLinksIfOwnerMatch Inc...
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
httpd.conf の編集が終わったら Apache の再起動を実行し、...
# /sbin/service httpd restart
httpd を停止中: ...
httpd を起動中: ...
** ディレクトリの確認 [#d2b07bcb]
次にユーザディレクトリのパーミッションを確認します。&br;
ユーザが追加された時点でのホームディレクトリのパーミッ...
# chmod o+x /home/アカウント名
こちらのコマンドを実行して、「その他」のユーザ権限に対...
次に公開用ディレクトリを作成します。
$ mkdir public_html
$ echo test > public_html/test.html
あとはブラウザから http://192.168.11.253/~アカウント名/...
** SELinux 導入時の注意点 [#ccc3aaf7]
もし SELinux が有効になっている場合は【 Forbidden 】と...
Apache のエラーログにも以下のような記録が残ります。
[Sun Jun 19 21:05:42 2005] [error] [client 192.168.11.10...
原因は SELinux の【 タイプ遷移 】によるセキュリティーポ...
$ ls -lZ
こちらのコマンドを実行すると、ディレクトリ内のセキュリ...
$ ls -alZ /home/akane/
drwxr-xr-x akane users root:object_r:user_home_di...
drwxr-xr-x root root system_u:object_r:home_roo...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
public_html には user_u:object_r:user_home_t というセキ...
# /sbin/ausearch -m AVC
こちらのコマンドを実行して SELinux のログを見ると、実行...
time->Sun Jun 19 21:05:42 2005
type=AVC msg=audit(1119182742.782:6278950): avc: denied...
pid=6090 comm="httpd" name=public_html dev=dm-1 ino=562...
scontext=root:system_r:httpd_t tcontext=user_u:object_r:...
type=SYSCALL msg=audit(1119182742.782:6278950): arch=400...
success=no exit=-13 a0=95e58a0 a1=bfca1564 a2=32cff4 a3=...
pid=6090 auid=4294967295 uid=48 gid=48 euid=48 suid=48 f...
sgid=48 fsgid=48 comm="httpd" exe="/usr/sbin/httpd"
type=AVC_PATH msg=audit(1119182742.782:6278950):
path="/home/akane/public_html"
type=PATH msg=audit(1119182742.782:6278950): item=0
name="/home/akane/public_html" inode=5625101 dev=fd:01 m...
ogid=100 rdev=00:00
Fedora Core 4 では予め /home/ユーザ名/public_html に対...
今回の例では /home/akane/ 以下を適切にラベル割り当てを...
$ /sbin/restorecon -R /home/akane
このようにコマンドを実行します。コマンド実行後、再度 ls...
# ls -alZ /home/akane/
drwxr-xr-x akane users root:object_r:user_home_di...
drwxr-xr-x root root system_u:object_r:home_roo...
-rw------- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:httpd_user...
----
少々面倒ですが、SELinux を有効にして一般ユーザのウェブ...
終了行:
#contents
----
* 一般ユーザのウェブ表示 [#zcd47f9b]
** Apache の設定 [#oaa2c4b2]
一般ユーザのウェブを公開するには Apache の設定ファイル...
httpd.conf の 340 行目前後を書き換えます。
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confir...
# of a username on the system (depending on home dir...
# permissions).
#
UserDir disable
#
# To enable requests to /~user/ to serve the user's ...
# directory, remove the "UserDir disable" line above...
# the following line instead:
#
#UserDir public_html
</IfModule>
【 UserDir disable 】と初期状態では一般ユーザのウェブ表...
許可するためには disable の行をコメントし、【 UserDir p...
変更後)
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confir...
# of a username on the system (depending on home dir...
# permissions).
#
#UserDir disable
#
# To enable requests to /~user/ to serve the user's ...
# directory, remove the "UserDir disable" line above...
# the following line instead:
#
UserDir public_html
</IfModule>
また、この状態ではウェブの公開ができても CGI や SSI の...
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews -Indexes SymLinksIfOwnerMatch Inc...
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
httpd.conf の編集が終わったら Apache の再起動を実行し、...
# /sbin/service httpd restart
httpd を停止中: ...
httpd を起動中: ...
** ディレクトリの確認 [#d2b07bcb]
次にユーザディレクトリのパーミッションを確認します。&br;
ユーザが追加された時点でのホームディレクトリのパーミッ...
# chmod o+x /home/アカウント名
こちらのコマンドを実行して、「その他」のユーザ権限に対...
次に公開用ディレクトリを作成します。
$ mkdir public_html
$ echo test > public_html/test.html
あとはブラウザから http://192.168.11.253/~アカウント名/...
** SELinux 導入時の注意点 [#ccc3aaf7]
もし SELinux が有効になっている場合は【 Forbidden 】と...
Apache のエラーログにも以下のような記録が残ります。
[Sun Jun 19 21:05:42 2005] [error] [client 192.168.11.10...
原因は SELinux の【 タイプ遷移 】によるセキュリティーポ...
$ ls -lZ
こちらのコマンドを実行すると、ディレクトリ内のセキュリ...
$ ls -alZ /home/akane/
drwxr-xr-x akane users root:object_r:user_home_di...
drwxr-xr-x root root system_u:object_r:home_roo...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
public_html には user_u:object_r:user_home_t というセキ...
# /sbin/ausearch -m AVC
こちらのコマンドを実行して SELinux のログを見ると、実行...
time->Sun Jun 19 21:05:42 2005
type=AVC msg=audit(1119182742.782:6278950): avc: denied...
pid=6090 comm="httpd" name=public_html dev=dm-1 ino=562...
scontext=root:system_r:httpd_t tcontext=user_u:object_r:...
type=SYSCALL msg=audit(1119182742.782:6278950): arch=400...
success=no exit=-13 a0=95e58a0 a1=bfca1564 a2=32cff4 a3=...
pid=6090 auid=4294967295 uid=48 gid=48 euid=48 suid=48 f...
sgid=48 fsgid=48 comm="httpd" exe="/usr/sbin/httpd"
type=AVC_PATH msg=audit(1119182742.782:6278950):
path="/home/akane/public_html"
type=PATH msg=audit(1119182742.782:6278950): item=0
name="/home/akane/public_html" inode=5625101 dev=fd:01 m...
ogid=100 rdev=00:00
Fedora Core 4 では予め /home/ユーザ名/public_html に対...
今回の例では /home/akane/ 以下を適切にラベル割り当てを...
$ /sbin/restorecon -R /home/akane
このようにコマンドを実行します。コマンド実行後、再度 ls...
# ls -alZ /home/akane/
drwxr-xr-x akane users root:object_r:user_home_di...
drwxr-xr-x root root system_u:object_r:home_roo...
-rw------- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:user_home_...
-rw-r--r-- akane users user_u:object_r:user_home_...
drwxr-xr-x akane users user_u:object_r:httpd_user...
----
少々面倒ですが、SELinux を有効にして一般ユーザのウェブ...
ページ名: