Search code examples
ldapx509certificatesmimeldifadlds

Adding certificate in userSMIMECertificate attribute of inetOrgPerson


I'm going to publish a certificate for my email using LDAP. I already have a LDAP up and running (AD LDS) on windows 2012. I'm going to add records using ldif file.

Here its contents

dc: dc=mysubdomain,dc=mydomain,dc=com

dn: dc=mysubdomain,dc=mydomain,dc=com
objectClass: top
objectClass: domain
dc: mydomain
dc: mysubdomain
description: Some root stuff

dn: ou=mysubdomaincertificates,dc=mysubdomain,dc=mydomain,dc=com
objectClass: top
objectClass: organizationalUnit
ou: mysubdomaincertificates

dn: [email protected],ou=mysubdomaincertificates,dc=mysubdomain,dc=mydomain,dc=com
objectClass: top
objectClass: person
objectClass: inetOrgPerson
cn: Test Test
sn: Test
Mail: [email protected]
userSMIMECertificate: #<What to put?>

I'm stuck in compiling my ldif file. As I understand, I need to put some binary encoded in Base64 with some prefix {CERT} or something.

My questions are

  1. Will this ldif file make modifications into the directory?
  2. Do I have problems except userSMIMECertificate field?
    • For example I'm using dc twice in the domain object, is it ok?
    • Am I missing some other important line?
  3. What is exact syntax of putting certificate content in the userSMIMECertificate? (I've made a search, but could not find the examples)

Solution

  • Here is your LDIF with the appropriate changes:

    dn: dc=mysubdomain,dc=mydomain,dc=com
    changetype: add
    objectClass: top
    objectClass: domain
    dc: mysubdomain
    description: Some root stuff
    
    dn: ou=mysubdomaincertificates,dc=mysubdomain,dc=mydomain,dc=com
    changetype: add
    objectClass: top
    objectClass: organizationalUnit
    ou: mysubdomaincertificates
    description: Provide some descriptive text here.
    
    dn: [email protected],ou=mysubdomaincertificates,dc=mysubdomain,dc=mydomain,dc=com
    changetype: add
    objectClass: top
    objectClass: person
    objectClass: inetOrgPerson
    cn: Test Test
    sn: Test
    Mail: [email protected]
    userSMIMECertificate: file:///path-cert-file