我将把check_mk的Multisite与OpenLDAP整合起来 。 configurationLDAP连接器后,打开“用户和联系人”页面时出现以下错误:
Error executing sync hook The "Authentication Expiration" attribute (pwdchangedtime) could not be fetchedfrom the LDAP server for user {u'cn': [u'noreply']}.
以下是我为实现密码策略覆盖所做的所有步骤:
为OpenLDAP服务器安装覆盖模块:
yum install openldap-servers-overlays
将以下行添加到/etc/openldap/slapd.conf中:
include /etc/openldap/schema/ppolicy.schema modulepath /usr/lib64/openldap moduleload ppolicy.la
然后我重新启动OpenLDAP并尝试更改密码。 我确定它已成功更改,但在运行ldapsearch时看不到pwdChangedTime属性:
$ ldapsearch -x -D "cn=Manager,dc=domain,dc=com" -y .passwd.cnf "cn=noreply" dn: cn=noreply,ou=it,dc=domain,dc=com cn: noreply mail: noreply at domain.com maildrop: noreply at domain.com sn: No uid: noreply objectClass: inetOrgPerson objectClass: mailUser objectClass: organizationalPerson objectClass: person objectClass: top objectClass: pwdPolicy objectClass: pwdPolicyChecker pwdAttribute: userPassword pwdMaxAge: 31536000 pwdMinAge: 60 pwdAllowUserChange: TRUE userPassword: {MD5}xx
我错过了什么?
实际上, pwdChangedTime属性已经创build,但由于它是一个操作属性 ,所以它不会被默认返回。 你必须用这个名字做一个ldapsearch :
$ ldapsearch -x -D "cn=Manager,dc=domain,dc=com" -W "cn=noreply" pwdChangedTime Enter LDAP Password: # extended LDIF # # LDAPv3 # base <> with scope subtree # filter: cn=noreply # requesting: pwdChangedTime # # noreply, it, domain.com dn: cn=noreply,ou=it,dc=domain,dc=com pwdChangedTime: 20130128154849Z
或者将加号( + )追加到ldapsearch :
# ldapsearch -x -D "cn=Manager,dc=domain,dc=com" -y .passwd.cnf "cn=noreply" + # extended LDIF # # LDAPv3 # base <> with scope subtree # filter: cn=noreply # requesting: + # # noreply, it, domain.com dn: cn=noreply,ou=it,dc=domain,dc=com structuralObjectClass: inetOrgPerson entryUUID: 047e7ce6-3b99-1031-83cb-afef2344189c creatorsName: cn=Manager,dc=domain,dc=com createTimestamp: 20120526161012Z pwdChangedTime: 20130129032710Z entryCSN: 20130129032710Z#00003a#00#000000 modifiersName: cn=Manager,dc=domain,dc=com modifyTimestamp: 20130129032710Z entryDN: cn=noreply,ou=it,dc=domain,dc=com subschemaSubentry: cn=Subschema hasSubordinates: FALSE
要将此属性添加到在实施密码策略覆盖之前创build的所有用户,只需使用相同的值更新userPassword即可:
ldapsearch -x -D cn=Manager,dc=domain,dc=com -W -y .passwd.txt -L "(&(objectclass=person)(!(pwdChangedTime=*)))" userPassword | sed '/dn: /a\changetype: modify\nreplace: userPassword' | ldapmodify -x -D cn=Manager,dc=domain,dc=com -y .passwd.txt -W