Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add: Object class violation error on adding password policies

Tags:

ldap

openldap

While adding the password policy in the openldap file it throws error While running from the command line

root@openldap-server:/etc/ldap/slapd.d# ldapadd -D cn=admin,dc=zariga,dc=com -w password -f passwordpolicy.ldif
adding new entry "cn=DefaultPPolicy,ou=Policies,dc=zariga,dc=com"
ldap_add: Object class violation (65)
    additional info: no structural object class provided

This is the LDIF file

dn: cn=DefaultPPolicy,ou=Policies,dc=zariga,dc=com
cn: DefaultPPolicy
objectClass: pwdPolicy
objectClass: top
pwdAttribute: userPassword
pwdMaxAge: 3024000
pwdExpireWarning: 1814400
pwdInHistory: 4
pwdCheckQuality: 1
pwdMinLength: 9
pwdMaxFailure: 4
pwdLockout: TRUE
pwdLockoutDuration: 600
pwdGraceAuthNLimit: 0
pwdFailureCountInterval: 0
pwdMustChange: TRUE
pwdAllowUserChange: TRUE
pwdSafeModify: FALSE
like image 681
anish Avatar asked Oct 28 '25 06:10

anish


1 Answers

You're trying to add an object to LDAP with only pwdPolicy objectClass which is defined as AUXILIARY (see Password Policy for LDAP Directories, ch. 5.1) and every object added to LDAP server must have a STRUCTURAL objectClass.

You need to change your LDIF file to include one STRUCTURAL objectClass like device (or any other that you fancy but it's type is STRUCTURAL).

For instance:

dn: cn=DefaultPPolicy,ou=Policies,dc=zariga,dc=com
cn: DefaultPPolicy
objectClass: device
objectClass: pwdPolicy
objectClass: top
...
like image 130
Zoran Regvart Avatar answered Oct 30 '25 00:10

Zoran Regvart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!