Basic認証+LDAP2015/06/03 |
|
ある特定のページに対してアクセス制限をかけ、認証には LDAP を利用します。通信は SSL を要求するように設定します。
|
|
| [1] | |
| [2] | |
| [3] | 例として「/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 reload
root@www:~#
systemctl restart apache2
# テストページ作成
[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> |
| Webブラウザからテストページにアクセスしてみます。 すると設定通り認証を求められますので、LDAPに登録してあるユーザーで認証します。 |
|
| アクセスできました。 |
|
| Sponsored Link |