CentOS8ではOpenLDAPが完全になくなり、後継は「389 Directory Server」(以降389DSとします)となります。細かくはFreeIPAもありますが、FreeIPAは内部で389DSを使用しています。
LDAP周りはCentOS7からCentOS8へ移行する際に一番面倒なところだと思っており、自宅の環境もLDAPに関連するサーバーだけCentOS7にして、CentOS7/8の混在環境となっています。ですが、いつまでもCentOS7を使用していても面白くないので、そろそろ真剣にLDAPの移行も考えてみようと思い立ちました。
FreeIPAも中々よいのですが、DNS要件が厳しくて心が折れたので、最低限のLDAPの移行として、まずは389DSを構築してみようと思います。
モジュール有効化
[root@centos ~]# dnf module list 389-ds 1.4 389 Directory Server (base) [root@centos ~]# dnf module enable 389-ds
インストール
389-ds-base-legacy-toolsは、以降のsetup-ds.plを実行する際に必要です。
[root@centos ~]# dnf install 389-ds-base 389-ds-base-legacy-tools
hosts
389DSはLDAPサーバーですが、一丁前にきちんとFQDNで名前解決できることを要求してきます。別途DNSサーバーに書いておいても良いですが、hostsで済ます場合は下記の状態である必要があります。
ポイントは、FQDNが先頭であることと、127.0.0.1、::1は使えないので、389DSが外部と通信する際に使用するIPアドレスを使用することです。この辺は、変にこだわると先に進まないので、素直に従ったほうが賢いです。
ここでは、下記のパラメータとしました。
項目 | 内容 |
---|---|
ホスト名 | 389ds |
FQDN | 389ds.test.com |
IPアドレス | 192.168.0.100 |
[root@centos ~]# vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.100 389ds.test.com 389ds
セットアップ
初期設定用のスクリプトが用意されています。実行した出力結果をそのまま記載しています。Computer nameを手動で入力(FQDN)で入力した以外は全て規定値でエンターしています。
[root@centos ~]# setup-ds.pl
==============================================================================
This program will set up the 389 Directory Server.
It is recommended that you have "root" privilege to set up the software.
Tips for using this program:
- Press "Enter" to choose the default and go to the next screen
- Type "Control-B" or the word "back" then "Enter" to go back to the previous screen
- Type "Control-C" to cancel the setup program
Would you like to continue with set up? [yes]:
==============================================================================
Choose a setup type:
1. Express
Allows you to quickly set up the servers using the most
common options and pre-defined defaults. Useful for quick
evaluation of the products.
2. Typical
Allows you to specify common defaults and options.
3. Custom
Allows you to specify more advanced options. This is
recommended for experienced server administrators only.
To accept the default shown in brackets, press the Enter key.
Choose a setup type [2]:
==============================================================================
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
.
Example: eros.example.com.
To accept the default shown in brackets, press the Enter key.
Warning: This step may take a few minutes if your DNS servers
can not be reached or if DNS is not configured correctly. If
you would rather not wait, hit Ctrl-C and run this program again
with the following command line option to specify the hostname:
General.FullMachineName=your.hostname.domain.name
Computer name [389ds]: 389ds.test.com
==============================================================================
The server must run as a specific user in a specific group.
It is strongly recommended that this user should have no privileges
on the computer (i.e. a non-root user). The setup procedure
will give this user/group some permissions in specific paths/files
to perform server-specific operations.
If you have not yet created a user and group for the server,
create this user and group using your native operating
system utilities.
System User [dirsrv]:
System Group [dirsrv]:
==============================================================================
The standard directory server network port number is 389. However, if
you are not logged as the superuser, or port 389 is in use, the
default value will be a random unused port number greater than 1024.
If you want to use port 389, make sure that you are logged in as the
superuser, that port 389 is not in use.
Directory server network port [389]:
==============================================================================
Each instance of a directory server requires a unique identifier.
This identifier is used to name the various
instance specific files and directories in the file system,
as well as for other uses as a server instance identifier.
Directory server identifier [389ds]:
==============================================================================
The suffix is the root of your directory tree. The suffix must be a valid DN.
It is recommended that you use the dc=domaincomponent suffix convention.
For example, if your domain is example.com,
you should use dc=example,dc=com for your suffix.
Setup will create this initial suffix for you,
but you may have more than one suffix.
Use the directory server utilities to create additional suffixes.
Suffix [dc=test, dc=com]:
==============================================================================
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and typically has a
bind Distinguished Name (DN) of cn=Directory Manager.
You will also be prompted for the password for this user. The password must
be at least 8 characters long, and contain no spaces.
Press Control-B or type the word "back", then Enter to back up and start over.
Directory Manager DN [cn=Directory Manager]:
Password:
Password (confirm):
Your new DS instance '389ds' was successfully created.
Exiting . . .
Log file is '/tmp/setupxxxxxx.log'
起動
systemctlで起動できます。特にエラーなく起動しました。
[root@centos ~]# systemctl start dirsrv.target
netstat
netstatでlistenの状態をみると、なぜかtcp6でのみ389がlistenしています。
OpenLDAPの時もそうでしたが、どうもLDAPの構築は癖がありますね・・・。別の記事で調査しようと思います。
[root@centos ~]# netstat -taun
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::9090 :::* LISTEN
tcp6 0 0 :::389 :::* LISTEN
tcp6 0 0 :::5355 :::* LISTEN
udp 0 0 0.0.0.0:5355 0.0.0.0:*
udp 0 0 127.0.0.53:53 0.0.0.0:*
udp6 0 0 :::5355
追記:2020.8.13
netstatの表示はtcp6のみでしたが、後日確認したところ、ipv4で通信できる状態でした。
あらためて、こちらに整理しています。
この投稿は古い情報です。最新はこちらを参照して下さい。
https://www.si1230.com/?p=40633