我的應用程序需要用戶通過Active Directory進行驗證。我們正在考慮使用System.DirectoryServices.DirectoryEntry來執行一個PowerShell腳本,我們會傳遞一個用戶名和密碼。如何在Powershell中安全驗證AD用戶(加密憑證)
我看到它在不同的答案中提到了System.DirectoryServices.DirectoryEntry使用LDAP來讀取AD信息的事實。 LDAP協議本身不加密。您可以使用LDAPS,但需要設置CA.我想知道這個命令生成的網絡流量是否默認安全 - 即是否有可能通過網絡嗅探密碼?
編輯 我發現您可以將其他選項傳遞給DirectoryEntry實例。這是示例代碼:
$username = $args[0]
$password = $args[1]
Function Test-ADAuthentication {
param($username,$password)
(new-object directoryservices.directoryentry "",$username,$password,Secure -bor Sealing).psbase.name -ne $null
}
Test-ADAuthentication $username $password
第四個參數是一個枚舉AuthenticationTypes http://msdn.microsoft.com/en-us/library/system.directoryservices.authenticationtypes(v=vs.90).aspx
,似乎令人感興趣的是值:安全&密封它們組合起來將加密憑據
許多感謝讀。
嗨邁克爾。感謝您的時間。就LDAP而言 - 除非你使用LDAPS協議,否則它不會被默認加密,我已經知道了。我不相信你的第二段 - Powershell只是使用.NET庫,如上面的代碼示例 - 除非所有的PowerShell流量都是加密的?不過,我現在已經發現如何啓用安全+密封認證,根據文檔將提供使用Kerberos的安全認證... –