Basic認証+LDAP2014/04/30 |
|
ある特定のページに対してアクセス制限をかけ、認証には LDAP を利用します。
したがって、LAN内にLDAPサーバー稼働中であることが前提です。
|
|
| [1] | 例として [/var/www/html/auth-ldap] ディレクトリ配下を認証対象として設定します。 |
|
root@www:~# a2enmod ldap authnz_ldap Enabling module ldap. Considering dependency ldap for authnz_ldap: Module ldap already enabled Enabling module authnz_ldap. To activate the new configuration, you need to run: service apache2 restart
root@www:~#
vi /etc/apache2/sites-available/auth-ldap.conf # 新規作成
<Directory /var/www/html/auth-ldap>
SSLRequireSSL
AuthName "LDAP Authentication"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL ldap://dlp.srv.world/dc=srv,dc=world?uid?sub?(objectClass=*)
Require ldap-filter objectClass=posixAccount
</Directory>
mkdir /var/www/html/auth-ldap root@www:~# a2ensite auth-ldap Enabling site auth-ldap. To activate the new configuration, you need to run: service apache2 reloadroot@www:~# /etc/init.d/apache2 restart * Restarting web server apache2 ...done. # テストページ作成
root@www:~#
vi /var/www/html/auth-ldap/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Test Page for LDAP Auth </div> </body> </html> |
| [2] | Webブラウザからテストページにアクセスしてみます。 すると設定通り認証を求められますので、LDAPに登録してあるユーザーで認証します。 |
|
| [3] | アクセスできました。 |
|
| Sponsored Link |
|
|