Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:ldap_c7:ldaps [15.07.2015 18:59. ] – [Server-Zertifikat] djangocentos:ldap_c7:ldaps [18.11.2024 07:01. ] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 ====== TLS-Absicherung des OpenLDAP-Servers - LDAPs-Konfiguration unter CentOS 7.x ====== ====== TLS-Absicherung des OpenLDAP-Servers - LDAPs-Konfiguration unter CentOS 7.x ======
 {{:centos:ldap-logo.png?nolink&167 |OpenLDAP Logo}} {{:centos:ldap-logo.png?nolink&167 |OpenLDAP Logo}}
 + 
 {{ :centos:world.png?nolink&80|Bild: Weltkugel }} \\ {{ :centos:world.png?nolink&80|Bild: Weltkugel }} \\
 Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen. Daten durchlaufen von der Quelle bis zum Ziel zahlreiche Server und Systeme, an denen die Daten, abgegriffen und/oder manipuliert werden können und das nicht nur bei Übertragungen im Internet , sondern auch im **[[https://de.wikipedia.org/wiki/Intranet|Intranet]]**! Persönliche und vertrauliche Daten, wie z.B. Anmeldenamen und Passwörter, können so einfach Dritten in die Hände fallen, die mit grosser krimineller Energie versuchen an diese Daten zu kommen.  Dass das Internet systembedingt unsicher ist, hat sich in aller Regel herumgesprochen. Daten durchlaufen von der Quelle bis zum Ziel zahlreiche Server und Systeme, an denen die Daten, abgegriffen und/oder manipuliert werden können und das nicht nur bei Übertragungen im Internet , sondern auch im **[[https://de.wikipedia.org/wiki/Intranet|Intranet]]**! Persönliche und vertrauliche Daten, wie z.B. Anmeldenamen und Passwörter, können so einfach Dritten in die Hände fallen, die mit grosser krimineller Energie versuchen an diese Daten zu kommen. 
Zeile 17: Zeile 17:
 {{ :centos:mailserver:lan_security.png?96|SSL/TLS Logo}} Für die vertrauliche Kommunikation zwischen unseren Usern und unserm [[http://www.openldap.org|OpenLDAP-Server]] bietet sich eine verschlüsselte Kommunikation mit Hilfe von **SSL/TLS** an. {{ :centos:mailserver:lan_security.png?96|SSL/TLS Logo}} Für die vertrauliche Kommunikation zwischen unseren Usern und unserm [[http://www.openldap.org|OpenLDAP-Server]] bietet sich eine verschlüsselte Kommunikation mit Hilfe von **SSL/TLS** an.
  
-Mit Hilfe von **[[centos:XXX?&#perfect_forward_secrecy|PFS]]**((**P**erfect **F**orward **S**ecrecy)) können wir leicht und einfach sicherstellen, dass aufgezeichnete Datenströme im nach hinein nicht entschlüsselt werden können. Dies wird erreicht, da die beiden Kommunikationspartner, einen separaten und individuellen temporären Schlüssel zur Datensicherung verwenden. Dieser Schlüssel ist dabei nicht fix, sondern wird bei jeder Verbindung neu ausgehandelt. Da aber der Schlüssel an sich nicht ausgetauscht werden muss, ist es auch nicht möglich, den eventuell aufgezeichneten Datenstrom zu entschlüsseln, da der dazu benötigte Schlüssel nicht im Datenstrom enthalten war. +Mit Hilfe von **[[centos:ldap_c7:ldaps?do=edit#tls_diffie-hellman_parameter|PFS]]**((**P**erfect **F**orward **S**ecrecy)) können wir leicht und einfach sicherstellen, dass aufgezeichnete Datenströme im nach hinein nicht entschlüsselt werden können. Dies wird erreicht, da die beiden Kommunikationspartner, einen separaten und individuellen temporären Schlüssel zur Datensicherung verwenden. Dieser Schlüssel ist dabei nicht fix, sondern wird bei jeder Verbindung neu ausgehandelt. Da aber der Schlüssel an sich nicht ausgetauscht werden muss, ist es auch nicht möglich, den eventuell aufgezeichneten Datenstrom zu entschlüsseln, da der dazu benötigte Schlüssel nicht im Datenstrom enthalten war. 
  
 Perfect Forward Secrecy (PFS) basiert auf der Idee, dass Client und Server ihre Kommunikation über einen zusätzlichen temporären Schlüssel absichern, der wechselt. Da der Verbindungsaufbau so gestrickt ist, daß der Schlüssel selbst gar nicht ausgetauscht werden muß, kann der jeweils benutzte Sitzungsschlüssel selbst auch nicht aufgezeichnet werden. Eine nachträgliche Entschlüsselung einer früher aufgezeichneten Session ist damit nicht mehr möglich.  Perfect Forward Secrecy (PFS) basiert auf der Idee, dass Client und Server ihre Kommunikation über einen zusätzlichen temporären Schlüssel absichern, der wechselt. Da der Verbindungsaufbau so gestrickt ist, daß der Schlüssel selbst gar nicht ausgetauscht werden muß, kann der jeweils benutzte Sitzungsschlüssel selbst auch nicht aufgezeichnet werden. Eine nachträgliche Entschlüsselung einer früher aufgezeichneten Session ist damit nicht mehr möglich. 
Zeile 1367: Zeile 1367:
  
 {{page>centos:ca-chain&nofooter&showheader}} {{page>centos:ca-chain&nofooter&showheader}}
 +
 +===== LDAPs konfigurieren =====
 +Viele wertvolle Informationen zur TLS-Konfiguration finden sich im Kapitel **[[http://www.openldap.org/doc/admin24/tls.html|16. Using TLS]]** des **[[http://www.openldap.org/doc/admin24/|OpenLDAP Software 2.4 Administrator's Guide]]** zu finden.
 +
 +==== slapd ====
 +Damit unser OpenLDAP-Server zukünftig LDAPS auf Port **636** zur Verfügung stellen kann, bearbeiten wir nun die systemweite Konfigurationsdatei //**/etc/sysconfig/slapd**//.
 +   # vim /etc/sysconfig/slapd
 +
 +<file bash /etc/sysconfig/slapd># OpenLDAP server configuration
 +# see 'man slapd' for additional information
 +
 +# Where the server will run (-h option)
 +# - ldapi:/// is required for on-the-fly configuration using client tools
 +#   (use SASL with EXTERNAL mechanism for authentication)
 +# - default: ldapi:/// ldap:///
 +# - example: ldapi:/// ldap://127.0.0.1/ ldap://10.0.0.1:1389/ ldaps:///
 +# Django : 2015-07-15 - LDAPs Konfiguration für Port 636
 +# default: SLAPD_URLS="ldapi:/// ldap:///"
 +SLAPD_URLS="ldapi:/// ldap:/// ldaps:///"
 +
 +# Any custom options
 +#SLAPD_OPTIONS=""
 +
 +# Keytab location for GSSAPI Kerberos authentication
 +#KRB5_KTNAME="FILE:/etc/openldap/ldap.keytab"
 +</file>
 +
 +Nähere Informationen zu den möglichen Parametern entnehmen wir der zugehörigen Manpage.
 +   # man slapd
 +
 +<code>SLAPD(8C)                                                                         SLAPD(8C)
 +
 +NAME
 +       slapd - Stand-alone LDAP Daemon
 +
 +SYNOPSIS
 +       slapd   [-4|-6]  [-T {acl|a[dd]|auth|c[at]|  d[n]|i[ndex]|p[asswd]|s[chema]|t[est]}]
 +       [-d debug-level]   [-f slapd-config-file]   [-F slapd-config-directory]    [-h URLs]
 +       [-n service-name]   [-s syslog-level]   [-l syslog-local-user]   [-o option[=value]]
 +       [-r directory] [-u user] [-g group] [-c cookie]
 +
 +DESCRIPTION
 +       Slapd is the stand-alone LDAP daemon. It listens for LDAP connections on any  number
 +       of  ports  (default  389),  responding to the LDAP operations it receives over these
 +       connections.  slapd is typically invoked at boot time, usually out of /etc/rc.local.
 +       Upon  startup,  slapd normally forks and disassociates itself from the invoking tty.
 +       If configured in the config file (or config directory), the slapd process will print
 +       its  process  ID (see getpid(2)) to a .pid file, as well as the command line options
 +       during invocation to an .args file (see slapd.conf(5)).  If the -d  flag  is  given,
 +       even  with  a  zero argument, slapd will not fork and disassociate from the invoking
 +       tty.
 +
 +       See the "OpenLDAP Administrator's Guide" for more details on slapd.
 +
 +OPTIONS
 +       -4     Listen on IPv4 addresses only.
 +
 +       -6     Listen on IPv6 addresses only.
 +
 +       -T tool
 +              Run in Tool mode. The tool argument selects whether to run as slapadd,  slap‐
 +              cat, slapdn, slapindex, slappasswd, slapschema, or slaptest (slapacl and sla‐
 +              pauth need the entire acl and auth option value to be spelled out,  as  a  is
 +              reserved  to slapadd).  This option should be the first option specified when
 +              it is used; any remaining options will be interpreted  by  the  corresponding
 +              slap  tool  program,  according to the respective man pages.  Note that these
 +              tool programs will usually be symbolic links to slapd.  This option  is  pro‐
 +              vided for situations where symbolic links are not provided or not usable.
 +
 +       -d debug-level
 +              Turn  on  debugging  as defined by debug-level.  If this option is specified,
 +              even with a zero argument, slapd will  not  fork  or  disassociate  from  the
 +              invoking  terminal.   Some  general operation and status messages are printed
 +              for any value of debug-level.  debug-level is taken as  a  bit  string,  with
 +              each  bit  corresponding  to  a different kind of debugging information.  See
 +              <ldap_log.h> for details.  Comma-separated arrays of friendly  names  can  be
 +              specified  to select debugging output of the corresponding debugging informa‐
 +              tion.  All the names  recognized  by  the  loglevel  directive  described  in
 +              slapd.conf(5) are supported.  If debug-level is ?, a list of installed debug-
 +              levels is printed, and slapd exits.
 +
 +              Remember that if you turn on packet logging, packets  containing  bind  pass‐
 +              words  will  be  output,  so  if you redirect the log to a logfile, that file
 +              should be read-protected.
 +
 +       -s syslog-level
 +              This option tells slapd at what debug-level debugging  statements  should  be
 +              logged  to  the syslog(8) facility.  The value syslog-level can be set to any
 +              value or combination allowed by the  -d  switch.   Slapd  logs  all  messages
 +              selected by syslog-leveli at the syslog(3) severity debug-level DEBUG, on the
 +              unit specified with -l.
 +
 +       -n service-name
 +              Specifies the service name for logging and other purposes.  Defaults to base‐
 +              name of argv[0], i.e.: "slapd".
 +
 +       -l syslog-local-user
 +              Selects  the  local  user  of  the  syslog(8)  facility. Value can be LOCAL0,
 +              through LOCAL7, as well as USER and DAEMON.  The default is LOCAL4.  However,
 +              this  option  is  only permitted on systems that support local users with the
 +              syslog(8) facility.  Logging to syslog(8)  occurs  at  the  "DEBUG"  severity
 +              debug-level.
 +
 +       -f slapd-config-file
 +              Specifies   the   slapd   configuration  file.  The  default  is  /etc/openl‐
 +              dap/slapd.conf.
 +
 +       -F slapd-config-directory
 +              Specifies the slapd  configuration  directory.  The  default  is  /etc/openl‐
 +              dap/slapd.d.   If  both -f and -F are specified, the config file will be read
 +              and converted to config directory format and written to the specified  direc‐
 +              tory.  If neither option is specified, slapd will attempt to read the default
 +              config directory before trying to use the default config  file.  If  a  valid
 +              config  directory  exists then the default config file is ignored. All of the
 +              slap tools that use the config options observe this same behavior.
 +
 +       -h URLlist
 +              slapd will by default serve ldap:/// (LDAP over  TCP  on  all  interfaces  on
 +              default  LDAP  port).   That  is, it will bind using INADDR_ANY and port 389.
 +              The -h option may be used to specify LDAP (and other scheme) URLs  to  serve.
 +              For   example,   if  slapd  is  given  -h  "ldap://127.0.0.1:9009/  ldaps:///
 +              ldapi:///", it will listen on 127.0.0.1:9009 for LDAP, 0.0.0.0:636  for  LDAP
 +              over  TLS,  and LDAP over IPC (Unix domain sockets).  Host 0.0.0.0 represents
 +              INADDR_ANY (any interface).  A space separated list of URLs is expected.  The
 +              URLs  should be of the LDAP, LDAPS, or LDAPI schemes, and generally without a
 +              DN or other optional parameters (excepting as discussed below).  Support  for
 +              the  latter two schemes depends on selected configuration options.  Hosts may
 +              be specified by name or IPv4 and IPv6 address formats.  Ports, if  specified,
 +              must  be  numeric.   The default ldap:// port is 389 and the default ldaps://
 +              port is 636.
 +
 +              For LDAP over IPC, name is the name of the socket, and no port  is  required,
 +              nor  allowed;  note  that  directory separators must be URL-encoded, like any
 +              other characters that are special to URLs; so the socket
 +
 +                      /usr/local/var/ldapi
 +
 +              must be specified as
 +
 +                      ldapi://%2Fusr%2Flocal%2Fvar%2Fldapi
 +
 +              The default location for the IPC socket is /var/run/ldapi
 +
 +              The listener permissions are indicated by "x-mod=-rwxrwxrwx", "x-mod=0777" or
 +              "x-mod=777",  where  any of the "rwx" can be "-" to suppress the related per‐
 +              mission, while any of the "7" can be any  legal  octal  digit,  according  to
 +              chmod(1).  The listeners can take advantage of the "x-mod" extension to apply
 +              rough limitations to operations,  e.g.  allow  read  operations  ("r",  which
 +              applies  to search and compare), write operations ("w", which applies to add,
 +              delete, modify and modrdn), and execute operations ("x", which means bind  is
 +              required).   "User"  permissions  apply to authenticated users, while "other"
 +              apply to anonymous users; "group"  permissions  are  ignored.   For  example,
 +              "ldap:///????x-mod=-rw-------"  means that read and write is only allowed for
 +              authenticated connections, and bind is required  for  all  operations.   This
 +              feature  is  experimental,  and  requires to be manually enabled at configure
 +              time.
 +
 +       -r directory
 +              Specifies a directory to become the root directory.  slapd  will  change  the
 +              current working directory to this directory and then chroot(2) to this direc‐
 +              tory.  This is done after opening listeners but before reading any configura‐
 +              tion file or initializing any backend.  When used as a security mechanism, it
 +              should be used in conjunction with -u and -g options.
 +
 +       -u user
 +              slapd will run slapd with the specified user name or id, and that user's sup‐
 +              plementary group access list as set with initgroups(3).  The group ID is also
 +              changed to this user's gid, unless the -g option is used to  override.   Note
 +              when  used with -r, slapd will use the user database in the change root envi‐
 +              ronment.
 +
 +              Note that on some systems, running as  a  non-privileged  user  will  prevent
 +              passwd  back-ends from accessing the encrypted passwords.  Note also that any
 +              shell back-ends will run as the specified non-privileged user.
 +
 +       -g group
 +              slapd will run with the specified group name or id.  Note when used with  -r,
 +              slapd will use the group database in the change root environment.
 +
 +       -c cookie
 +              This  option  provides  a  cookie for the syncrepl replication consumer.  The
 +              cookie is a comma separated list of name=value  pairs.   Currently  supported
 +              syncrepl  cookie  fields are rid, sid, and csn.  rid identifies a replication
 +              thread within the consumer server and is used to find the syncrepl specifica‐
 +              tion  in  slapd.conf(5)  or  slapd-config(5)  having the matching replication
 +              identifier in its definition. The rid must be provided in order for any other
 +              specified  values to be used.  sid is the server id in a multi-master/mirror-
 +              mode configuration.  csn is the commit sequence number received by a previous
 +              synchronization  and  represents  the  state  of the consumer replica content
 +              which the syncrepl engine will synchronize to the current  provider  content.
 +              In  case  of  mirror-mode or multi-master replication agreement, multiple csn
 +              values, semicolon separated, can appear.  Use only the rid part  to  force  a
 +              full reload.
 +
 +       -o option[=value]
 +              This  option  provides a generic means to specify options without the need to
 +              reserve a separate letter for them.
 +
 +              It supports the following options:
 +
 +              slp={on|off|slp-attrs}
 +                     When SLP support is compiled into slapd, disable it (off),
 +                      enable it by registering at SLP DAs without specific  SLP  attributes
 +                     (on),  or  with  specific SLP attributes slp-attrs that must be an SLP
 +                     attribute list definition according to the SLP standard.
 +
 +                     For        example,         "slp=(tree=production),(server-type=OpenL‐
 +                     DAP),(server-version=2.4.15)"  registers at SLP DAs with the three SLP
 +                     attributes tree, server-type and server-version that have  the  values
 +                     given  above.   This allows to specifically query the SLP DAs for LDAP
 +                     servers holding the production tree in case multiple trees are  avail‐
 +                     able.
 +
 +EXAMPLES
 +       To  start  slapd and have it fork and detach from the terminal and start serving the
 +       LDAP databases defined in the default config file, just type:
 +
 +            slapd
 +
 +       To start slapd with an alternate configuration file, and turn on  voluminous  debug‐
 +       ging which will be printed on standard error, type:
 +
 +            slapd -f /var/tmp/slapd.conf -d 255
 +
 +       To test whether the configuration file is correct or not, type:
 +
 +            slapd -Tt
 +
 +SEE ALSO
 +       ldap(3),  slapd.conf(5),  slapd-config(5),  slapd.access(5), slapacl(8), slapadd(8),
 +       slapauth(8),  slapcat(8),  slapdn(8),  slapindex(8),  slappasswd(8),  slapschema(8),
 +       slaptest(8).
 +
 +       "OpenLDAP Administrator's Guide" (http://www.OpenLDAP.org/doc/admin/)
 +
 +BUGS
 +       See http://www.openldap.org/its/
 +
 +ACKNOWLEDGEMENTS
 +       OpenLDAP   Software   is   developed   and   maintained   by  The  OpenLDAP  Project
 +       <http://www.openldap.org/> OpenLDAP Software is derived from University of  Michi‐
 +       gan LDAP 3.3 Release.
 +
 +OpenLDAP 2.4.39                          2014/01/26                               SLAPD(8C)</code>
 +
 +==== ldap.conf ====
 +Wollen wir von unserem Server aus, mittels **ldapsearch** muss natürlich der Client auch wissen, wie er das bzw. die Zertifikate auf das Vertrauen hin prüfen soll.
 +
 +Wir werden daher in der Konfigurationsdatei des LDAP-Clients vermerken, dass die im Abschnitt **[[centos:ldap_c7:ldaps?&#vertrauensmodelle_in_public-key-infrastrukturen|CA Trust Vertrauensmodelle in Public-Key-Infrastrukturen]]** erstellte Datei mit den vertrauenswürdigen Root-Zertifikaten verwenden soll.
 +   # vim /etc/openldap/ldap.conf
 +
 +<file bash /etc/openldap/ldap.conf>#
 +# LDAP Defaults
 +#
 +
 +# See ldap.conf(5) for details
 +# This file should be world readable but not world writable.
 +
 +#BASE   dc=example,dc=com
 +#URI    ldap://ldap.example.com ldap://ldap-master.example.com:666
 +
 +# Django: 2015-07-14
 +BASE    dc=nausch, dc=org                   # Definition des standardmäßig abgefragten Teilbaums / Searchbase
 +                                            # Anfragen werden unterhalb von dc=nausch, dc=org ausgeführt.
 +URI     ldap://openldap.dmz.nausch.org      # Definition des LDAP-Servers
 +
 +#SIZELIMIT      12
 +#TIMELIMIT      15
 +#DEREF          never
 +
 +# Django : 2015-07-16
 +# default: TLS_CACERTDIR        /etc/openldap/certs
 +TLS_CACERTDIR   /etc/pki/tls/certs/CAcert_chain.pem
 +
 +# Turning this off breaks GSSAPI used with krb5 when rdns = false
 +SASL_NOCANON    on
 +</file>
 +
 +
 +===== LDAPs-Konfiguration via LDIF =====
 +==== (TLS-)Zertifikate und Schlüssel ===
 +Wie schon bei der **[[centos:ldap_c7:install#grundkonfiguration|Grundkonfiguration unseres OpenLDAP-Servers]]**, erfolgt die eigentliche Konfiguration an Hand von einzelnen **[[https://de.wikipedia.org/wiki/LDAP_Data_Interchange_Format|ldif]]**-Dateien aus dem Verzeichnis //** /etc/openldap/ldif/**//.
 +
 +Folgende Parameter werden wir unserem OpenLDAP-Server über eine passende LDIF-Datei bekannt geben.
 +  * **olcTLSCipherSuite**: \\ Definition der Verschlüsselungsstärke bzw. der Verschlüsselungsmechanismen
 +  * **olcTLSCertificateFile**: \\ Die zuvor generierte Zertifikatsdatei //**/etc/pki/tls/certs/openldap.dmz.nausch.org.certificate.pem**//
 +  * **olcTLSCertificateKeyFile**: \\ Der zum Zertifikat gehörende private Serverkey //**/etc/pki/tls/private/openldap_serverkey.pem**//
 +  * **olcTLSCACertificateFile**: \\ Das ROOT-Zertifikat bzw. die Zertifikatschain der verwendeten Certificate Authority (CA)
 +
 +Zur Definition unserer TLS-Konfiguration legen wir uns nun eine passende zugehörige Datei an.
 +   # vim /etc/openldap/ldif/cn\=config_TLS.ldif
 +
 +<file ldif /etc/openldap/ldif/cn=config_TLS.ldif># Django : 2015-07-15
 +# TLS-Konfiguration unseres OpenLDAP-Servers.
 +# https://dokuwiki.nausch.org/doku.php/centos:ldap_c7:ldaps?&#tls_konfigurieren_via_ldif
 +
 +dn: cn=config
 +changetype: modify
 +add: olcTLSCipherSuite
 +olcTLSCipherSuite: HIGH
 +-
 +replace: olcTLSCertificateFile
 +olcTLSCertificateFile: /etc/pki/tls/certs/openldap.dmz.nausch.org.certificate.pem
 +-
 +replace: olcTLSCertificateKeyFile
 +olcTLSCertificateKeyFile: /etc/pki/tls/private/openldap_serverkey.pem
 +-
 +add: olcTLSCACertificateFile
 +olcTLSCACertificateFile: /etc/pki/tls/certs/CAcert_chain.pem
 +</file>
 +
 +Die Konfigurationsänderungen aktivieren wir wieder wie gehabt mit Aufruf des Befehls **ldapmodify**. 
 +   # ldapmodify -Y EXTERNAL -H ldapi:/// -f /etc/openldap/ldif/cn\=config_TLS.ldif
 +
 +  SASL/EXTERNAL authentication started
 +  SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
 +  SASL SSF: 0
 +  modifying entry "cn=config"
 +
 +Ob unsere Änderungen entsprechend unserer ldif-Datei angelegt und geändert wurden, können wir wie folgt überprüfen. 
 +   #  ldapsearch -W -x -D cn=config -b cn=config "(objectclass=olcGlobal)"
 +
 +  Enter LDAP Password: 
 +<code># extended LDIF
 +#
 +# LDAPv3
 +# base <cn=config> with scope subtree
 +# filter: (objectclass=olcGlobal)
 +# requesting: ALL
 +#
 +
 +# config
 +dn: cn=config
 +objectClass: olcGlobal
 +cn: config
 +olcArgsFile: /var/run/openldap/slapd.args
 +olcPidFile: /var/run/openldap/slapd.pid
 +olcTLSCACertificatePath: /etc/openldap/certs
 +olcReferral: ldap://openldap.dmz.nausch.org
 +olcIdleTimeout: 30
 +olcTLSCipherSuite: HIGH
 +olcTLSCertificateFile: /etc/pki/tls/certs/openldap.dmz.nausch.org.certificate.pem
 +olcTLSCertificateKeyFile: /etc/pki/tls/private/openldap_serverkey.pem
 +olcTLSCACertificateFile: /etc/pki/tls/certs/CAcert_chain.pem
 +
 +# search result
 +search: 2
 +result: 0 Success
 +
 +# numResponses: 2
 +# numEntries: 1
 +</code>
 +
 +Damit unser OpenLDAP-Daemon **slapd** den TCP-Port **636** (LDAP over SSL) binden kann, müssen wir diesen einmal durchstarten.
 +   # systemctl restart slapd.service
 +
 +Den erfolgreichen restart können wir bei Bedarf natürlich auch abfragen.
 +   # systemctl status slapd.service
 +
 +<html><pre class="code">
 +<font style="color: rgb(0, 0, 0)">slapd.service - OpenLDAP Server Daemon
 +   Loaded: loaded (/usr/lib/systemd/system/slapd.service; disabled)
 +   Active: <font style="color: rgb(29, 180, 29)"><b>active (running)</b></font><font style="color: rgb(0, 0, 0)"> since Wed 2015-07-15 22:51:49 CEST; 54s ago
 +     Docs: man:slapd
 +           man:slapd-config
 +           man:slapd-hdb
 +           man:slapd-mdb
 +           file:///usr/share/doc/openldap-servers/guide.html
 +  Process: 20954 ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS (code=exited, status=0/SUCCESS)
 +  Process: 20924 ExecStartPre=/usr/libexec/openldap/check-config.sh (code=exited, status=0/SUCCESS)
 + Main PID: 20956 (slapd)
 +   CGroup: /system.slice/slapd.service
 +           └─20956 /usr/sbin/slapd -u ldap -h ldapi:/// ldap:/// ldaps:///
 +
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20945]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20945]: pam_unix(runuser:session): session closed for user ldap
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20947]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20947]: pam_unix(runuser:session): session closed for user ldap
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20949]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20949]: pam_unix(runuser:session): session closed for user ldap
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20951]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
 +Jul 15 22:51:49 vml000037.dmz.nausch.org runuser[20951]: pam_unix(runuser:session): session closed for user ldap
 +Jul 15 22:51:49 vml000037.dmz.nausch.org slapd[20954]: @(#) $OpenLDAP: slapd 2.4.39 (Mar  6 2015 04:35:49) $
 +                                                               mockbuild@worker1.bsys.centos.org:/builddir/build/BUILD/openldap-2.4.39/openldap-2.4.39/servers/slapd
 +Jul 15 22:51:49 vml000037.dmz.nausch.org slapd[20956]: slapd starting
 +Jul 15 22:51:49 vml000037.dmz.nausch.org systemd[1]: Started OpenLDAP Server Daemon.</font>
 +</pre></html>
 +
 +Den geöffneten Port **636** können wir auch mit folgendem Aufruf überprüfen:
 +   # lsof -i :636
 +
 +  COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
 +  slapd   20956 ldap   10u  IPv4 323839      0t0  TCP *:ldaps (LISTEN)
 +  slapd   20956 ldap   11u  IPv6 323840      0t0  TCP *:ldaps (LISTEN)
 +
 +An statt **lsof** zu nutzen, können wir natürlich auch den Befehl **netstat** dazu bemühen.
 +   #  netstat -tulpen | grep slapd
 +
 +  tcp        0      0 0.0.0.0:389             0.0.0.0:              LISTEN      0          744033     31165/slapd
 +  tcp        0      0 0.0.0.0:636             0.0.0.0:              LISTEN      0          744037     31165/slapd
 +  tcp6            0 :::389                  :::*                    LISTEN      0          744034     31165/slapd
 +  tcp6            0 :::636                  :::*                    LISTEN      0          744038     31165/slapd
 +
 +
 +
 +
 +==== TLS Protokollversion ====
 +Auf Grund einer Sicherheitslücke in der **SSLv3** Implementierung (**Poodle-Lücke**), ist aus Sicherheitsgründen der Support der beiden Protokolle zu unterbinden. Im Dokument //**[[https://access.redhat.com/solutions/1234843|Resolution for POODLE SSLv3.0 vulnerability (CVE-2014-3566) for components that do not allow SSLv3 to be disabled via configuration settings]]**// finden sich hierzu wertvolle Hinweise zur Konfiguration unseres OpenLDAP-Servers.
 +
 +Die Festlegung des TLS Protokolls bzw. dem Ausschluss von **SSLv3** nehmen wir an Hand der nachfolgenden ldif-Datei vor. 
 +# vim /etc/openldap/ldif/cn\=config_TLS_olcTLSProtocolMin.ldif
 +
 +<file ldif /etc/openldap/ldif/cn=config_TLS_olcTLSProtocolMin.ldif># Django : 2015-07-15
 +# Ausschliessen der TLS-Protokolls SSLv3 auf Grund der Poodle Lücke
 +# https://dokuwiki.nausch.org/doku.php/centos:ldap_c7:ldaps?&#tls_protokoll-version_via_ldif
 +
 +dn: cn=config
 +changetype: modify
 +add: olcTLSProtocolMin
 +olcTLSProtocolMin: 3.1
 +
 +</file>
 +
 +Mittels **ldapmodify** führen wir nun die Änderungen unserer ldif-Datei aus. 
 +   # ldapmodify -W -x -D cn=config -f /etc/openldap/ldif/cn\=config_TLS_olcTLSProtocolMin.ldif
 +
 +  Enter LDAP Password: 
 +
 +  modifying entry "cn=config"
 +
 +Ob unsere Änderungen auch wirklich entsprechend unserer ldif-Datei angelegt und geändert wurden, können wir wie folgt überprüfen. 
 +   #  ldapsearch -W -x -D cn=config -b cn=config "(objectclass=olcGlobal)"
 +
 +  Enter LDAP Password: 
 +<code># extended LDIF
 +#
 +# LDAPv3
 +# base <cn=config> with scope subtree
 +# filter: (objectclass=olcGlobal)
 +# requesting: ALL
 +#
 +
 +# config
 +dn: cn=config
 +objectClass: olcGlobal
 +cn: config
 +olcArgsFile: /var/run/openldap/slapd.args
 +olcIdleTimeout: 30
 +olcPidFile: /var/run/openldap/slapd.pid
 +olcReferral: ldap://openldap.dmz.nausch.org
 +olcTLSCACertificateFile: /etc/pki/tls/certs/CAcert_chain.pem
 +olcTLSCACertificatePath: /etc/openldap/certs
 +olcTLSCertificateFile: /etc/pki/tls/certs/openldap.dmz.nausch.org.certificate.
 + pem
 +olcTLSCertificateKeyFile: /etc/pki/tls/private/openldap_serverkey.pem
 +olcTLSCipherSuite: HIGH
 +olcTLSProtocolMin: 3.1
 +
 +# search result
 +search: 2
 +result: 0 Success
 +
 +# numResponses: 2
 +# numEntries: 1</code>
 +
 +==== TLS Diffie-Hellman Parameter ====
 +Will man **Perfect Forward Secrecy** benutzen, so ist laut der "**[[http://www.openldap.org/faq/data/cache/185.html|How do I use TLS/SSL?]]**" die Directive **TLSDHParamFile** zu setzen. Dieser Parameter spezifiziert eine Datei mit den Parametern zum **[[https://de.wikipedia.org/wiki/Diffie-Hellman-Schl%C3%BCsselaustausch|Diffie-Hellman Ephemeral Schlüssel Austausch]]**.
 +
 +Zunächst werden wir uns nun erst einmal eine zu unserem **4096-RSA-Key** passende Diffie-Hellmann-Schlüsselparameterdatei generieren. 
 +
 +<WRAP center round tip 85%>
 +Die Erstellung einer 4096 Diffie-Hellman-Parameterdatei wird einige Zeit in Anspruch nehmen, also genügend Zeit für ein paar Kaffee oder [[http://www.club-mate.de|CLUB-MATE]], die einem Admin natürlich immer in ausreichenden Mengen zur Verfügung stehen sollten. Dauert die Erstellung auf dem Evaluierungssystem bis zu 60 Minuten! ;)
 +</WRAP>
 +
 +   # openssl dhparam -out /etc/pki/tls/private/dh_4096.pem 4096
 +
 +<code>Generating DH parameters, 4096 bit long safe prime, generator 2
 +...............................+............+..............</code>
 +
 +Da wir die Diffie-Hellman-Parameterdatei im Betrieb regelmäßig austauschen wollen, legen wir uns kurzer Hand einfach ein passendes Shell-Script an. Zuvor legen wir aber noch ein Verzeichnis an, in dem die Schlüssel vorübergehend abgelegt werden können.
 +   # mkdir /etc/pki/tls/tmp
 +
 +   # vim edh_keygen
 +<file bash edh_keygen>#!/bin/bash
 +# Script zum Erstellen der Diffie Hellman Schlüsselparameterdatei
 +# Django <django@mnausch.org> (c) 2015
 +
 +# ins Arbeitsverzeichnis wechseln
 +cd /etc/pki/tls/tmp
 +umask 022
 +
 +# Diffie-Hellman Parameter Datei erzeugen
 +openssl dhparam -out dh_4096.pem 4096
 +chmod 640 dh_4096.pem
 +
 +# Hostname und Datum holen
 +NAME=`hostname -s`
 +DATUM=`date +'%b %e %H:%M:%S'`
 +
 +# Parameterdatei für OpenLDAP bereitstellen
 +/usr/bin/rsync /etc/pki/tls/tmp/dh_4096.pem /etc/pki/tls/private/
 +
 +# Informationen zur neuen Parameterdatei im OPenLDAP-Log vermerken
 +echo "$DATUM" "$NAME" "openssl: ssl-params: renewed diffie-hellman parameters 4096bit" >> /var/log/ldap.log
 +
 +# OpenLDAP-Server restarten
 +/usr/bin/systemctl restart slapd
 +
 +# Temporäre Arbeitsdatei schreddern
 +/usr/bin/shred -u /etc/pki/tls/tmp/dh_4096.pem</file>
 +
 +Damit das Script auch ausgeführt werdden kann, versehen wir es noch mit den benötigten Rechten.
 +   # chmod +x edh_keygen
 +
 +<WRAP center round tip>
 +Warum das ganze in ein Shellsript packen, wird nun sich der ein oder andere gefragt haben. Ganz einfach: Wenn wir das Script nun nach **///etc/cron.weekly//** verschieben, können wir einfach stündlich neu generierte Schlüssel generieren und auch verwenden!
 +</WRAP>
 +   # mv edh_keygen /etc/cron.weekly/
 +
 +Das regelmäßige Erneuern der DH-Parameterdatei erfolgt nun regelmäßig und wir im Log unseres OpenLDAP-Verzeichnisservers entsprechend dokumentiert.
 +
 +   # less /var/log/ldap.log
 +
 +<code>Jul 16 14:43:38 vml000037 openssl: ssl-params: renewed diffie-hellman parameters 4096bit
 +Jul 16 14:43:38 vml000037 slapd[5002]: daemon: shutdown requested and initiated.
 +Jul 16 14:43:38 vml000037 slapd[5002]: slapd shutdown: waiting for 0 operations/tasks to finish
 +Jul 16 14:43:38 vml000037 slapd[5002]: slapd stopped.
 +Jul 16 14:43:39 vml000037 slapd[7344]: @(#) $OpenLDAP: slapd 2.4.39 (Mar  6 2015 04:35:49) $
 +        mockbuild@worker1.bsys.centos.org:/builddir/build/BUILD/openldap-2.4.39/openldap-2.4.39/servers/slapd
 +Jul 16 14:43:39 vml000037 slapd[7346]: slapd starting</code>
 +
 +Nun müssen wir nur noch über die Directive **olcTLSDHParamFile** unserem OpenLDAP-Server beibringen, die Parameterdatei auch zu verwenden.
 +
 +Wir legen uns also eine passende Konfigurationsdatei an und weisem dem Parameter dem Wert //****// zu.
 +   # vim /etc/openldap/ldif/cn\=config_olcTLSDHParamFile.ldif
 +
 +<file ldif /etc/openldap/ldif/cn=config_olcTLSDHParamFile.ldif># Django : 2015-07-16
 +# Definition der Parameterdatei für den Diffie-Hellman Ephemeral Schlüssel Austausch
 +# https://dokuwiki.nausch.org/doku.php/centos:ldap_c7:ldaps?&#tls_diffie-hellman_parameter_via_ldif
 +
 +dn: cn=config
 +changetype: modify
 +replace: olcTLSDHParamFile
 +olcTLSDHParamFile: /etc/pki/tls/private/dh_4096.pem
 +</file>
 +
 +Die Änderung unserer OpenLDAP-Konfiguration, aktivieren wir wie folgt: 
 +   # ldapmodify -W -x -D cn=config -f /etc/openldap/ldif/cn\=config_olcTLSDHParamFile.ldif
 +
 +  Enter LDAP Password:
 +
 +  modifying entry "cn=config"
 +
 +Auch hier können wir überprüfen, ob der zusätzliche Konfigurationsparameter richtig gesetzt wurde. 
 +   # ldapsearch -W -x -D cn=config -b cn=config "(objectclass=olcGlobal)"
 +
 +  Enter LDAP Password:
 +<code># extended LDIF
 +#
 +# LDAPv3
 +# base <cn=config> with scope subtree
 +# filter: (objectclass=olcGlobal)
 +# requesting: ALL
 +#
 +
 +# config
 +dn: cn=config
 +objectClass: olcGlobal
 +cn: config
 +olcArgsFile: /var/run/openldap/slapd.args
 +olcIdleTimeout: 30
 +olcPidFile: /var/run/openldap/slapd.pid
 +olcReferral: ldap://openldap.dmz.nausch.org
 +olcTimeLimit: 15
 +olcTLSCACertificateFile: /etc/pki/tls/certs/CAcert_chain.pem
 +olcTLSCACertificatePath: /etc/openldap/certs
 +olcTLSCertificateFile: /etc/pki/tls/certs/openldap.dmz.nausch.org.certificate.
 + pem
 +olcTLSCertificateKeyFile: /etc/pki/tls/private/openldap_serverkey.pem
 +olcTLSCipherSuite: HIGH
 +olcTLSProtocolMin: 3.1
 +olcTLSDHParamFile: /etc/pki/tls/private/dh_4096.pem
 +
 +# search result
 +search: 2
 +result: 0 Success
 +
 +# numResponses: 2
 +# numEntries: 1
 +</code>
 +
 +===== LDAPs Verbindungstests =====
 +
 +==== openssl ====
 +Beim ersten Test bauen wir eine Verbindung mit Hilfe des Befehls **openssl** auf und prüfen, ob auch wirklich das angegebene Protokoll verwendet wurde und welcher **Cipher** zum Einsatz kam.
 +   # openssl s_client -connect openldap.dmz.nausch.org:636 -showcerts -tls1_2
 +
 +<code>CONNECTED(00000003)                                                                                                             
 +depth=2 O = Root CA, OU = http://www.cacert.org, CN = CA Cert Signing Authority, emailAddress = support@cacert.org              
 +verify return:                                                                                                                
 +depth=1 O = CAcert Inc., OU = http://www.CAcert.org, CN = CAcert Class 3 Root                                                   
 +verify return:                                                                                                                
 +depth=0 CN = openldap.dmz.nausch.org                                                                                            
 +verify return:                                                                                                                
 +---                                                                                                                             
 +Certificate chain                                                                                                               
 + 0 s:/CN=openldap.dmz.nausch.org                                                                                                
 +   i:/O=CAcert Inc./OU=http://www.CAcert.org/CN=CAcert Class 3 Root                                                             
 +-----BEGIN CERTIFICATE-----                                                                                                     
 +MIIGBzCCA++gAwIBAgIDAm8BMA0GCSqGSIb3DQEBDQUAMFQxFDASBgNVBAoTC0NB                                                                
 +Y2VydCBJbmMuMR4wHAYDVQQLExVodHRwOi8vd3d3LkNBY2VydC5vcmcxHDAaBgNV                                                                
 +BAMTE0NBY2VydCBDbGFzcyAzIFJvb3QwHhcNMTUwNzE1MTgzOTUxWhcNMTcwNzE0                                                                
 +MTgzOTUxWjAiMSAwHgYDVQQDExdvcGVubGRhcC5kbXoubmF1c2NoLm9yZzCCAiIw                                                                
 +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMUdsfKPIpr3Ma0gpTJdIdKFJ9Wj                                                                
 +oc7tRO5D67WgXm4Txwd17wK51BkCsXPc7tNHHTTfEJ17UPfqge4bH5kH+Vfg4dAb                                                                
 +DG0xDtcJibQ0k4dbZEidTET41Iqd2m6xgGOAfEOpZmSUA2Awn4GBKFHjg3RzZ6YG                                                                
 +n6CTCTaCGiRsRWiGq0KBk4lXmvfAy+/dABXWwMlQsufMwvNxYp7fy/1K7ZMiSfRs                                                                
 +yMuqMWOO+e3YcUauZVhqhKlcH2AWi8+V6j4wp2G72fuuxOpZkU2vJcNKH3sHYj9G                                                                
 +p+Z7VHmzgDlz7Y00f93M6VVnC91RhDBwgQzGDMNRTSLyEnOFw7rtHgB/9QkD8dc8                                                                
 +9kley/+LQL4kIm1a8Vvm6wefiSKQOvuoFN5lN3x65JrrP8AB3KmhY+9ADI8w4P2Q                                                                
 +sPvsPt/ZREqB6mgy/IDEdRglMZYlOheacPnfe/JLBquIdW0kU3KKiRRZnugvkhti                                                                
 +GW0uJtWpNcvfx0FIPyFfDUAcCLiBnXym+4E4ekXEHH9aZxLgNhX81dw9lBzAmv1I                                                                
 +AAt2TMbwk74WedYVPN0nToGkTJu3iv1Y6sKQrbClpp4xl43bl11WFHFvJI0o7CC8                                                                
 +265NiAYfXztTXqxlJEOoltTaAXh9Zo8qNagrzlGOM/2lJT4T720mzmCKtNuxzMqF                                                                
 ++Z3YzIuTtz6gCHwPAgMBAAGjggESMIIBDjAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB                                                                
 +/wQEAwIDqDA0BgNVHSUELTArBggrBgEFBQcDAgYIKwYBBQUHAwEGCWCGSAGG+EIE                                                                
 +AQYKKwYBBAGCNwoDAzAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6                                                                
 +Ly9vY3NwLmNhY2VydC5vcmcvMDgGA1UdHwQxMC8wLaAroCmGJ2h0dHA6Ly9jcmwu                                                                
 +Y2FjZXJ0Lm9yZy9jbGFzczMtcmV2b2tlLmNybDBJBgNVHREEQjBAghdvcGVubGRh                                                                
 +cC5kbXoubmF1c2NoLm9yZ6AlBggrBgEFBQcIBaAZDBdvcGVubGRhcC5kbXoubmF1                                                                
 +c2NoLm9yZzANBgkqhkiG9w0BAQ0FAAOCAgEAQpFKrP2/1/iGFUyC6Sjz4JPI93xN                                                                
 +qoWhRMZM/SkpwarzBMwsGQ6yKHEoim9Zo4owb38q4yurlUgMcJ2XtNoB0uZK/jZQ                                                                
 +dVJysG+VbCh9YD5poHRVPMC5zAHWQ13m4BhaOcSXu1Vvh7lb/BcbIA2hlnuRtoOR                                                                
 +eyY28nTD1fLjTMfp6PbYFTK+asxq0TPqrP9j0qSy1M+0SQnLvlLkr1/bPWDeGH9k                                                                
 +L5c7FlTQAYE0q6sTdpAPNX2icGHECtylCohlnpNoLCchboH9y9s7FtPzMbDENWvA                                                                
 +FM1gooanqbo66adN7psnw2gXJbDLShaIwgjRzM8+82I4nXVO5CcD3FWqQIPwYpec                                                                
 +Rqk/iSB7UobY5h0/R1oQSCqrpGdMwXq7dwGMvyWlxWDikQrR2ptDWO9HENrUpwCN                                                                
 +LBvmGZedITZ3+NqmJTbSp3R4bEYESmznNUdD8BnBvg3alkzjb6Cinnb30TJtehbQ                                                                
 +yBaEhzq8KsOZpzcLT7ldN3Y6dxu8qj+p67nGD+A8brrII1s4TIcnEvnPBCWuku/                                                               
 +a5iSsSt3US1dOocFJM3CJyuaNfWIqDbutE702fREPriNPxqRSdTkH5Ub4Rb4CiRW                                                                
 +bHHSqh0QekUMpNi6n7+thG46EKJk1WgeNhhsqRKqy5MDLth7iN5gHE2CCbSIe4qW                                                                
 +g2KkrggW2eBNzv4=                                                                                                                
 +-----END CERTIFICATE-----                                                                                                       
 + 1 s:/O=CAcert Inc./OU=http://www.CAcert.org/CN=CAcert Class 3 Root                                                             
 +   i:/O=Root CA/OU=http://www.cacert.org/CN=CA Cert Signing Authority/emailAddress=support@cacert.org                           
 +-----BEGIN CERTIFICATE-----                                                                                                     
 +MIIHWTCCBUGgAwIBAgIDCkGKMA0GCSqGSIb3DQEBCwUAMHkxEDAOBgNVBAoTB1Jv                                                                
 +b3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAGA1UEAxMZ                                                                
 +Q0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y                                                                
 +dEBjYWNlcnQub3JnMB4XDTExMDUyMzE3NDgwMloXDTIxMDUyMDE3NDgwMlowVDEU                                                                
 +MBIGA1UEChMLQ0FjZXJ0IEluYy4xHjAcBgNVBAsTFWh0dHA6Ly93d3cuQ0FjZXJ0                                                                
 +Lm9yZzEcMBoGA1UEAxMTQ0FjZXJ0IENsYXNzIDMgUm9vdDCCAiIwDQYJKoZIhvcN                                                                
 +AQEBBQADggIPADCCAgoCggIBAKtJNRFIfNImflOUz0Op3SjXQiqL84d4GVh8D57a                                                                
 +iX3h++tykA10oZZkq5+gJJlz2uJVdscXe/UErEa4w75/ZI0QbCTzYZzA8pD6Ueb1                                                                
 +aQFjww9W4kpCz+JEjCUoqMV5CX1GuYrz6fM0KQhF5Byfy5QEHIGoFLOYZcRD7E6C                                                                
 +jQnRvapbjZLQ7N6QxX8KwuPr5jFaXnQ+lzNZ6MMDPWAzv/fRb0fEze5ig1JuLgia                                                                
 +pNkVGJGmhZJHsK5I6223IeyFGmhyNav/8BBdwPSUp2rVO5J+TJAFfpPBLIukjmJ0                                                                
 +FXFuC3ED6q8VOJrU0gVyb4z5K+taciX5OUbjchs+BMNkJyIQKopPWKcDrb60LhPt                                                                
 +XapI19V91Cp7XPpGBFDkzA5CW4zt2/LP/JaT4NsRNlRiNDiPDGCbO5dWOK3z0luL                                                                
 +oFvqTpa4fNfVoIZwQNORKbeiPK31jLvPGpKK5DR7wNhsX+kKwsOnIJpa3yxdUly6                                                                
 +R9Wb7yQocDggL9V/KcCyQQNokszgnMyXS0XvOhAKq3A6mJVwrTWx6oUrpByAITGp                                                                
 +rmB6gCZIALgBwJNjVSKRPFbnr9s6JfOPMVTqJouBWfmh0VMRxXudA/Z0EeBtsSw/                                                                
 +LIaRmXGapneLNGDRFLQsrJ2vjBDTn8Rq+G8T/HNZ92ZCdB6K4/jc0m+YnMtHmJVA                                                                
 +BfvpAgMBAAGjggINMIICCTAdBgNVHQ4EFgQUdahxYEyIE/B42Yl3tW3Fid+8sXow                                                                
 +gaMGA1UdIwSBmzCBmIAUFrUyG9TH8+DmjvO90rA67rI5GNGhfaR7MHkxEDAOBgNV                                                                
 +BAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEiMCAG                                                                
 +A1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYS                                                                
 +c3VwcG9ydEBjYWNlcnQub3JnggEAMA8GA1UdEwEB/wQFMAMBAf8wXQYIKwYBBQUH                                                                
 +AQEEUTBPMCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5DQWNlcnQub3JnLzAoBggr                                                                
 +BgEFBQcwAoYcaHR0cDovL3d3dy5DQWNlcnQub3JnL2NhLmNydDBKBgNVHSAEQzBB                                                                
 +MD8GCCsGAQQBgZBKMDMwMQYIKwYBBQUHAgEWJWh0dHA6Ly93d3cuQ0FjZXJ0Lm9y                                                                
 +Zy9pbmRleC5waHA/aWQ9MTAwNAYJYIZIAYb4QgEIBCcWJWh0dHA6Ly93d3cuQ0Fj                                                                
 +ZXJ0Lm9yZy9pbmRleC5waHA/aWQ9MTAwUAYJYIZIAYb4QgENBEMWQVRvIGdldCB5                                                                
 +b3VyIG93biBjZXJ0aWZpY2F0ZSBmb3IgRlJFRSwgZ28gdG8gaHR0cDovL3d3dy5D                                                                
 +QWNlcnQub3JnMA0GCSqGSIb3DQEBCwUAA4ICAQApKIWuRKm5r6R5E/CooyuXYPNc                                                                
 +7uMvwfbiZqARrjY3OnYVBFPqQvX56sAV2KaC2eRhrnILKVyQQ+hBsuF32wITRHhH                                                                
 +Va9Y/MyY9kW50SD42CEH/m2qc9SzxgfpCYXMO/K2viwcJdVxjDm1Luq+GIG6sJO4                                                                
 +D+Pm1yaMMVpyA4RS5qb1MyJFCsgLDYq4Nm+QCaGrvdfVTi5xotSu+qdUK+s1jVq3                                                                
 +VIgv7nSf7UgWyg1I0JTTrKSi9iTfkuO960NAkW4cGI5WtIIS86mTn9S8nK2cde5a                                                                
 +lxuV53QtHA+wLJef+6kzOXrnAzqSjiL2jA3k2X4Ndhj3AfnvlpaiVXPAPHG0HRpW                                                                
 +Q7fDCo1y/OIQCQtBzoyUoPkD/XFzS4pXM+WOdH4VAQDmzEoc53+VGS3FpQyLu7Xt                                                                
 +hbNc09+4ufLKxw0BFKxwWMWMjTPUnWajGlCVI/xI4AZDEtnNp4Y5LzZyo4AQ5OHz                                                                
 +0ctbGsDkgJp8E3MGT9ujayQKurMcvEp4u+XjdTilSKeiHq921F73OIZWWonO1sOn                                                                
 +ebJSoMbxhbQljPI/lrMQ2Y1sVzufb4Y6GIIiNsiwkTjbKqGTqoQ/9SdlrnPVyNXT                                                                
 +d+pLncdBu8fA46A/5H2kjXPmEkvfoXNzczqA6NXLji/L6hOn1kGLrPo8idck9U60                                                                
 +4GGSt/M3mMS+lqO3ig==                                                                                                            
 +-----END CERTIFICATE-----                                                                                                       
 + 2 s:/O=Root CA/OU=http://www.cacert.org/CN=CA Cert Signing Authority/emailAddress=support@cacert.org                           
 +   i:/O=Root CA/OU=http://www.cacert.org/CN=CA Cert Signing Authority/emailAddress=support@cacert.org                           
 +-----BEGIN CERTIFICATE-----                                                                                                     
 +MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290                                                                
 +IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB                                                                
 +IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA                                                                
 +Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO                                                                
 +BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi                                                                
 +MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ                                                                
 +ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC                                                                
 +CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ                                                                
 +8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6                                                                
 +zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y                                                                
 +fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7
 +w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc
 +G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k
 +epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q
 +laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ
 +QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU
 +fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826
 +YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w
 +ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY
 +gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe
 +MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0
 +IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy
 +dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw
 +czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0
 +dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl
 +aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC
 +AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg
 +b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB
 +ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc
 +nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg
 +18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c
 +gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl
 +Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY
 +sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T
 +SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF
 +CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum
 +GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk
 +zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW
 +omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD
 +-----END CERTIFICATE-----
 +---
 +Server certificate
 +subject=/CN=openldap.dmz.nausch.org
 +issuer=/O=CAcert Inc./OU=http://www.CAcert.org/CN=CAcert Class 3 Root
 +---
 +No client certificate CA names sent
 +Server Temp Key: ECDH, prime256v1, 256 bits
 +---
 +SSL handshake has read 6065 bytes and written 399 bytes
 +---
 +New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-SHA
 +Server public key is 4096 bit
 +Secure Renegotiation IS supported
 +Compression: NONE
 +Expansion: NONE
 +SSL-Session:
 +    Protocol  : TLSv1.2
 +    Cipher    : ECDHE-RSA-AES128-SHA
 +    Session-ID: 1CB2A6EEF8A21B2239B011CFA0FF156F76A477FE8F883550762FDB0B2DACDBEC
 +    Session-ID-ctx:
 +    Master-Key: FFA99DDC9829B6171367B7428647D13F6D7BFA65582810158A10CEDF8B38C2295A4E6C3F8B3212672EC1974DCD1DDAB3
 +    Key-Arg   : None
 +    Krb5 Principal: None
 +    PSK identity: None
 +    PSK identity hint: None
 +    Start Time: 1437051157
 +    Timeout   : 7200 (sec)
 +    Verify return code: 0 (ok)
 +---</code>
 +
 +Mit der Tastenkombination **Strg + c** beenden wir die Verbindung.
 +
 +Im obigen Beispiel sehen wir, dass:
 +   * **Protokoll**: TLSv1.2
 +   * **Cipher**   : ECDHE-RSA-AES128-SHA 
 +und als temporärer Server-Key **ECDH, prime256v1, 256 bits** verwendet wurden.
 +
 +In der Logdatei unseres OpenLDAP-Servers wird der Connect entsprechend vermerkt.
 +   # less /var/log/ldap.log
 +
 +  Jul 16 14:53:37 vml000037 slapd[7346]: conn=1002 fd=13 ACCEPT from IP=10.0.0.37:41958 (IP=0.0.0.0:636)
 +  Jul 16 14:53:37 vml000037 slapd[7346]: conn=1002 fd=13 TLS established tls_ssf=128 ssf=128
 +  Jul 16 14:53:45 vml000037 slapd[7346]: conn=1002 fd=13 closed (connection lost)
 +
 +==== ldapsearch ====
 +Beim nächsten Test verwenden wir den Befehl **ldapsearch** und richten über eine geschützte TLS-Verbindung eine Anfrage an unseren OpenLDAP-Verzeichnisdienst.
 +   # ldapsearch -W -x -D cn=config -b cn=config "(objectclass=olcGlobal)" -LLL -H ldaps://openldap.dmz.nausch.org
 +
 +  Enter LDAP Password:
 +
 +<code>dn: cn=config
 +objectClass: olcGlobal
 +cn: config
 +olcArgsFile: /var/run/openldap/slapd.args
 +olcIdleTimeout: 30
 +olcPidFile: /var/run/openldap/slapd.pid
 +olcReferral: ldap://openldap.dmz.nausch.org
 +olcTimeLimit: 15
 +olcTLSCACertificateFile: /etc/pki/tls/certs/CAcert_chain.pem
 +olcTLSCACertificatePath: /etc/openldap/certs
 +olcTLSCertificateFile: /etc/pki/tls/certs/openldap.dmz.nausch.org.pem
 +olcTLSCertificateKeyFile: /etc/pki/tls/private/openldap_serverkey.pem
 +olcTLSCipherSuite: HIGH
 +olcTLSDHParamFile: /etc/pki/tls/private/dh_4096.pem
 +olcTLSProtocolMin: 3.1
 +</code>
 +
 +Der Verbindungsauf- wie auch -abbau und natürlich auch die Abfrage an sich, wird im LDAP-Log //**/var/log/ldap.log**// dokumentiert.
 +   # less /var/log/ldap.log
 +
 +<code>Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 fd=13 ACCEPT from IP=10.0.0.37:43011 (IP=0.0.0.0:636)
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 fd=13 TLS established tls_ssf=128 ssf=128
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=0 BIND dn="cn=config" method=128
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=0 BIND dn="cn=config" mech=SIMPLE ssf=0
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=0 RESULT tag=97 err=0 text=
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=1 SRCH base="cn=config" scope=2 deref=0 filter="(objectClass=olcGlobal)"
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 op=2 UNBIND
 +Jul 16 15:49:32 vml000037 slapd[11436]: conn=1006 fd=13 closed</code>
  
  
 +====== Links ======
 +  * **⇐ [[centos:ldap_c7:install|Zurück zum Kapitel "OpenLDAP Server unter CentOS 7.x installieren und einrichten"]]**
 +  * **⇒ [[centos:ldap_c7:data|Weiter zum Kapitel "Datenerstbefüllung des OpenLDAP Servers unter CentOS 7.x"]]**
 +  * **[[centos:ldap_c7:start|Zurück zum Kapitel >>OpenLDAP Server unter CentOS 7.x<<]]**
 +  * **[[wiki:start|Zurück zu >>Projekte und Themenkapitel<<]]**
 +  * **[[http://dokuwiki.nausch.org/doku.php/|Zurück zur Startseite]]**
  
  
-FIXME 
  • centos/ldap_c7/ldaps.1436986761.txt.gz
  • Zuletzt geändert: 15.07.2015 18:59.
  • von django