0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Active Directory入門:LDAP認証の技術検証 (Windows環境)について体系的に整理してみた

Last updated at Posted at 2025-03-08

はじめに

Windows環境でLDAP認証を利用する際の技術検証についての備忘録です。

ドメイン参加済みのWindowsサーバーで、LDAPを使用したユーザー認証を行う手順をまとめます。


環境情報

  • LDAPサーバー (Active Directory)
    • ホスト名: ad.example.com
    • ドメイン: example.com
    • LDAPポート: 389(LDAPSの場合 636
  • テスト用クライアント (Windowsサーバー)
    • ドメイン参加済み
    • ユーザー: testuser@example.com

1. PowerShell を使った LDAP 認証の確認

PowerShellを使用して、LDAP認証が成功するかをテストします。

スクリプト

# LDAPサーバー情報
$ldapServer = "ad.example.com"
$ldapPort = 389  # LDAPSなら 636
$ldapUser = "testuser@example.com"
$ldapPassword = "P@ssw0rd"

# DirectoryEntry クラスを使ってバインド (認証)
try {
    $ldapConnection = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$ldapServer:$ldapPort", $ldapUser, $ldapPassword)
    
    if ($ldapConnection.Name -ne $null) {
        Write-Host "LDAP 認証成功: ユーザー $ldapUser は有効"
    } else {
        Write-Host "LDAP 認証失敗: ユーザーが見つからない"
    }
} catch {
    Write-Host "LDAP 認証エラー: $_"
}

結果の確認

結果 出力メッセージ
認証成功 LDAP 認証成功: ユーザー testuser@example.com は有効
認証失敗 LDAP 認証失敗: ユーザーが見つからない
認証エラー LDAP 認証エラー: Access is denied

2. ldp.exe を使った LDAP 認証の確認 (GUI ツール)

  1. Windowsキー + R を押し、ldp.exe を実行します。
  2. 「Connection」→「Connect」 を選択します。
    • Server: ad.example.com
    • Port: 389(LDAPSなら 636
    • Use SSL にチェックを入れます(LDAPSを使う場合)
  3. 「Connection」→「Bind」 を選択します。
    • Bind Type: Simple Bind
    • User: testuser@example.com
    • Password: P@ssw0rd
  4. OK をクリックし、認証結果を確認します。

結果の確認

結果 確認方法
認証成功 Authenticated as DN が表示される
認証失敗 Invalid credentials エラーが表示される

まとめ

検証方法 成功時の確認方法 失敗時のエラー例
PowerShell スクリプト LDAP 認証成功 LDAP 認証エラー: Access is denied
ldp.exe (GUI ツール) Authenticated as DN Invalid credentials

本記事の内容は、個人の技術調査に基づいており、実際の環境での検証はまだ行っていない部分も含まれます。

LDAP 認証の技術検証として、まずは PowerShell で認証テストを行い、その後 ldp.exe で確認するのが基本だと思っています。

今後は LDAP を使ったアプリケーションの認証組み込み を進める予定です。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?