Debian 11 Bullseye
Sponsored Link

OpenLDAP : LDAP over SSL/TLS2021/09/02

 
LDAP over SSL/TLS を設定し、LDAP サーバーとクライアント間の通信をよりセキュアにします。
[1]
[2] LDAP サーバー側で [1] で作成した証明書をコピーして SSL/TLS の設定をします。
root@dlp:~#
cp /etc/ssl/private/server.key \
/etc/ssl/private/server.crt \
/etc/ssl/certs/ca-certificates.crt \
/etc/ldap/sasl2/

root@dlp:~#
chown openldap. /etc/ldap/sasl2/server.key \
/etc/ldap/sasl2/server.crt \
/etc/ldap/sasl2/ca-certificates.crt
root@dlp:~#
vi mod_ssl.ldif
# 新規作成

dn: cn=config
changetype: modify
add: olcTLSCACertificateFile
olcTLSCACertificateFile: /etc/ldap/sasl2/ca-certificates.crt
-
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/ldap/sasl2/server.crt
-
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/ldap/sasl2/server.key

root@dlp:~#
ldapmodify -Y EXTERNAL -H ldapi:/// -f mod_ssl.ldif

SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "cn=config"

root@dlp:~#
systemctl restart slapd
[3] LDAP クライアント側の設定です。
通信内容が正常に暗号化されているかを確認する場合は、サーバー側で tcpdump 等を活用するとよいでしょう。
root@node01:~#
vi /etc/nslcd.conf
# 29行目 : 追記

ssl start_tls
tls_reqcert allow
root@node01:~#
systemctl restart nslcd

root@node01:~#
exit
node01 login: bullseye     # LDAP 登録ユーザー
Password:
Linux node01.srv.world 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Sep  2 16:28:04 JST 2021 on ttyS0
bullseye@node01:~$      # ログインできた
関連コンテンツ