389ds導入設定~その1~

基本情報

ノード構成

  • Primary Node: ldap01
  • Secondary Node: ldap02

普段使いはDebianかUbuntuだけど、RHEL9でも応用が効くように今回はAlmaLinux9を使用。

どちらもDNSにAとAAAAレコードを登録して、IPv4/v6両方で名前解決できるようにローカルのunboundに登録

双方向でレプリケーション取れるように設定してあるので、正確にはどちらがPrimaryとかはない

ldap基本構成

  • BaseDN: dc=taruki,dc=com

SSL証明書: ACMEv2でLet’sEncryptも考えたけど、面倒だったのでオレオレで有効期限50年

インストール

epelから導入


dnf -y install epel-release
dnf copr enable @389ds/389-directory-server
dnf install -y 389-ds-base 389-ds-base-libs sssd sssd-tools sssd-ldap authselect oddjob-mkhomedir cockpit-389-ds

memberofプラグインの有効化

dsconf localhost plugin memberof enable

テンプレートから基本設定


dscreate create-template template.txt

テンプレートを以下のように編集

25c25
< ;full_machine_name = ldap01 --- > full_machine_name = ldap01
41c41
< ;instance_name = localhost --- > instance_name = localhost
51c51
< ;port = 389 --- > port = 389
56c56
< ;root_password = Directory_Manager_Password --- > root_password = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
61c61
< ;secure_port = 636 --- > secure_port =
636
66c66
< ;self_sign_cert = True — > self_sign_cert = True
71c71
< ;self_sign_cert_valid_months = 24 — > self_sign_cert_valid_months = 600
87c87
< ;create_suffix_entry = False — > create_suffix_entry = True
92c92
< ;enable_replication = False — > enable_replication = True
97c97
< ;replica_binddn = cn=replication manager,cn=config — > replica_binddn = cn=replication manager,cn=config
107c107
< ;replica_bindpw = — > replica_bindpw = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
112c112
< ;replica_id = 1 — > replica_id = 1
117c117
< ;replica_role = supplier — > replica_role = supplier
132c132
< ;suffix = — > suffix = dc=taruki,dc=com

テンプレートを適用

dscreate from-file template.txt

systemd設定

systemctl enable --now dirsrv@localhost.service

firewalld設定


firewall-cmd --add-service=ldap
firewall-cmd --add-service=ldaps
firewall-cmd --add-service=http
firewall-cmd --add-service=ldap --permanent
firewall-cmd --add-service=ldaps --permanent
firewall-cmd --add-service=http --permanent

上記をldap01とldap02にそれぞれ設定

レプリケーション設定

レプリケーション合意の設定(ldap01→ldap02の例、ldap02→ldap01も同様に設定する)

sudo dsconf localhost repl-agmt \
create --suffix="dc=taruki,dc=com" --host="ldap02.i.taruki.com" --port=389 \
--conn-protocol=LDAP --bind-dn="cn=replication manager,cn=config" \
--bind-passwd="yyyyyyyyyyyyyyyyyyyyyyy" --bind-method=SIMPLE --init \
agreement-supplier1-to-supplier2

レプリケーション監視

dsctl localhost healthcheck --check replication
長くなりそうなので、いったんここまで