我将整合check_mk 使用 OpenLDAP 的多站点配置完LDAP连接器后,打开“用户和联系人”页面时出现以下错误:
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 并尝试更改密码。我确信它已成功更改,但pwdChangedTime
在运行以下命令时我没有看到该属性ldapsearch
:
$ 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
我错过了什么?
答案1
实际上,该pwdChangedTime
属性已经创建,但由于它是操作属性,默认情况下不返回。您必须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
要将此属性添加到实施密码策略覆盖之前创建的所有用户,您只需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