CentOS6.5のLDAPクライアントのsudo設定
前に構築したLDAPクライアント(
CentOS 6.xのLDAP設定(クライアント)のメモ - なみひらブログ
)にてsudoコマンドを実行したら、怒られました。。。
LDAPサーバにsudoersとして登録していたのに(´;ω;`)
[namihira@xx.xx.xx.xx]/etc% sudo ls sudo: 有効な sudoers のソースが見つかりません。終了します sudo: ポリシープラグインを初期化できません
LDAPクライアント基本情報
[root@xx.xx.xx.xx etc]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@xx.xx.xx.xx etc]# yum list installed | grep sudo sudo.x86_64 1.8.6p3-12.el6 @base
対策
いろいろファイルを見て回ったら、「sudo-ldap.conf」というなんとも怪しげなファイルがあったので、設定してみました。内容は「/etc/ldap.conf」に書いてあることのコピペです。
sudo-ldap.conf
・・・ ## ## URI ldap[s]://[hostname[:port]] ... ## Specifies a whitespace-delimited list of one or more ## URIs describing the LDAP server(s) to connect to. ## #uri ldap://ldapserver uri ldap://(LDAPサーバのIP)/ ## ## SUDOERS_BASE base ## The base DN to use when performing sudo LDAP queries. ## Multiple SUDOERS_BASE lines may be specified, in which ## case they are queried in the order specified. ## #sudoers_base ou=SUDOers,dc=example,dc=com sudoers_base ou=SUDOers,dc=xx,dc=xx,dc=co,dc=jp ## ## BIND_TIMELIMIT seconds ## The BIND_TIMELIMIT parameter specifies the amount of ## time to wait while trying to connect to an LDAP server. ## #bind_timelimit 30 bind_timelimit 120 ・・・
編集後、sudoを実行してみる。
[namihira@xx.xx.xx.xx]/etc% sudo ls ConsoleKit hp profile DIR_COLORS httpd profile.d DIR_COLORS.256color idmapd.conf protocols DIR_COLORS.lightbgcolor init pulse NetworkManager init.d purple PackageKit inittab quotagrpadmins Trolltech.conf inputrc quotatab X11 ipa rc abrt iproute2 rc.d acpi issue rc.local adjtime issue.net rc.sysinit aliases java rc0.d aliases.db jvm rc1.d alsa jvm-commmon rc2.d ・・・
実行できた\(^o^)/
考察
sudoコマンドの設定をみると、LDAP連携時の設定が「/etc/sudo-ldap.conf」になっていました。- CentOS 6.5に入っていたsudo
[root@xx.xx.xx.xx]# sudo -V Sudo バージョン 1.8.6p3 configure オプション: --build=x86_64-redhat-linux-gnu (中略) --with-ldap-conf-file=/etc/sudo-ldap.conf (中略) ldap.conf のパス: /etc/sudo-ldap.conf ldap.secret のパス: /etc/ldap.secret (以下、略)
参考までに
- CentOS 5.5に入っていたsudo
[root@zz.zz.zz.zz]# sudo -V Sudo version 1.7.2p1 Sudoers path: /etc/sudoers nsswitch path: /etc/nsswitch.conf ldap.conf path: /etc/ldap.conf ldap.secret path: /etc/ldap.secret (以下、略)
バージョンによって、設定ファイルが違う\(^o^)/