I have uses ldapjs
module of nodejs to interact with my active directory
.
i can bind and add user into the active directory with these functions...
ldapOptions = {
url: //my ldap server ip,
connectionTimeOut: 30000,
reconnect: true
}
const ldapClient = ldapJs.createClient(ldapOptions)
ldapClient.bind(adminDn, adminPass, (error) => {
if (error) {
// break the code
} else {
let newUser = {
cn: username,
sn: username,
description: // some desc,
objectClass: ['inetOrgPerson', 'user', 'person', 'top'],
userPassword: password
}
ldapClient.add(dn, newUser, err => {
if (err) {
console.log(err)
// break the code
} else {
console.log('success')
}
}
}
but after adding process the account is
disabled
and usermust change password
a the next login. is this default active directory policy or the ldapjs defaults? and if it is how can i change the defaults...
Update
I've active Active Directory Certificate Service
on my windows server(Active directory)
after that, export that certificate on active directory and added to my trust cert on my machine...
the ldapjs docs suggest to use nodejs/tls options to communicate with the ldaps
server...
const ldapOptions = {
url: 'ldaps://test-server.part.loc',
connectTimeout: 1000,
reconnect: false,
tlsOptions: {
// key and cert is create on my own but just created by openssl. do i have ti trusted it to my machine or server?
key: fs.readFileSync('my_cert.pem'),
cert: fs.readFileSync('my_key.pem'),
// this is the certificate of the active directory
ca: fs.readFileSync('fuck_cert.pem'),
checkServerIdentity: () => { return null; },
}
}
but still getting the error:
Error: error:0909006C:PEM routines:get_name:no start line
library: 'PEM routines',
function: 'get_name',
reason: 'no start line',
code: 'ERR_OSSL_PEM_NO_START_LINE'