dpkg-reconfigure slapd
memungkinkan Anda mengkonfigurasi ulang basis data LDAP dengan lebih banyak rincian:
falcot.com
".
dpkg-reconfigure slapd
tepat setelah instalasi awal.
$
ldapsearch -x -b dc=falcot,dc=com
# extended LDIF # # LDAPv3 # base <dc=falcot,dc=com> with scope sub # filter: (objectclass=*) # requesting: ALL # # falcot.com dn: dc=falcot,dc=com objectClass: top objectClass: dcObject objectClass: organization o: Falcot Corp dc: falcot # admin, falcot.com dn: cn=admin,dc=falcot,dc=com objectClass: simpleSecurityObject objectClass: organizationalRole cn: admin description: LDAP administrator # search result search: 2 result: 0 Success # numResponses: 3 # numEntries: 2
/etc/passwd
, /etc/group
, /etc/services
, /etc/hosts
, dan seterusnya), mengkonversi data ini dan menyuntikkan ke basis data LDAP.
/etc/migrationtools/migrate_common.ph
harus disunting; pilihan IGNORE_UID_BELOW
dan IGNORE_GID_BELOW
perlu diaktifkan (cukup dengan manghapus tanda komentar), dan DEFAULT_MAIL_DOMAIN
/DEFAULT_BASE
perlu diperbarui.
migrate_all_online.sh
, sebagai berikut:
#
cd /usr/share/migrationtools
#
LDAPADD="/usr/bin/ldapadd -c" ETC_ALIASES=/dev/null ./migrate_all_online.sh
migrate_all_online.sh
menanyakan beberapa pertanyaan tentang basis data LDAP tempat tujuan data akan dimigrasi. Tabel 11.1 meringkas jawaban yang diberikan dalam use-case Falcot.
Tabel 11.1. Jawaban atas pertanyaan yang diajukan oleh skrip migrate_all_online.sh
Pertanyaan | Jawaban |
---|---|
konteks penamaan X.500 | dc=falcot,dc=com |
Nama host server LDAP | localhost |
Manajer DN | cn=admin,dc=falcot,dc=com |
Kredensial Bind | kata sandi administratif |
Buat DUAConfigProfile | tidak |
/etc/aliases
, karena skema standar yang disediakan oleh Debian tidak termasuk struktur yang menggunakan skrip ini untuk menggambarkan alias email. Jika kita ingin mengintegrasikan data ini ke direktori, berkas /etc/ldap/schema/misc.schema
harus ditambahkan ke skema standar.
-c
untuk perintah ldapadd
; opsi ini meminta pengolahan tidak berhenti saat ada kesalahan. Penggunaan opsi ini diperlukan karena mengubah /etc/services
sering menghasilkan beberapa kesalahan yang aman untuk diabaikan.
Tabel 11.2. Mengatur konfigurasi paket libnss-ldap
Pertanyaan | Jawaban |
---|---|
Uniform Resource Identifier server LDAP | ldap://ldap.falcot.com |
Distinguished name dari basis pencarian | dc=falcot,dc=com |
Versi LDAP yang akan dipakai | 3 |
Apakah basis data LDAP memerlukan login? | tidak |
Hak LDAP khusus bagi root | ya |
Jadikan berkas konfigurasi hanya dapat dibaca/ditulisi oleh pemiliknya | tidak |
Akun LDAP untuk root | cn=admin,dc=falcot,dc=com |
Kata sandi akun root LDAP | kata sandi administratif |
/etc/nsswitch.conf
lalu perlu diubah, sehingga mengkonfigurasi NSS untuk menggunakan modul ldap
yang baru dipasang.
Contoh 11.26. Berkas /etc/nsswitch.conf
# /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file. passwd: ldap compat group: ldap compat shadow: ldap compat hosts: files dns ldap networks: ldap files protocols: ldap db files services: ldap db files ethers: ldap db files rpc: ldap db files netgroup: ldap files
ldap
biasanya dimasukkan sebelum yang lain, dan itu karena itu dikuiri pertama. Pengecualian adalah layanan hosts
karena menghubungi server LDAP membutuhkan terlebih dahulu konsultasi ke DNS (untuk me-resolve ldap.falcot.com
). Tanpa pengecualian ini, suatu kuiri nama host akan mencoba untuk bertanya ke server LDAP; ini akan memicu resolusi nama untuk server LDAP, dan seterusnya dalam suatu pengulangan tanpa ujung.
files
diabaikan), layanan dapat dikonfigurasi dengan sintaks berikut:
service: ldap [NOTFOUND=return] files
.
/etc/environment
dan /etc/default/locale
) yang akan memungkinkan aplikasi untuk melakukan otentikasi yang diperlukan terhadap basis data LDAP.
Tabel 11.3. Konfigurasi libpam-ldap
Pertanyaan | Jawaban |
---|---|
Izinkan akun admin LDAP untuk berperilaku seperti root lokal? | Ya. Hal ini memungkinkan menggunakan perintah passwd yang biasa untuk mengubah kata sandi yang disimpan dalam basis data LDAP. |
Apakah basis data LDAP memerlukan login? | tidak |
Akun LDAP untuk root | cn=admin,dc=falcot,dc=com |
Kata sandi akun root LDAP | kata sandi administratif basis data LDAP |
Algoritma enkripsi lokal yang digunakan untuk kata sandi | crypt |
/etc/pam.d/common-auth
, /etc/pam.d/common-password
, dan /etc/pam.d/common-account
. Mekanisme ini menggunakan alat khusus pam-auth-update
(yang disediakan oleh paket libpam-runtime). Alat ini juga dapat dijalankan oleh administrator jika mereka ingin mengaktifkan atau menonaktifkan modul PAM.
. /build-key-server ldap.falcot.com
mengajukan beberapa pertanyaan biasa (lokasi, nama organisasi, dan seterusnya). Jawaban untuk pertanyaan "common name" harus berupa fully-qualified hostname untuk server LDAP; dalam kasus kami, ldap.falcot.com
.
keys/ldap.falcot.com.crt
; kunci privat disimpan dalam keys/ldap.falcot.com.key
.
openldap
:
#
adduser openldap ssl-cert
Adding user `openldap' to group `ssl-cert' ... Adding user openldap to group ssl-cert Done. #
mv keys/ldap.falcot.com.key /etc/ssl/private/ldap.falcot.com.key
#
chown root:ssl-cert /etc/ssl/private/ldap.falcot.com.key
#
chmod 0640 /etc/ssl/private/ldap.falcot.com.key
#
mv newcert.pem /etc/ssl/certs/ldap.falcot.com.pem
slapd
juga perlu diberitahu untuk menggunakan kunci-kunci ini untuk enkripsi. Konfigurasi server LDAP dikelola secara dinamis: konfigurasi dapat diperbarui dengan operasi LDAP normal pada hirarki objek cn=config
, dan server memperbarui /etc/ldap/slapd.d
secara real time untuk membuat konfigurasi persisten. ldapmodify
adalah alat yang tepat untuk memperbarui konfigurasi:
Contoh 11.27. Mengkonfigurasi slapd
untuk enkripsi
#
cat >ssl.ldif <<END dn: cn=config changetype: modify add: olcTLSCertificateFile olcTLSCertificateFile: /etc/ssl/certs/ldap.falcot.com.pem - add: olcTLSCertificateKeyFile olcTLSCertificateKeyFile: /etc/ssl/private/ldap.falcot.com.key - END
#
ldapmodify -Y EXTERNAL -H ldapi:/// -f 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"
SLAPD_SERVICES
di berkas /etc/default/slapd
. Kami akan bermain aman dan menonaktifkan LDAP tidak aman sama sekali.
Contoh 11.28. Berkas /etc/default/slapd
# Default location of the slapd.conf file or slapd.d cn=config directory. If # empty, use the compiled-in default (/etc/ldap/slapd.d with a fallback to # /etc/ldap/slapd.conf). SLAPD_CONF= # System account to run the slapd server under. If empty the server # will run as root. SLAPD_USER="openldap" # System group to run the slapd server under. If empty the server will # run in the primary group of its user. SLAPD_GROUP="openldap" # Path to the pid file of the slapd server. If not set the init.d script # will try to figure it out from $SLAPD_CONF (/etc/ldap/slapd.conf by # default) SLAPD_PIDFILE= # slapd normally serves ldap only on all TCP-ports 389. slapd can also # service requests on TCP-port 636 (ldaps) and requests via unix # sockets. # Example usage: # SLAPD_SERVICES="ldap://127.0.0.1:389/ ldaps:/// ldapi:///" SLAPD_SERVICES="ldaps:/// ldapi:///" # If SLAPD_NO_START is set, the init script will not start or restart # slapd (but stop will still work). Uncomment this if you are # starting slapd via some other means or if you don't want slapd normally # started at boot. #SLAPD_NO_START=1 # If SLAPD_SENTINEL_FILE is set to path to a file and that file exists, # the init script will not start or restart slapd (but stop will still # work). Use this for temporarily disabling startup of slapd (when doing # maintenance, for example, or through a configuration management system) # when you don't want to edit a configuration file. SLAPD_SENTINEL_FILE=/etc/ldap/noslapd # For Kerberos authentication (via SASL), slapd by default uses the system # keytab file (/etc/krb5.keytab). To use a different keytab file, # uncomment this line and change the path. #export KRB5_KTNAME=/etc/krb5.keytab # Opsi tambahan yang diangsurkan ke slapd SLAPD_OPTIONS=""
ldaps://
.
/usr/local/share/ca-certificates
dan menjalankan update-ca-certificates
.
#
cp keys/ca.crt /usr/local/share/ca-certificates/falcot.crt
#
update-ca-certificates
Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d.... Adding debian:falcot.pem done. done.
/etc/ldap/ldap.conf
. Ini akan banyak menghemat pengetikan.
Contoh 11.29. Berkas /etc/ldap/ldap.conf
# # Default LDAP # # Lihat ldap.conf(5) untuk rincian # Berkas ini mesti dapat dibaca oleh siapapun tapi tidak dapat ditulisi oleh semua orang. BASE dc=falcot,dc=com URI ldaps://ldap.falcot.com #SIZELIMIT 12 #TIMELIMIT 15 #DEREF never # sertifikat TLS (diperlukan untuk GnuTLS) TLS_CACERT /etc/ssl/certs/ca-certificates.crt