我正在使用activedirectory module从我的 Node 应用程序之一中的 npmjs 来针对 Active Directory 进行身份验证,我的问题是 - 在使用 AD 进行身份验证时是否需要发送纯字符串密码?我的意思是,如果广告存储用户密码,它必须以某种方式对其进行加密,我们可以发送加密密码进行身份验证吗?这就是我的意思 -
ad.authenticate(username, password, function(err, auth) {
// instead of plain password can it be encrypted password?
if (err) {
console.log('ERROR: '+JSON.stringify(err));
return;
}
if (auth) {
console.log('Authenticated!');
}
else {
console.log('Authentication failed!');
}
})
最佳答案
解决方案是使用 ldaps(安全 LDAP)并在首次连接时提供 CA 进行验证。通过网络发送的凭据将被加密,如果您强制进行证书验证,MITM 攻击将不起作用。
const ActiveDirectory = require("activedirectory");
const ad = new ActiveDirectory({
url: "ldaps://dc.domain.com",
baseDN: "dc=domain,dc=com",
username: "username@domain.com",
password: "password",
tlsOptions: {
ca: [fs.readFileSync("CA.crt")],
rejectUnauthorized: true // Force Certificate Verification
}
});
关于node.js - NPM - ActiveDirectory 模块身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43888654/