Hi guys, I have google a lot to modify cn=config but all failed. Hope someone can help. Thanks.
[openldap2.6.1 CentOS7.9]
My initial ldif is like below:
`[root@rayc01 openldap]# more slapd.ldif |grep -v ^#
dn: cn=config
objectClass: olcGlobal
cn: config
olcArgsFile: /usr/local/openldap-2.6.1/var/run/slapd.args
olcPidFile: /usr/local/openldap-2.6.1/var/run/slapd.pid
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/local/openldap-2.6.1/libexec/openldap
olcModuleload: back_mdb.la
dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/core.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/collective.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/corba.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/cosine.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/dsee.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/duaconf.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/dyngroup.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/inetorgperson.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/java.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/misc.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/namedobject.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/nis.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/openldap.ldif
include: file:///usr/local/openldap-2.6.1/etc/openldap/schema/pmi.ldif
dn: olcDatabase=frontend,cn=config
objectClass: olcDatabaseConfig
objectClass: olcFrontendConfig
olcDatabase: frontend
dn: olcDatabase=mdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMdbConfig
olcDatabase: mdb
olcDbMaxSize: 1073741824
olcSuffix: dc=domain,dc=com
olcRootDN: cn=root,dc=domain,dc=com
olcRootPW: {SSHA}N/Zg9jqjoL1E4xEHc1dGdyTzZiOlEsrs
olcDbDirectory: /usr/local/openldap-2.6.1/var/openldap-data
olcDbIndex: objectClass eq
dn: olcDatabase=monitor,cn=config
objectClass: olcDatabaseConfig
olcDatabase: monitor
olcRootDN: cn=config
olcMonitoring: FALSE
[root@rayc01 openldap]#
`
After import by slapadd and after slapd start, i can add my ou with cn=root by ldapadd. like below:
`[root@rayc01 ~]# more base.ldif
dn: dc=domain,dc=com
dc: domain
objectClass: top
objectClass: domain
dn: ou=People,dc=domain,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Group,dc=domain,dc=com
objectClass: organizationalUnit
ou: Group
dn: ou=Mounts,dc=domain,dc=com
objectClass: organizationalUnit
ou: Mounts`
But when I try to modify olcLogLevel and olcIdleTimeout in cn=config, I get errors:
[root@rayc01 ~]# more log.ldif
dn: cn=config
changeType: modify
replace: olcIdleTimeout
olcIdleTimeout: 60
dn: cn=config
changeType: modify
replace: olcLogLevel
olcLogLevel: 256
[root@rayc01 ~]# ldapmodify -Y external -H ldapi:/// -f 1.ldif
ldap_sasl_interactive_bind: Can't contact LDAP server (-1)
[root@rayc01 ~]# ldapmodify -x -D cn=root,dc=domain,dc=com -w "xxx@123" -f log.ldif
modifying entry "cn=config"
ldap_modify: Insufficient access (50)
[root@rayc01 ~]# ldapmodify -x -D cn=config -f log.ldif
ldap_bind: Server is unwilling to perform (53)
additional info: unauthenticated bind (DN with no password) disallowed
[root@rayc01 ~]#
[root@rayc01 ~]# more 1.ldif
dn: olcDatabase={0}config,cn=config
#olcRootDN: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
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=r
oot,dc=huawei,dc=com" read by * none
[root@rayc01 ~]# ldapmodify -Y external -H ldapi:/// -f 1.ldif
ldap_sasl_interactive_bind: Can't contact LDAP server (-1)
[root@rayc01 ~]#