end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

openldap の slapd.conf に 属性毎のアクセス権限(read write etc.)を設定

最近のopenldapでは、slapd.conf への直接設定は非推奨のようですが、とりあえず。

STEP1 属性を編集する部署&ユーザを追加

今回の場合、ヘルプデスクの担当者がldapクライアントでldapに直接接続すると仮定。

$ vi ~/tmp/add_helpdesk_dept_and_user.ldif

dn: cn=HelpDesk,dc=my-domain,dc=com
objectclass: organizationalRole
cn: HelpDesk

dn: cn=sampledesk,ou=helpdesk,dc=smart-heim,dc=com
objectClass: person
cn: sampledesk
sn: sampledesk
userPassword: {SHA}YyylynHcSfZ4rukYJCWrHe34L+U=

$ /usr/local/openldap/bin/ldapadd -x \
      -D cn=Manager,dc=my-domain,dc=com -w ないしょ \
      -f ~/tmp/add_helpdesk_dept_and_user.ldif

STEP2 slapd.conf に 属性毎のアクセス権限(read write etc.)を設定

以下のように「access to」を追加後、slapdを再起動するだけでOK

$ su -
# vi /usr/local/openldap/etc/openldap/slapd.conf
   :
access to attrs=mail,displayName,memberSid,uidAlias
  by dn="cn=samplehelp,ou=HelpDesk,dc=my-domain,dc=com" write
  by anonymous read
  by * none
access to attrs=userPassword
  by dn="cn=samplehelp,ou=HelpDesk,dc=my-domain,dc=com" write
  by anonymous auth
  by * none
access to *
  by dn="cn=samplehelp,ou=HelpDesk,dc=my-domain,dc=com" read
  by anonymous read
  by * none

他参考 - アクセス権限の優劣?

次の通り、Write権限があれば、Read権限も自動でつく感じです

none 0 =0
disclose d =d
auth x =xd
compare c =cxd
search s =scxd
read r =rscxd
write w =wrscxd