Changes between Version 1 and Version 2 of ldapiam2018


Ignore:
Timestamp:
Sep 4, 2018, 6:45:13 AM (6 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ldapiam2018

    v1 v2  
    2020* Move old database? '''Yes'''
    2121=== Create the Certificate Templates ===
    22 
    2322To encrypt our connections, we'll need to configure a certificate authority and use it to sign the keys for the LDAP server(s) in our infrastructure. So for our single server setup, we will need two sets of key/certificate pairs: one for the certificate authority itself and one that is associated with the LDAP service.
    24 
    2523To create the certificates needed to represent these entities, we'll create some template files. These will contain the information that the certtool utility needs in order to create certificates with the appropriate properties.
    26 
    2724Start by making a directory to store the template files:
    28 
    2925{{{
    3026sudo mkdir /etc/ssl/templates
    3127}}}
    32 
    3328Create the template for the certificate authority first. We'll call the file ca_server.conf. Create and open the file in your text editor:
    34 
    3529{{{
    3630sudo nano /etc/ssl/templates/ca_server.conf
    3731}}}
    38 
    3932We only need to provide a few pieces of information in order to successfully create a certificate authority. We need to specify that the certificate will be for a CA (certificate authority) by adding the ca option. We also need the cert_signing_key option to give the generated certificate the ability to sign additional certificates. We can set the cn to whatever descriptive name we'd like for our certificate authority:
    40 
    4133{{{
    4234cn = LDAP Server CA
     
    4436cert_signing_key
    4537}}}
    46 
    4738Save and close the file.
    48 
    4939Next, we can create a template for our LDAP server certificate called ldap_server.conf. Create and open the file in your text editor with sudo privileges:
    50 
    51 ```
     40{{{
    5241sudo nano /etc/ssl/templates/ldap_server.conf
    53 ```
    54 
     42}}}
    5543Here, we'll provide a few different pieces of information. We'll provide the name of our organization and set the tls_www_server, encryption_key, and signing_key options so that our cert has the basic functionality it needs.
    56 
    5744The cn in this template must match the FQDN of the LDAP server. If this value does not match, the client will reject the server's certificate. We will also set the expiration date for the certificate. We'll create a 10 year certificate to avoid having to manage frequent renewals: `ldapserver.conf`
    58 
    5945{{{
    6046organization = "Name of your institution"
     
    11096}}}
    11197To make configuration changes, we need to target the cn=config entry of the configuration DIT. We need to specify that we are wanting to modify the attributes of the entry. Afterwards we need to add the `olcTLSCACertificateFile`, `olcCertificateFile`, and `olcCertificateKeyFile` attributes and set them to the correct file locations.
    112 
    11398The end result will look like this:
    11499{{{
     
    132117sudo service slapd force-reload
    133118}}}
    134 
    135119If you see some error while importing,
    136 
    137120Start your `slapd` in debug mode
    138 
    139 ```
     121{{{
    140122sudo service slapd stop
    141123sudo slapd -h ldapi:/// -u openldap -g openldap -d 65 -F /etc/ldap/slapd.d/ -d 65
    142 ```
     124}}}
    143125Then in another console,
    144 
    145 ```
     126{{{
    146127ldapmodify -H ldapi:// -Y EXTERNAL -f addcerts.ldif
    147 ```
    148 
     128}}}
    149129then `ctrl+c` to stop the debug mode on first console and start the service.
    150 
    151 ```
     130{{{
    152131sudo service slapd start
    153 ```
    154 
    155 
     132}}}
    156133Your clients can now be configured to encrypt their connections to the server over the conventional 'ldap://ldap.YOUR-DOMAIN:389' port by using STARTTLS.
    157 
    158 
    159134== Setting up the Client Machines ==
    160 
    161135In order to connect to the LDAP server and initiate a STARTTLS upgrade, the clients must have access to the certificate authority certificate and must request the upgrade.
    162136On the OpenLDAP Server
    163 
    164137If you are interacting with the OpenLDAP server from the server itself, you can set up the client utilities by copying the CA certificate and adjusting the client configuration file.
    165 
    166138First, copy the CA certificate from the `/etc/ssl/certs` directory to a file within the `/etc/ldap` directory. We will call this file ca_certs.pem. This file can be used to store all of the CA certificates that clients on this machine may wish to access. For our purposes, this will only contain a single certificate:
    167 
    168 ```
     139{{{
    169140sudo cp /etc/ssl/certs/ca_server.pem /etc/ldap/ca_certs.pem
    170 ```
     141}}}
    171142Now, we can adjust the system-wide configuration file for the OpenLDAP utilities. Open up the configuration file in your text editor with sudo privileges:
    172 
    173 ```
     143{{{
    174144sudo nano /etc/ldap/ldap.conf
    175 ```
    176 
     145}}}
    177146Adjust the value of the '''TLS_CACERT''' option to point to the file we just created:
    178 
    179 ```
     147{{{
    180148TLS_CACERT /etc/ldap/ca_certs.pem
    181149TLS_REQCERT allow
    182 ```
    183 
     150}}}
    184151Save and close the file.
    185152
    186153You should now be able to upgrade your connections to use STARTTLS by passing the '''-Z''' option when using the OpenLDAP utilities. You can force STARTTLS upgrade by passing it twice. Test this by typing:
    187 
    188 ```
     154{{{
    189155ldapwhoami -H ldap:// -x -ZZ
    190 ```
     156}}}
    191157This forces a STARTTLS upgrade. If this is successful, you should see:
    192 ```
     158{{{
    193159STARTTLS success
    194160
    195161anonymous
    196 ```
    197 
    198 ### Load eduPerson Schema.
    199 
     162}}}
     163=== Load eduPerson Schema ===
    200164Get the schema downloaded from [Eduperson.ldif](./eduperson-201602.ldif)
    201 
    202165Or the latest from `https://spaces.at.internet2.edu/display/macedir/LDIFs`
    203 
    204166Load it using:
    205 
    206 ```bash
     167{{{
    207168ldapadd -Y EXTERNAL -H ldapi:/// -f eduperson-201602.ldif
    208 ```
    209 
     169}}}
    210170Also Lets load The SChema for Academia, SCHAC.
    211171Get the schema downloaded from [SCHAC.ldif](./schac-20150413.ldif)
    212 
    213172Or the latest from `https://wiki.refeds.org/display/STAN/SCHAC+Releases`
    214 
    215173Load it using:
    216 
    217 ```bash
     174{{{
    218175ldapadd -Y EXTERNAL -H ldapi:/// -f schac-20150413.ldif
    219 ```
    220 
    221 ### Create User Structure
    222 
    223 Depending on your Institute's Requirement, you may create grouop as follows:
    224 
    225 ```
     176}}}
     177=== Create User Structure ===
     178Depending on your Institutes's Requirement, you may create group as follows:
     179{{{
    226180dn: ou=People,dc=YOUR-DOMAIN,dc=ac,dc=lk
    227181objectClass: organizationalUnit
     
    300254mail: testme@YOUR_DOMAIN
    301255eduPersonPrincipalName: testme@YOUR_DOMAIN
    302 
    303 ```
     256}}}
    304257
    305258Save the above as a ldif file and add it to your directory as
    306 
    307 `ldapadd -H ldap:// -x -D "cn=admin,dc=YOUR-DOMAIN,dc=ac,dc=lk" -W -Z -f path_to_file.ldif`
     259{{{
     260ldapadd -H ldap:// -x -D "cn=admin,dc=YOUR-DOMAIN,dc=ac,dc=lk" -W -Z -f path_to_file.ldif
     261}}}