Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:ldap:ldaps [10.11.2011 20:38. ] – angelegt django | centos:ldap:ldaps [20.04.2018 10:49. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Absicherung des OpenLDAP-Servers - LDAPS-Konfiguration ====== | ||
+ | {{: | ||
+ | |||
+ | |||
+ | Damit unser [[http:// | ||
+ | |||
+ | ===== Zertifikatserstellung ===== | ||
+ | Für unseren OpenLDAP-Server werden wir ein Zertifikat von der freien Community-Zertifizierungsstelle [[http:// | ||
+ | Die grundlegende Herangehensweise ist dabei die gleiche; wir werden uns bei der weiteren Betrachtung daher auf die CAcert-Variante beziehen. | ||
+ | |||
+ | ==== privaten Schlüssel generieren ==== | ||
+ | Als erstes generieren wir uns einen privaten Schlüssel. | ||
+ | # openssl genrsa -out / | ||
+ | |||
+ | | ||
+ | | ||
+ | ..+++ | ||
+ | e is 65537 (0x10001) | ||
+ | |||
+ | Über die Dateiberechtigung schützen wir die Datei vor fremden Blicken. | ||
+ | # chmod 400 / | ||
+ | |||
+ | Bei Bedarf kann man mit **openssl rsa -in < | ||
+ | # openssl rsa -in / | ||
+ | |||
+ | |||
+ | ==== Zertifikatsregistrierungsanforderung ==== | ||
+ | Damit von [[https:// | ||
+ | # openssl req -new -key / | ||
+ | <code bash>You are about to be asked to enter information that will be incorporated | ||
+ | into your certificate request. | ||
+ | What you are about to enter is what is called a Distinguished Name or a DN. | ||
+ | There are quite a few fields but you can leave some blank | ||
+ | For some fields there will be a default value, | ||
+ | If you enter ' | ||
+ | ----- | ||
+ | Country Name (2 letter code) [XX]:DE | ||
+ | State or Province Name (full name) []:Bayern | ||
+ | Locality Name (eg, city) [Default City]: | ||
+ | Organization Name (eg, company) [Default Company Ltd]:Nausch | ||
+ | Organizational Unit Name (eg, section) []:. | ||
+ | Common Name (eg, your name or your server' | ||
+ | Email Address []: | ||
+ | |||
+ | Please enter the following ' | ||
+ | to be sent with your certificate request | ||
+ | A challenge password []: | ||
+ | An optional company name []: | ||
+ | </ | ||
+ | Auch hier passen wir die Dateiberechtigung des gerade erstellten CSR((**C**ertificate **S**igning **R**equest)) an. | ||
+ | # chmod 400 / | ||
+ | |||
+ | Den Inhalt unseres CSR, der gerade erstellten Datei, geben wir dann auf der Seite von [[https:// | ||
+ | |||
+ | Bei Bedarf können wir uns den Inhalt unseres **CSR** in lesbarer Form ausgeben lassen. | ||
+ | # openssl req -noout -text -in / | ||
+ | |||
+ | ==== CAcert Server-Zertifikat ==== | ||
+ | Von [[https:// | ||
+ | # vim / | ||
+ | |||
+ | Anschließend passen wir auch hier die Dateiberechtigungen an. | ||
+ | # chmod 400 / | ||
+ | |||
+ | Den Inhalt unseres CAcert-Zertifikates können wir mit folgenden Befehlsaufrufes lesbar ausgeben lassen. | ||
+ | # openssl req -noout -text -in / | ||
+ | |||
+ | ==== CAcert Root-Zertifikat ==== | ||
+ | Von [[https:// | ||
+ | # wget http:// | ||
+ | |||
+ | Anschließend überprüfen wir den Fingerprint des heruntergeladenen Root-Zertifikates. | ||
+ | # openssl x509 -noout -fingerprint -in / | ||
+ | |||
+ | SHA1 Fingerprint=13: | ||
+ | |||
+ | Diesen vergleichen wir mit den Angaben auf der Webseite von [[https:// | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | ==== Schlüsseldateien ablegen ==== | ||
+ | Für unsere OpenLDAP-Installation legen wir uns am besten einen eigenen Unterordner unter **/ | ||
+ | # mkdir -p / | ||
+ | |||
+ | # mkdir -p / | ||
+ | |||
+ | Anschließend legen wir dort die drei benötigten Dateien ab: | ||
+ | - unseren // | ||
+ | - unseren // | ||
+ | - das // | ||
+ | |||
+ | Abschließend passen wir noch die Datei- und Nutzerberechtigungen an. | ||
+ | - < | ||
+ | - < | ||
+ | |||
+ | |||
+ | ==== Anpassen der / | ||
+ | Damit unser OpenLDAP-Server zukünftig LDAPS auf Port **636** unter **IPv4** zur verfügung stellen kann, bearbeiten wir nun die systemweite Konfigurationsdatei. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Options of slapd (see man slapd) | ||
+ | # | ||
+ | # Django : 2011-11-11 LDAPs - Konfiguration | ||
+ | # default : SLAPD_OPTIONS= | ||
+ | # Nur IPv4 Unterstützung aktiviert | ||
+ | SLAPD_OPTIONS=" | ||
+ | |||
+ | # options of slurpd (see man slurpd) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # At least one of SLAPD_LDAP, SLAPD_LDAPI and SLAPD_LDAPS must be set to ' | ||
+ | # | ||
+ | # Run slapd with -h "... ldap:/// ..." | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Run slapd with -h "... ldapi:/// ..." | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Run slapd with -h "... ldaps:/// ..." | ||
+ | # | ||
+ | # | ||
+ | # Django : 2011-11-11 LDAPs - Konfiguration | ||
+ | # default : SLAPD_LDAPS=no | ||
+ | SLAPD_LDAPS=yes | ||
+ | |||
+ | # Run slapd with -h "... $SLAPD_URLS ..." | ||
+ | # This option could be used instead of previous three ones, but: | ||
+ | # - it doesn' | ||
+ | # - it isn't overwritten by settings of $SLAPD_LDAP, | ||
+ | # example: SLAPD_URLS=" | ||
+ | # default: empty | ||
+ | # | ||
+ | |||
+ | # Maximum allowed time to wait for slapd shutdown on ' | ||
+ | # | ||
+ | |||
+ | # Parameters to ulimit called right before starting slapd | ||
+ | # - use this to change system limits for slapd | ||
+ | # | ||
+ | |||
+ | </ | ||
+ | Nähere Informationen zu den möglichen Parametern entnehmen wir der zugehörigen Manpage. | ||
+ | # man slapd | ||
+ | |||
+ | ==== LDAPS Konfiguration .LDIF ==== | ||
+ | Da wir unsere Konfiguration des OpenLDAP-Servers mit Hilfe von **.LDIF**-Datreien realisiert haben, werden wir nun eine passende **.LDIF**-Datei erstellen und diese anschließend in das System importieren. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | dn: cn=config | ||
+ | changetype: modify | ||
+ | add: olcTLSCipherSuite | ||
+ | olcTLSCipherSuite: | ||
+ | - | ||
+ | add: olcTLSCertificateFile | ||
+ | olcTLSCertificateFile: | ||
+ | - | ||
+ | add: olcTLSCertificateKeyFile | ||
+ | olcTLSCertificateKeyFile: | ||
+ | - | ||
+ | add: olcTLSCACertificateFile | ||
+ | olcTLSCACertificateFile: | ||
+ | </ | ||
+ | |||
+ | Anschließend importieren wir unsere **LDIF**-Konfigurationsdatei in den laufenden OpenLDAP-Server | ||
+ | # ldapmodify -W -x -D cn=config -f / | ||
+ | |||
+ | Enter LDAP Password: | ||
+ | | ||
+ | |||
+ | Mit einer LDAP-Suche im OpenLDAP-Server mit dem // | ||
+ | # ldapsearch -W -x -D cn=config -b cn=config " | ||
+ | <code bash> | ||
+ | Enter LDAP Password: | ||
+ | # extended LDIF | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=olcGlobal) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # config | ||
+ | dn: cn=config | ||
+ | objectClass: | ||
+ | cn: config | ||
+ | olcConfigFile: | ||
+ | olcConfigDir: | ||
+ | olcAllows: bind_v2 | ||
+ | olcArgsFile: | ||
+ | olcAttributeOptions: | ||
+ | olcAuthzPolicy: | ||
+ | olcConcurrency: | ||
+ | olcConnMaxPending: | ||
+ | olcConnMaxPendingAuth: | ||
+ | olcDisallows: | ||
+ | olcGentleHUP: | ||
+ | olcIdleTimeout: | ||
+ | olcIndexSubstrIfMaxLen: | ||
+ | olcIndexSubstrIfMinLen: | ||
+ | olcIndexSubstrAnyLen: | ||
+ | olcIndexSubstrAnyStep: | ||
+ | olcIndexIntLen: | ||
+ | olcLocalSSF: | ||
+ | olcLogLevel: | ||
+ | olcPidFile: / | ||
+ | olcReadOnly: | ||
+ | olcReferral: | ||
+ | olcRequires: | ||
+ | olcReverseLookup: | ||
+ | olcSaslSecProps: | ||
+ | olcSockbufMaxIncoming: | ||
+ | olcSockbufMaxIncomingAuth: | ||
+ | olcThreads: 16 | ||
+ | olcTLSCRLCheck: | ||
+ | olcTLSVerifyClient: | ||
+ | olcToolThreads: | ||
+ | olcWriteTimeout: | ||
+ | olcTLSCipherSuite: | ||
+ | olcTLSCertificateFile: | ||
+ | olcTLSCertificateKeyFile: | ||
+ | olcTLSCACertificateFile: | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1 | ||
+ | </ | ||
+ | |||
+ | ==== Aktivierung der OpenLDAP-Konfiguration ==== | ||
+ | Damit nun unser OpenLDAP-server auch wirklich LDAPS sprechen kann müssen wir diesen nun einmal durchstarten. | ||
+ | # service slapd restart | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | Ob nun der OpenLDAP-Server auch auf den beiden Ports **389** und **636** lauscht überprüfen wir mit Hilfe des Programmes **netstat**. | ||
+ | # netstat -tulpen | grep slapd | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | Unser verwendetes [[https:// | ||
+ | # openssl s_client -connect ldap.dmz.nausch.org: | ||
+ | <code bash> | ||
+ | CONNECTED(00000003) | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | depth=1 O = Root CA, OU = http:// | ||
+ | verify return:1 | ||
+ | depth=0 CN = ldap.dmz.nausch.org | ||
+ | verify return:1 | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | SSL_connect: | ||
+ | --- | ||
+ | Certificate chain | ||
+ | 0 s:/ | ||
+ | | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | MIIE4TCCAsmgAwIBAgIDCvFhMA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv | ||
+ | b3QgQ0ExHjAcBgNVBAsTFWh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uD0dOOuDi4fIhXyXjfPGYJ3hI5TYTH7eU2bv+2egNr0dnrgOZPgN9ql1yP | ||
+ | H7moM+8I7zMYrISUzjGdvJNpXIXQlvu/ | ||
+ | jcKNvnhOPLtcy5C7L0HfYfjNvYMDGFhBgho74mX5Z7qkQw6chQwdSoDENsHxdQOa | ||
+ | AkGjubQ6wEaI36BN4IG7zu4nSI1sn0r76JBOeeAglLJnGT7+y0CPnExuo/ | ||
+ | N4S6BlSKHU0vvfk3FxEQZ3osV0aIzr+8qPTK7CmsDLplZfvvUiWJ8XduutiBvmSe | ||
+ | AWX0dufY8AtlyoGTZRSGo3dvLK1rxvElxRQrFP2y7HN7NhMl2MjyHRW92nJoet4H | ||
+ | RnL+mEZW0FmLYPD/ | ||
+ | Pj32C6BqHcWBpUWddyF3hAzLolNmgWYZnCXru0GDJ/ | ||
+ | T1CdPEwqXapAvRxcerm6xUHomoBrm5Rp+yTnbOoL4CPhuT8bNJimazTFTaNZRfP4 | ||
+ | g5lnaak= | ||
+ | -----END CERTIFICATE----- | ||
+ | 1 s:/O=Root CA/ | ||
+ | | ||
+ | -----BEGIN CERTIFICATE----- | ||
+ | MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290 | ||
+ | IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB | ||
+ | IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA | ||
+ | Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO | ||
+ | BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi | ||
+ | MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ | ||
+ | ARYSc3Vw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ybDA0BglghkgBhvhCAQgEJxYl | ||
+ | aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC | ||
+ | AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg | ||
+ | b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB | ||
+ | ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc | ||
+ | nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg | ||
+ | 18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/ | ||
+ | gr/ | ||
+ | Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY | ||
+ | sONvRUgzEv/ | ||
+ | SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/ | ||
+ | CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/ | ||
+ | GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk | ||
+ | zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/ | ||
+ | omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD | ||
+ | -----END CERTIFICATE----- | ||
+ | --- | ||
+ | Server certificate | ||
+ | subject=/ | ||
+ | issuer=/ | ||
+ | --- | ||
+ | No client certificate CA names sent | ||
+ | --- | ||
+ | SSL handshake has read 3445 bytes and written 439 bytes | ||
+ | --- | ||
+ | New, TLSv1/ | ||
+ | Server public key is 2048 bit | ||
+ | Secure Renegotiation IS supported | ||
+ | Compression: | ||
+ | Expansion: zlib compression | ||
+ | SSL-Session: | ||
+ | Protocol | ||
+ | Cipher | ||
+ | Session-ID: 9501557C4CDF9E555B52430A74226B9E2C8F28C4DCC81786E8BC092BB4694CD7 | ||
+ | Session-ID-ctx: | ||
+ | Master-Key: C17E92622EF087873AB9D3D13AAE9DB96D41491C2D97CBA0B95F0FF16A219FE51AF3A559E7AE1666FAD5B54602EE4778 | ||
+ | Key-Arg | ||
+ | Krb5 Principal: None | ||
+ | PSK identity: None | ||
+ | PSK identity hint: None | ||
+ | TLS session ticket: | ||
+ | 0000 - 89 36 bc f1 45 7d 8b de-23 88 7b 01 2e ba e6 8b | ||
+ | 0010 - 38 72 be ca c8 37 cf e0-56 16 eb 8f be 54 f3 91 | ||
+ | 0020 - 7e c6 f6 eb 1a 82 b8 87-8b 5c 10 ef 2c 4a 8b ef | ||
+ | 0030 - cc 55 03 dd 6b 25 77 7e-81 68 c7 f2 01 fc 23 e2 | ||
+ | 0040 - 98 88 8b a7 69 e6 79 6b-ae ae 77 54 f2 7e ab 54 | ||
+ | 0050 - 70 e1 5a 31 98 b9 dd 42-4a 64 cd 2f e6 d5 2f 77 | ||
+ | 0060 - 0d 6d 5f 44 c0 bc fa 85-9b 38 ba 53 68 06 4c fe | ||
+ | 0070 - 41 93 80 28 af 56 0a ed-47 2b 89 32 b9 65 34 0c | ||
+ | 0080 - d8 00 a4 86 b8 db d3 40-33 0e 3c db 97 ed 01 2b | ||
+ | 0090 - f1 92 fe ea a0 d2 03 4d-11 b8 90 fb a7 be c6 5a | ||
+ | 00a0 - 3a aa b7 54 f8 fd 70 18-df 1e 36 40 4e 97 02 12 : | ||
+ | |||
+ | Compression: | ||
+ | Start Time: 1321002877 | ||
+ | Timeout | ||
+ | Verify return code: 0 (ok) | ||
+ | --- | ||
+ | SSL3 alert read: | ||
+ | closed | ||
+ | SSL3 alert write: | ||
+ | </ | ||
+ | ==== Anpassen der / | ||
+ | Für die Konfiguration des LADP-Clients auf dem Server, erweitern wir die betreffende Konfigurationsdatei im Verzeichnis // | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # | ||
+ | # LDAP Defaults | ||
+ | # | ||
+ | |||
+ | # See ldap.conf(5) for details | ||
+ | # This file should be world readable but not world writable. | ||
+ | |||
+ | #BASE | ||
+ | #URI ldap:// | ||
+ | |||
+ | # Django: 2011-10-26 | ||
+ | BASE dc=nausch, dc=org | ||
+ | # Anfragen werden unterhalb von dc=nausch, dc=org ausgeführt. | ||
+ | URI | ||
+ | |||
+ | # Django: 2011-11-11 LDAPs Konfigiuration | ||
+ | # TLS_REQCERT allow | ||
+ | # Specifies what checks to perform on server certificates in a TLS session, if any. | ||
+ | # The server certificate is requested. If no certificate is provided, the session proceeds normally. If a bad | ||
+ | # certificate is provided, it will be ignored and the session proceeds normally. | ||
+ | |||
+ | TLS_REQCERT allow | ||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | ===== Konfigurationstest ===== | ||
+ | Nun ist es an der Zeit unsere erste Suchanfrage über unseren neu geschaffenen verschlüsselten Weg an unseren OpenLDAP-Server zu richten: | ||
+ | # ldapsearch -x -LLL -H ldaps:// | ||
+ | <code bash> | ||
+ | dn: uid=django, | ||
+ | uid: django | ||
+ | cn: Django | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | objectClass: | ||
+ | userPassword:: | ||
+ | | ||
+ | shadowLastChange: | ||
+ | shadowMin: 0 | ||
+ | shadowMax: 99999 | ||
+ | shadowWarning: | ||
+ | loginShell: /bin/bash | ||
+ | uidNumber: 500 | ||
+ | gidNumber: 500 | ||
+ | homeDirectory: | ||
+ | gecos: Django | ||
+ | </ | ||
+ | |||
+ | Im LDAP-Log wird unsere erfolgreiche // | ||
+ | # tail -f / | ||
+ | <code bash> | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | Nov 11 10:21:12 vml000030 slapd[27311]: | ||
+ | </ | ||
+ | ===== Clientkonfiguration (LDAPS Auth mit techn. User) ===== | ||
+ | Bei der Absicherung unserer Clientabfragen mittels TLS setzen wir auf unsere bereits [[centos: | ||
+ | |||
+ | Die abschließende Konfiguration nehmen wir mit Hilfe vom **system-config-authentication** vor. | ||
+ | # system-config-authentication | ||
+ | |||
+ | In dem folgendem Fenster aktivieren wir erst einmal die notwendige TLS-Verschlüsselung, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Als nächstes müssen wir noch das Rootzertifikat der //CA// herunterladen, | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Dort tragen wir die URL des [[http:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Abschließend verlassen wir das Konfigurationsfenster in dem wir die Schaltfläche **__A__pply** anwählen. | ||
+ | |||
+ | Mit Hilfe eines geschickten Find-Befehles ermitteln wir nun, welche Konfigurationsdateien durch die vorangegangene Konfiguration in der GUI von **system-config-authentication** angetastet wurden. | ||
+ | |||
+ | # find -type f -printf ' | ||
+ | <code bash> | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.11 ./ | ||
+ | 2011.11.10 ./ | ||
+ | 2011.11.10 ./ | ||
+ | </ | ||
+ | |||
+ | ==== pam_ldap.conf ==== | ||
+ | In der Konfigurationsdatei // | ||
+ | * **binddn dc=nausch, | ||
+ | * **bindpw Klaus-ist-der-groesste!** | ||
+ | * **uri ldap:// | ||
+ | * **ssl start_tls** | ||
+ | * **tls_cacertdir / | ||
+ | * **pam_password sha512** | ||
+ | |||
+ | Zur Bearbeitung der Konfigurationsdatei nutzen wir wie so oft immer unseren Editor der Wahl **vim**. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # @(#)$Id: ldap.conf,v 1.38 2006/05/15 08:13:31 lukeh Exp $ | ||
+ | # | ||
+ | # This is the configuration file for the LDAP nameservice | ||
+ | # switch library and the LDAP PAM module. | ||
+ | # | ||
+ | # The man page for this file is pam_ldap(5) | ||
+ | # | ||
+ | # PADL Software | ||
+ | # http:// | ||
+ | # | ||
+ | |||
+ | # Your LDAP server. Must be resolvable without using LDAP. | ||
+ | # Multiple hosts may be specified, each separated by a | ||
+ | # space. How long nss_ldap takes to failover depends on | ||
+ | # whether your LDAP client library supports configurable | ||
+ | # network or connect timeouts (see bind_timelimit). | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client-Authentication | ||
+ | # default : host 127.0.0.1 | ||
+ | |||
+ | # The distinguished name of the search base. | ||
+ | # Django : 2011-11-10 LDAP Client-Authentication | ||
+ | # base dc=example, | ||
+ | binddn dc=nausch, | ||
+ | |||
+ | # Another way to specify your LDAP server is to provide an | ||
+ | # uri with the server name. This allows to use | ||
+ | # Unix Domain Sockets to connect to a local LDAP Server. | ||
+ | #uri ldap:// | ||
+ | #uri ldaps:// | ||
+ | #uri ldapi:// | ||
+ | # Note: %2f encodes the '/' | ||
+ | |||
+ | # The LDAP version to use (defaults to 3 | ||
+ | # if supported by client library) | ||
+ | # | ||
+ | |||
+ | # The distinguished name to bind to the server with. | ||
+ | # Optional: default is to bind anonymously. | ||
+ | #binddn cn=proxyuser, | ||
+ | |||
+ | # The credentials to bind with. | ||
+ | # Optional: default is no credential. | ||
+ | #bindpw secret | ||
+ | # Django : 2011-11-10 LDAP Client-Authentication | ||
+ | bindpw Klaus-ist-der-groesste! | ||
+ | |||
+ | # The distinguished name to bind to the server with | ||
+ | # if the effective user ID is root. Password is | ||
+ | # stored in / | ||
+ | #rootbinddn cn=manager, | ||
+ | |||
+ | # The port. | ||
+ | # Optional: default is 389. | ||
+ | #port 389 | ||
+ | |||
+ | # The search scope. | ||
+ | #scope sub | ||
+ | #scope one | ||
+ | #scope base | ||
+ | |||
+ | # Search timelimit | ||
+ | #timelimit 30 | ||
+ | |||
+ | # Bind/ | ||
+ | # | ||
+ | |||
+ | # Reconnect policy: hard (default) will retry connecting to | ||
+ | # the software with exponential backoff, soft will fail | ||
+ | # immediately. | ||
+ | # | ||
+ | |||
+ | # Idle timelimit; client will close connections | ||
+ | # (nss_ldap only) if the server has not been contacted | ||
+ | # for the number of seconds specified below. | ||
+ | # | ||
+ | |||
+ | # Filter to AND with uid=%s | ||
+ | #pam_filter objectclass=account | ||
+ | |||
+ | # The user ID attribute (defaults to uid) | ||
+ | # | ||
+ | |||
+ | # Search the root DSE for the password policy (works | ||
+ | # with Netscape Directory Server) | ||
+ | # | ||
+ | |||
+ | # Check the ' | ||
+ | # Default is no; if set to yes, and user has no | ||
+ | # value for the host attribute, and pam_ldap is | ||
+ | # configured for account management (authorization) | ||
+ | # then the user will not be allowed to login. | ||
+ | # | ||
+ | |||
+ | # Check the ' | ||
+ | # control | ||
+ | # Default is no; if set to yes, and the user has no | ||
+ | # value for the authorizedService attribute, and | ||
+ | # pam_ldap is configured for account management | ||
+ | # (authorization) then the user will not be allowed | ||
+ | # to login. | ||
+ | # | ||
+ | |||
+ | # Group to enforce membership of | ||
+ | # | ||
+ | |||
+ | # Group member attribute | ||
+ | # | ||
+ | |||
+ | # Specify a minium or maximum UID number allowed | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Template login attribute, default template user | ||
+ | # (can be overriden by value of former attribute | ||
+ | # in user's entry) | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # HEADS UP: the pam_crypt, pam_nds_passwd, | ||
+ | # and pam_ad_passwd options are no | ||
+ | # longer supported. | ||
+ | # | ||
+ | # Do not hash the password at all; presume | ||
+ | # the directory server will do it, if | ||
+ | # necessary. This is the default. | ||
+ | # | ||
+ | |||
+ | # Hash password locally; required for University of | ||
+ | # Michigan LDAP server, and works with Netscape | ||
+ | # Directory Server if you're using the UNIX-Crypt | ||
+ | # hash mechanism and not using the NT Synchronization | ||
+ | # service. | ||
+ | # | ||
+ | |||
+ | # Remove old password first, then update in | ||
+ | # cleartext. Necessary for use with Novell | ||
+ | # Directory Services (NDS) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # RACF is an alias for the above. For use with | ||
+ | # IBM RACF | ||
+ | # | ||
+ | |||
+ | # Update Active Directory password, by | ||
+ | # creating Unicode password and updating | ||
+ | # unicodePwd attribute. | ||
+ | # | ||
+ | |||
+ | # Use the OpenLDAP password change | ||
+ | # extended operation to update the password. | ||
+ | # | ||
+ | |||
+ | # Redirect users to a URL or somesuch on password | ||
+ | # changes. | ||
+ | # | ||
+ | |||
+ | # RFC2307bis naming contexts | ||
+ | # Syntax: | ||
+ | # nss_base_XXX | ||
+ | # where scope is {base, | ||
+ | # and filter is a filter to be &' | ||
+ | # default filter. | ||
+ | # You can omit the suffix eg: | ||
+ | # nss_base_passwd | ||
+ | # to append the default base DN but this | ||
+ | # may incur a small performance impact. | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # attribute/ | ||
+ | # Syntax: | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # configure --enable-nds is no longer supported. | ||
+ | # NDS mappings | ||
+ | # | ||
+ | |||
+ | # Services for UNIX 3.5 mappings | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #pam_filter objectclass=User | ||
+ | # | ||
+ | |||
+ | # configure --enable-mssfu-schema is no longer supported. | ||
+ | # Services for UNIX 2.0 mappings | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #pam_filter objectclass=User | ||
+ | # | ||
+ | |||
+ | # RFC 2307 (AD) mappings | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #pam_filter objectclass=User | ||
+ | # | ||
+ | |||
+ | # configure --enable-authpassword is no longer supported | ||
+ | # AuthPassword mappings | ||
+ | # | ||
+ | |||
+ | # AIX SecureWay mappings | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #pam_filter objectclass=aixAccount | ||
+ | # | ||
+ | |||
+ | # Netscape SDK LDAPS | ||
+ | #ssl on | ||
+ | |||
+ | # Netscape SDK SSL options | ||
+ | #sslpath / | ||
+ | |||
+ | # OpenLDAP SSL mechanism | ||
+ | # start_tls mechanism uses the normal LDAP port, LDAPS typically 636 | ||
+ | #ssl start_tls | ||
+ | #ssl on | ||
+ | |||
+ | # OpenLDAP SSL options | ||
+ | # Require and verify server certificate (yes/no) | ||
+ | # Default is to use libldap' | ||
+ | # / | ||
+ | # OpenLDAP 2.0 and earlier is " | ||
+ | # | ||
+ | |||
+ | # CA certificates for server certificate verification | ||
+ | # At least one of these are required if tls_checkpeer is " | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Seed the PRNG if / | ||
+ | # | ||
+ | |||
+ | # SSL cipher suite | ||
+ | # See man ciphers for syntax | ||
+ | # | ||
+ | |||
+ | # Client certificate and key | ||
+ | # Use these, if your server requires client authentication. | ||
+ | #tls_cert | ||
+ | #tls_key | ||
+ | |||
+ | # Disable SASL security layers. This is needed for AD. | ||
+ | # | ||
+ | |||
+ | # Override the default Kerberos ticket cache location. | ||
+ | # | ||
+ | |||
+ | # SASL mechanism for PAM authentication - use is experimental | ||
+ | # at present and does not support password policy control | ||
+ | # | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client-Authentication, | ||
+ | uri ldap:// | ||
+ | ssl start_tls | ||
+ | tls_cacertdir / | ||
+ | pam_password sha256 | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ==== system-auth ==== | ||
+ | Es wurden auch folgenden **pam.d**-Konfigurationsdateien angepasst: | ||
+ | |||
+ | * **/ | ||
+ | * **/ | ||
+ | * **/ | ||
+ | * **/ | ||
+ | * **/ | ||
+ | |||
+ | Zur Bearbeitung der Konfigurationsdatei nutzen wir wie so oft immer unseren Editor der Wahl **vim**. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | #%PAM-1.0 | ||
+ | # This file is auto-generated. | ||
+ | # User changes will be destroyed the next time authconfig is run. | ||
+ | auth required | ||
+ | auth sufficient | ||
+ | auth required | ||
+ | |||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | |||
+ | password | ||
+ | |||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | </ | ||
+ | |||
+ | # vim / | ||
+ | <file bash / | ||
+ | #%PAM-1.0 | ||
+ | # This file is auto-generated. | ||
+ | # User changes will be destroyed the next time authconfig is run. | ||
+ | auth required | ||
+ | auth sufficient | ||
+ | auth requisite | ||
+ | auth sufficient | ||
+ | auth required | ||
+ | |||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | |||
+ | password | ||
+ | password | ||
+ | password | ||
+ | password | ||
+ | |||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | </ | ||
+ | |||
+ | # vim / | ||
+ | <file bash / | ||
+ | #%PAM-1.0 | ||
+ | # This file is auto-generated. | ||
+ | # User changes will be destroyed the next time authconfig is run. | ||
+ | auth required | ||
+ | auth [success=done ignore=ignore default=die] pam_pkcs11.so wait_for_card card_only | ||
+ | auth required | ||
+ | |||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | |||
+ | password | ||
+ | |||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | </ | ||
+ | |||
+ | # vim / | ||
+ | <file bash / | ||
+ | #%PAM-1.0 | ||
+ | auth | ||
+ | account | ||
+ | </ | ||
+ | |||
+ | # vim / | ||
+ | <file bash / | ||
+ | #%PAM-1.0 | ||
+ | # This file is auto-generated. | ||
+ | # User changes will be destroyed the next time authconfig is run. | ||
+ | auth required | ||
+ | auth sufficient | ||
+ | auth sufficient | ||
+ | auth requisite | ||
+ | auth sufficient | ||
+ | auth required | ||
+ | |||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | account | ||
+ | |||
+ | password | ||
+ | password | ||
+ | password | ||
+ | password | ||
+ | |||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | session | ||
+ | </ | ||
+ | |||
+ | ==== ldap.conf ==== | ||
+ | In der Konfigurationsdatei // | ||
+ | * **BASE | ||
+ | * **URI | ||
+ | * **TLS_CACERTDIR / | ||
+ | |||
+ | Zur Bearbeitung der Konfigurationsdatei nutzen wir wie so oft immer unseren Editor der Wahl **vim**. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # | ||
+ | # LDAP Defaults | ||
+ | # | ||
+ | |||
+ | # See ldap.conf(5) for details | ||
+ | # This file should be world readable but not world writable. | ||
+ | |||
+ | #BASE | ||
+ | #URI ldap:// | ||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client Authentication | ||
+ | BASE dc=nausch, dc=org | ||
+ | URI | ||
+ | TLS_CACERTDIR / | ||
+ | </ | ||
+ | |||
+ | ==== authconfig ==== | ||
+ | In der Konfigurationsdatei // | ||
+ | * **USELDAP=yes** // | ||
+ | * **FORCELEGACY=no** //(Da wir nun TLS bei der LDAP-Authentifizierung unter CentOS 6 nutzen wollen, setzen wir diem Option **FORCELEGACY** wieder auf **no** zurück.// | ||
+ | |||
+ | Zur Bearbeitung der Konfigurationsdatei nutzen wir wie so oft immer unseren Editor der Wahl **vim**. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | USEMKHOMEDIR=no | ||
+ | USEPAMACCESS=no | ||
+ | CACHECREDENTIALS=yes | ||
+ | USESSSDAUTH=no | ||
+ | USESHADOW=yes | ||
+ | USEWINBIND=no | ||
+ | USEDB=no | ||
+ | FORCELEGACY=no | ||
+ | USEFPRINTD=yes | ||
+ | FORCESMARTCARD=no | ||
+ | PASSWDALGORITHM=sha512 | ||
+ | USELDAPAUTH=no | ||
+ | USEPASSWDQC=no | ||
+ | USELOCAUTHORIZE=yes | ||
+ | USECRACKLIB=yes | ||
+ | USEWINBINDAUTH=no | ||
+ | USESMARTCARD=no | ||
+ | USELDAP=yes | ||
+ | USENIS=no | ||
+ | USEKERBEROS=no | ||
+ | USESYSNETAUTH=no | ||
+ | USESMBAUTH=no | ||
+ | USESSSD=no | ||
+ | USEHESIOD=no | ||
+ | </ | ||
+ | |||
+ | ==== nsswitch.conf ==== | ||
+ | In der Konfigurationsdatei // | ||
+ | * **passwd: | ||
+ | * **shadow: | ||
+ | * **group: | ||
+ | |||
+ | * **netgroup: | ||
+ | |||
+ | * **automount: | ||
+ | |||
+ | Zur Bearbeitung der Konfigurationsdatei nutzen wir wie so oft immer unseren Editor der Wahl **vim**. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # | ||
+ | # / | ||
+ | # | ||
+ | # An example Name Service Switch config file. This file should be | ||
+ | # sorted with the most-used services at the beginning. | ||
+ | # | ||
+ | # The entry ' | ||
+ | # entry should stop if the search in the previous entry turned | ||
+ | # up nothing. Note that if the search failed due to some other reason | ||
+ | # (like no NIS server responding) then the search continues with the | ||
+ | # next entry. | ||
+ | # | ||
+ | # Valid entries include: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # To use db, put the " | ||
+ | # looked up first in the databases | ||
+ | # | ||
+ | # Example: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client Authentication | ||
+ | # default | ||
+ | # passwd: | ||
+ | # shadow: | ||
+ | # group: | ||
+ | passwd: | ||
+ | shadow: | ||
+ | group: | ||
+ | |||
+ | # | ||
+ | hosts: | ||
+ | |||
+ | # Example - obey only what nisplus tells us... | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | #rpc: nisplus [NOTFOUND=return] files | ||
+ | # | ||
+ | # | ||
+ | |||
+ | bootparams: nisplus [NOTFOUND=return] files | ||
+ | |||
+ | ethers: | ||
+ | netmasks: | ||
+ | networks: | ||
+ | protocols: | ||
+ | rpc: files | ||
+ | services: | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client Authentication | ||
+ | # default | ||
+ | # netgroup: | ||
+ | netgroup: | ||
+ | |||
+ | publickey: | ||
+ | |||
+ | # Django : 2011-10-28 LDAP Client Authentication | ||
+ | # default | ||
+ | # automount: | ||
+ | automount: | ||
+ | aliases: | ||
+ | </ | ||
+ | ===== Clienttest ===== | ||
+ | Zum Testen unserer Konfiguration starten wir einfach unseren CentOS-6 Host und melden uns an. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Bei Bedarf beobachten wir das LDAP-Logfile auf dem OpenLDAP-Server. | ||
+ | # tail -f / | ||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
+ | |||