Juls1029
Juls1029

Reputation: 149

how to access AWS Microsoft AD using npm packages like activedirectory, ldapjs or ldap-client

I have an AWS Directory Service for Microsoft AD and and EC2 Windows Server 2016 joined to the AD and put users into the AD,

my question is how will i access the AD using npm packages like activedirectory, ldapjs or ldap-client

AWS Microsoft for AD

Below is my code snippet:

let ActiveDirectory = require('activedirectory');
let adConfig = {
    url: 'ldap://ec2-*-*-*-152.ap-southeast-1.compute.amazonaws.com',
    baseDN: 'DC=corp,DC=***,DC=com',
    username: 'CN=Admin,OU=Users,OU=corp,DC=corp,DC=***,DC=com',
    password: '*******'
};

let ad = new ActiveDirectory(adConfig);
let username = 'j***@corp.***.com';
let password = '******';

ad.authenticate(username, password, function(err, auth) {
    if (err) {
        console.log('=== executed this err block ===');
        console.error('ERROR: ' + JSON.stringify(err));
        return;
    }

    if (auth) {
        console.log('Authenticated');
        return;
    }

    console.log('Authentication failed');
});

returns error: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":"..*.152","port":389}

Url provided is the Public DNS of my ec2 (with security group open for all port numbers) instance joined with the AWS AD

Upvotes: 1

Views: 248

Answers (0)

Related Questions