2013年06月05日
最終更新 2013年06月08日
$ /usr/sbin/getenforce Enforcing |
$ cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted |
$ ps -efZ | grep httpd | grep -v grep unconfined_u:system_r:httpd_t:s0 root 5883 1 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5885 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5886 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5887 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5888 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5889 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5890 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5891 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5892 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd unconfined_u:system_r:httpd_t:s0 apache 5893 5883 0 11:06 ? 00:00:00 /usr/sbin/httpd |
(13)Permission denied: make_sock: could not bind to address [::]:8000 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:8000 |
May 21 23:35:10 CentOS64teresa kernel: type=1400 audit(1369125310.195:5): avc: denied { name_bind } for pid=10153 comm="httpd" src=8000 scontext=unconfined_u:system_r:httpd _t:s0 tcontext=system_u:object_r:soundd_port_t:s0 tclass=tcp_socket |
# /usr/sbin/semanage port -l | grep 80 | grep http_port_t http_port_t tcp 80, 443, 488, 8008, 8009, 8443 |
#!/bin/bash echo "Content-type: text/html" echo "" echo "" echo "<html>" echo "<body>" echo "Hello, CGI!<br>" echo "</body>" echo "</html>" |
$ /usr/sbin/getsebool -a | grep cgi git_cgit_read_gitosis_content --> off httpd_enable_cgi --> on |
#!/bin/bash /bin/date >> /tmp/cgi_tmp.txt echo "Content-type: text/html" echo "" echo "" echo "<html>" echo "<body>" echo "file write OK<br>" echo "</body>" echo "</html>" |
#!/bin/bash cd /tmp /usr/bin/wget http://example.com/ echo "Content-type: text/html" echo "" echo "" echo "<html>" echo "<body>" echo "wget OK<br>" echo "</body>" echo "</html>" |
May 24 23:00:16 CentOS64teresa kernel: type=1400 audit(1369368016.429:31135): avc: denied { name_connect } for pid=10743 comm="wget" dest=80 scontext=unconfined_ u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket |
May 24 23:09:02 CentOS64teresa kernel: type=1405 audit(1369368542.481:31137): bool= httpd_can_network_connect val=1 old_val=0 auid=500 ses=5 May 24 23:09:02 CentOS64teresa dbus: avc: received policyload notice (seqno=2) May 24 23:09:02 CentOS64teresa dbus: [system] Reloaded configuration May 24 23:09:02 CentOS64teresa dbus: avc: received policyload notice (seqno=2) May 24 23:09:03 CentOS64teresa setsebool: The httpd_can_network_connect policy bool ean was changed to on by root |
booleans(8), setsebool(8), selinuxenabled(8), togglesebool(8),
restore-con(8), setfiles(8), ftpd_selinux(8), named_selinux(8),
rsync_selinux(8), httpd_selinux(8), nfs_selinux(8), samba_selinux(8),
kerberos_selinux(8), nis_selinux(8), ypbind_selinux(8)
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn/> DAV svn SVNListParentPath on SVNParentPath /var/www/svn AuthType Basic AuthName "Authorization Realm" AuthUserFile /etc/httpd/conf.d/svn_myrepo.basic Require valid-user </Location> |
(1)/usr/(.*/)?bin/java.* -- system_u:object_r:java_exec_t:s0 (2)/opt/(.*/)?bin/java[^/]* -- system_u:object_r:java_exec_t:s0ディレクトリ配下に対して一括でコンテキストを設定してくれるrestorecon という素敵コマンドがあります。
(1)/usr/ の下のどこかでbin で終わる名前のディレクトリより下にある、java ではじまるファイル名のもの全てがヒットし、コンテキストがsystem_u:object_r:java_exec_t:s0 に設定されます。
または
(2)/opt/ の下のどこかでbin で終わる名前のディレクトリ直下にあるjava で始まる名前のファイル全て
/usr と/opt で微妙に正規表現が違います。(1)では/usr/bin/javadir/foo.txt もヒットしてしまうので、foo.txt はjava_exec_t になってしまいます。 (2)ではそのようなことはありません。正規表現で[]カッコの中の「^」はnot の意味になるので、bin の下のサブディレクトリは含まれないことになります。 (2)の正規表現の方がイケてますね。
#!/bin/sh export JAVA_HOME=/opt/jdk export CATALINA_HOME=/opt/tomcat7 export CATALINA_OPTS="-server -Xmx1024m -XX:MaxPermSize=256m" |
$ ps -eZ | grep sendmail | grep -v grep system_u:system_r:sendmail_t:s0 2521 ? 00:00:00 sendmail system_u:system_r:sendmail_t:s0 2530 ? 00:00:00 sendmail |
元: dnl define(`SMART_HOST', `smtp.your.provider')dnl 新: define(`SMART_HOST', `メール転送サーバのFQDN')dnl
元: dnl EXPOSED_USER(`root')dnl 新: EXPOSED_USER(`root')dnl
元: dnl MASQUERADE_AS(`mydomain.com')dnl 新: MASQUERADE_AS(`$w.$m')dnl次の行はアンコメントアウト
元: dnl FEATURE(masquerade_entire_domain)dnl 新: FEATURE(masquerade_entire_domain)dnl次の行もアンコメントアウト
元: dnl FEATURE(masquerade_envelope)dnl 新: FEATURE(masquerade_envelope)dnl
元: DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl 新: DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
Dwホスト名(wのあとには空白を空けない) Dmドメイン名(mのあとには空白を空けない) define(`confDOMAIN_NAME', `$w.$m')
# /etc/init.d/sendmail stop # cd /etc/mail # cp sendmail.cf sendmail.cf.backup # make sendmail.cf # ls -l # ls -Zsendmail.cf はetc_mail_t タイプになってました。問題なさそうな感じです。
# /etc/init.d/sendmail start # tail /var/log/maillog # ps -eZ | grep sendmail