OpenLDAP SSL集成-修改cn=config的ACL权限

OpenLDAP SSL integration - ACL permissions for modifying cn=config

我正在尝试在 olcTLSCertificateFile 中添加 ssl 证书。

dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/file.crt

dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile 
olcTLSCertificateKeyFile: /etc/openldap/certs/file.key

我在 CentOS7 上使用 OpenSSL Single Sign-on 创建了这些证书。

openssl req -new -x509 -nodes -out /etc/openldap/certs/file.crt -keyout /etc/openldap/certs/file.key -days 3650

这是我添加到using

的ACL权限
#monitor.ldif
dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external, cn=auth" read by dn.base="cn=Manager,dc=domain,dc=com" read by * none

最后,我在修改文件时遇到错误:

ldapmodify -x -W -D "cn=Manager,dc=domain,dc=com"  -H ldapi:/// -f certs.ldif

Enter LDAP Password: 

 modifying entry "cn=config"

ldap_modify: Insufficient access (50)

我终于找到了解决办法。只需更改密钥和 crt 文件的顺序即可。

dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile 
olcTLSCertificateKeyFile: /etc/openldap/certs/file.key

dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/file.crt

您使用两个单独的 LDAP 请求的原因是什么?

我强烈建议使用单个 LDAP 修改请求,因为单个 LDAP 写入操作是原子的:

dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/openldap/certs/file.key
-
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/file.crt
-