- 起動失敗
# /etc/rc.d/init.d/slapd start
slapd の設定ファイルをチェック中: [失敗]
olcDbDirectory: value #0: invalid path: Permission denied
config error processing olcDatabase={1}bdb,cn=config: olcDbDirectory: value #0: invalid path: Permission denied
slaptest: bad configuration file!
- SELinux が原因か調査する
# setenforce 0
# getenforce
Permissive
# /etc/rc.d/init.d/slapd start
slapd を起動中: [ OK ]
SELinux の実行モードを Permissive にすると起動することから SELinux が原因だと分かる。
元にもどす
# /etc/rc.d/init.d/slapd stop
slapd を停止中: [ OK ]
# setenforce 1
# getenforce
Enforcing
- /var/log/messages をみる
May 4 21:43:19 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from write access on the directory ldap.
For complete SELinux messages. run sealert -l ac7a035b-2e6d-4ee7-ba3a-f220bc8f1aa7
May 4 21:43:20 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from write access on the directory ldap.
For complete SELinux messages. run sealert -l ac7a035b-2e6d-4ee7-ba3a-f220bc8f1aa7
May 4 21:43:21 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from write access on the directory ldap.
For complete SELinux messages. run sealert -l ac7a035b-2e6d-4ee7-ba3a-f220bc8f1aa7
May 4 21:43:22 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from write access on the directory ldap.
For complete SELinux messages. run sealert -l ac7a035b-2e6d-4ee7-ba3a-f220bc8f1aa7
May 4 21:43:23 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from remove_name access on the directory DUMMY.
For complete SELinux messages. run sealert -l f152bf10-f1fe-4235-9f90-194573beca05
May 4 21:43:23 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from remove_name access on the directory DUMMY.
For complete SELinux messages. run sealert -l f152bf10-f1fe-4235-9f90-194573beca05
May 4 21:43:24 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from read access on the file DB_CONFIG.
For complete SELinux messages. run sealert -l bbde5eb7-698d-4339-8e70-212af67e3832
May 4 21:43:25 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from lock access on the file /var/lib/ldap/alock.
For complete SELinux messages. run sealert -l be1e9256-3cc4-4dc7-80d0-759a4e0d285f
May 4 21:43:26 gs setroubleshoot: SELinux is preventing /usr/sbin/slapd from getattr access on the file /var/lib/ldap/alock.
For complete SELinux messages. run sealert -l dc76c0fe-9ec1-4a34-add3-1bad390863db
- /var/log/audit/audit.log にもログが出力されるけど、/var/log/messages の方がわかりやすい
- /var/lib/ldap/ のアクセス権の問題っぽいですな
- 推奨されている解決策を表示
# sealert -l ac7a035b-2e6d-4ee7-ba3a-f220bc8f1aa7
SELinux is preventing /usr/sbin/slapd from write access on the ディレクトリ ldap.
***** プラグイン catchall_labels (83.8 confidence) が提案しています ********************
もし、 slapd が ldap directory の write アクセスを持つことを許可したい
そして、ldap のラベルを変更する必要があります
行ってください
# semanage fcontext -a -t FILE_TYPE 'ldap'
この FILE_TYPE 以下のどれかです: var_lock_t, tmp_t, tmpfs_t, slapd_replog_t, var_run_t, slapd_db_t, slapd_tmpfs_t, var_log_t,
slapd_log_t, slapd_var_run_t, slapd_tmp_t, root_t.
次にこれを実行してください:
restorecon -v 'ldap'
***** プラグイン catchall (17.1 confidence) が提案しています ***************************
もし、slapd に、 ldap directory の write アクセスがデフォルトで許可されるべきです。
そして、これをバグをして報告すべきです。
このアクセスを許可するために、ローカルポリシーモジュールを生成することができます。
行ってください
このアクセスを一時的に許可するには、以下を実行してください。:
# grep slaptest /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
- やってみる
- SELinux の type 設定ファイルにエントリを追加
# semanage fcontext -a -t slapd_db_t "/etc/openldap/(/.*)?"
# cat /etc/selinux/targeted/contexts/files/file_contexts | grep openldap
/var/run/openldap(/.*)? system_u:object_r:slapd_var_run_t:s0
/etc/openldap/slapd\.d(/.*)? system_u:object_r:slapd_db_t:s0
- 反映
# restorecon -R /etc/openldap/slapd.d
# ls -dZ /etc/openldap/slapd.d
drwxr-xr-x. ldap ldap unconfined_u:object_r:slapd_db_t:s0 /etc/openldap/slapd.d
# ls -dZ /etc/openldap/slapd.d/*
drwxr-x---. ldap ldap unconfined_u:object_r:slapd_db_t:s0 /etc/openldap/slapd.d/cn=config
-rw-------. ldap ldap unconfined_u:object_r:slapd_db_t:s0 /etc/openldap/slapd.d/cn=config.ldif
- 同様に
# semanage fcontext -a -t slapd_db_t "/var/lib/ldap/(/.*)?"
# restorecon -R /var/lib/ldap
- 起動した
# /etc/rc.d/init.d/slapd start
slapd を起動中: [ OK ]