投げ銭

★当サイトへの投げ銭(PayPal)★

LINK


(無償、寄付歓迎) logo
世界中で使われるISO標準オフィスソフト(MSオフィス互換)

★LibreOfficeの導入事例★
詳細について

人気の投稿(1ヶ月間)

Ad

Ad

投げ銭

★当サイトへの投げ銭(PayPal)★

2022年7月14日木曜日

【Linux CentOS 7】OpenLDAPのためにWEBベースクライアントphpLDAPAdminを導入する【phpLDAPAdmin 1.2.5】


 次のページのように、CentOS 7(特権動作Dockerコンテナ)にソースからOpenLDAP(2.5.12)をインストールし、さらに初期設定を済ませた。

【Docker Linux CentOS 7】ソースから導入したOpenLDAP(2.5.12)の初期設定【OpenLDAP 2.5.12】


 この環境において、phpLDAPAminというWEBベースのLDAPクライアントソフトウェアをインストールし、初期設定を行う。


■phpLDAPAdminのインストール


◯ インストール

・リポジトリの追加

# yum install epel-release
Installed:
  epel-release.noarch 0:7-11                                                    

Complete!

・phpldapadminパッケージのインストール

# yum install phpldapadmin
Installed:
  phpldapadmin.noarch 0:1.2.5-1.el7

Dependency Installed:
  apr.x86_64 0:1.4.8-7.el7              apr-util.x86_64 0:1.5.2-6.el7               caddy.x86_64 0:1.0.3-1.el7               centos-logos.noarch 0:70.0.6-3.el7.centos 
  httpd.x86_64 0:2.4.6-97.el7.centos.5  httpd-tools.x86_64 0:2.4.6-97.el7.centos.5  libedit.x86_64 0:3.0-12.20121213cvs.el7  libzip.x86_64 0:0.10.1-8.el7              
  mailcap.noarch 0:2.1.41-2.el7         php.x86_64 0:5.4.16-48.el7                  php-cli.x86_64 0:5.4.16-48.el7           php-common.x86_64 0:5.4.16-48.el7         
  php-ldap.x86_64 0:5.4.16-48.el7      

Complete!

◯ 初期設定

# vi /etc/httpd/conf.d/phpldapadmin.conf
#
#  Web-based tool for managing LDAP servers
#

Alias /phpldapadmin /usr/share/phpldapadmin/htdocs
Alias /ldapadmin /usr/share/phpldapadmin/htdocs

<Directory /usr/share/phpldapadmin/htdocs>
  <IfModule mod_authz_core.c>
    # Apache 2.4
    #Require local
    Require all granted
  </IfModule>
  <IfModule !mod_authz_core.c>
    # Apache 2.2
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
  </IfModule>
</Directory>

◯ 接続テスト

・httpdを起動

# systemctl restart httpd


・ブラウザからマシンのアドレスにアクセスする。

http://IPアドレス/ldapadmin/




■phpLDAPAdminの設定と動作テスト

◯ phpLDAPadminがOpenLDAPサーバーに接続できるようにするための設定

・オリジナル設定ファイルのバックアップ

# cp /etc/phpldapadmin/config.php /etc/phpldapadmin/config.php.org


・設定ファイルの編集

# vi /etc/phpldapadmin/config.php

次の各項目を探してそれぞれ次のように編集を行う。
viのコマンド「:set number」で行番号が表示される。(行番号を消す場合は、:set nonumber)


291行目付近
(1) 管理対象するLDAPサーバーの名称
/* A convenient name that will appear in the tree viewer and throughout
   phpLDAPadmin to identify this LDAP server to users. */
// $servers->setValue('server','name','Local LDAP Server');
$servers->setValue('server','name','Local LDAP Server 1');
298行目付近
(2) 管理対象するLDAPサーバーのIPアドレス(phpLDAPAdminと同じホストなら127.0.01)
/* Examples:
   'ldap.example.com',
   'ldaps://ldap.example.com/',
   'ldapi://%2fusr%local%2fvar%2frun%2fldapi'
           (Unix socket at /usr/local/var/run/ldap) */
// $servers->setValue('server','host','127.0.0.1');
$servers->setValue('server','host','127.0.0.1');
301行目付近
(3) 管理対象するLDAPサーバーのTCPポート
/* The port your LDAP server listens on (no quotes). 389 is standard. */
// $servers->setValue('server','port',389);
$servers->setValue('server','port',389);
305行目付近
(4) 管理対象するLDAPサーバーのベースdn(ここで指定したou以下を管理対象とする)
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
   auto-detect it for you. */
// $servers->setValue('server','base',array(''));
$servers->setValue('server','base',array('dc=example,dc=co,dc=jp'));

◯ 動作テスト

・OpenLDAPサーバーの起動

# systemctl start slapd


・httpdを起動

systemctl restart httpd


・ブラウザからマシンのアドレスにアクセスする。

http://IPアドレス/ldapadmin/

左欄のサーバー名の下にある「login」をクリックする。
すると、次のように「Authenticate to server Local LDAP Server 1」というダイアログが現れる。
ダイアログの「Anonymous」にチックを入れて、「Authenticate」ボタンをクリックする。


このとき、OpenLDAPサーバーが起動していなければ、次のエラーが出て接続できない。
Unable to connect to LDAP server Local LDAP Server 1
Error: Can't contact LDAP server (-1) for anon
error Failed to Authenticate to server
Invalid Username or Password.
うまく、phpLDAPAdminがOpenLDAPサーバーに接続できれば、次のように表示される。
Authenticate to server
Successfully logged into server.
また、指定したベースdnが未作成の場合は、次のように表示される。
This base cannot be created with PLA.



<参考>

・デージーネット. 入門LDAP/OpenLDAPディレクトリサービス導入・運用ガイド第3版. 秀和システム, 2017, 430p.

・Install and Configure phpLDAPAdmin on CentOS 7 / Ubuntu 16.04
< https://www.itzgeek.com/how-tos/linux/centos-how-tos/install-configure-phpldapadmin-centos-7-ubuntu-16-04.html > 2022年2月20日

・【LDAP基礎用語】DCとは?OUとは?バインドDN,ベースDN,サフィックスとは?匿名バインドとは?ldapsearchのオプション
< https://milestone-of-se.nesuke.com/l7protocol/ldap/binddn-basedn/ >

投げ銭

★当サイトへの投げ銭(PayPal)★

Ad

Ad