classes:la_slapd
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
classes:la_slapd [2016/12/15 14:34] – curry_searle | classes:la_slapd [2016/12/15 20:43] (current) – curry_searle | ||
---|---|---|---|
Line 2: | Line 2: | ||
The outline of this tutorial contains the following sections: | The outline of this tutorial contains the following sections: | ||
- | - Server: Configure OpenLDAP and add users | + | - [[classes: |
- | - Server: Configure NFS to export home directories | + | - [[classes: |
- | - Client: Configure PAM to authenticate using our OpenLDAP directory | + | - [[classes: |
- | - Client: Configure AutoFS to auto-mount user home directories from the server to the client | + | - [[classes: |
- | For this tutorial we will create three users in our LDAP directory, Tom, Olive and Kevin; all with the password of '' | + | For this tutorial we will create three users in our LDAP directory, Tom, Olive and Kevin; all with the password of '' |
- | === Server: Configure OpenLDAP and add users === | ||
- | Let's get started by logging into our server and installing OpenLDAP: | ||
- | < | ||
- | sudo apt-get -y install slapd ldap-utils | ||
- | </ | ||
- | |||
- | When prompted, enter a password for your LDAP '' | ||
- | |||
- | Now we need to finalize the OpenLDAP configuration by running '' | ||
- | < | ||
- | sudo dpkg-reconfigure slapd | ||
- | </ | ||
- | |||
- | Using your favorite editor, modify / | ||
- | < | ||
- | TLS_CACERT | ||
- | |||
- | BASE dc=itsm, | ||
- | URI ldap:// | ||
- | </ | ||
- | |||
- | Restart the ldap service to reload the new configuration: | ||
- | < | ||
- | sudo service slapd restart | ||
- | </ | ||
- | |||
- | Confirm the slapd service is running; you should see a line, '' | ||
- | < | ||
- | service slapd status | ||
- | ● slapd.service - LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol) | ||
- | | ||
- | | ||
- | Docs: man: | ||
- | Tasks: 3 | ||
- | | ||
- | CPU: 52ms | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | Confirm your ldap server is answering requests by giving it a simple request: | ||
- | < | ||
- | ldapsearch -x | ||
- | # extended LDIF | ||
- | # | ||
- | # LDAPv3 | ||
- | # base < | ||
- | # filter: (objectclass=*) | ||
- | # requesting: ALL | ||
- | # | ||
- | |||
- | # itsm.unt.edu | ||
- | dn: dc=itsm, | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | o: unt.edu | ||
- | dc: itsm | ||
- | |||
- | # admin, itsm.unt.edu | ||
- | dn: cn=admin, | ||
- | objectClass: | ||
- | objectClass: | ||
- | cn: admin | ||
- | description: | ||
- | |||
- | # search result | ||
- | search: 2 | ||
- | result: 0 Success | ||
- | |||
- | # numResponses: | ||
- | # numEntries: 2 | ||
- | </ | ||
- | like this | ||
- | Now that we have our LDAP server running, lets populate it with some users. Create a file named '' | ||
- | < | ||
- | dn: uid=tom, | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | cn: tom | ||
- | uid: tom | ||
- | uidNumber: 5010 | ||
- | gidNumber: 9010 | ||
- | homeDirectory: | ||
- | loginShell: /bin/bash | ||
- | gecos: tom | ||
- | userPassword: | ||
- | shadowLastChange: | ||
- | shadowMax: 0 | ||
- | shadowWarning: | ||
- | |||
- | dn: uid=olive, | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | cn: olive | ||
- | uid: olive | ||
- | uidNumber: 5011 | ||
- | gidNumber: 9011 | ||
- | homeDirectory: | ||
- | loginShell: /bin/bash | ||
- | gecos: olive | ||
- | userPassword: | ||
- | shadowLastChange: | ||
- | shadowMax: 0 | ||
- | shadowWarning: | ||
- | |||
- | dn: uid=kevin, | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | objectClass: | ||
- | cn: kevin | ||
- | uid: kevin | ||
- | uidNumber: 5012 | ||
- | gidNumber: 9012 | ||
- | homeDirectory: | ||
- | loginShell: /bin/bash | ||
- | gecos: kevin | ||
- | userPassword: | ||
- | shadowLastChange: | ||
- | shadowMax: 0 | ||
- | shadowWarning: | ||
- | </ | ||
- | |||
- | Now that we have a data file containing user information, | ||
- | < | ||
- | ldapadd -a -D ' | ||
- | Enter LDAP Password: | ||
- | adding new entry " | ||
- | |||
- | adding new entry " | ||
- | |||
- | adding new entry " | ||
- | </ | ||
- | |||
- | We can confirm the users were added by performing another '' | ||
- | < | ||
- | ldapsearch -x objectClass=account dn cn uidnumber gidnumber | ||
- | # extended LDIF | ||
- | # | ||
- | # LDAPv3 | ||
- | # base < | ||
- | # filter: objectClass=account | ||
- | # requesting: dn cn uidnumber gidnumber | ||
- | # | ||
- | |||
- | # tom, itsm.unt.edu | ||
- | dn: uid=tom, | ||
- | cn: tom | ||
- | uidNumber: 5010 | ||
- | gidNumber: 9010 | ||
- | |||
- | # olive, itsm.unt.edu | ||
- | dn: uid=olive, | ||
- | cn: olive | ||
- | uidNumber: 5011 | ||
- | gidNumber: 9011 | ||
- | |||
- | # kevin, itsm.unt.edu | ||
- | dn: uid=kevin, | ||
- | cn: kevin | ||
- | uidNumber: 5012 | ||
- | gidNumber: 9012 | ||
- | |||
- | # search result | ||
- | search: 2 | ||
- | result: 0 Success | ||
- | |||
- | # numResponses: | ||
- | # numEntries: 3 | ||
- | </ | ||
- | |||
- | That's all for this section on configuring OpenLDAP and adding our users. Join me in the next section as we configure NFS to export home directories. | ||
- | |||
- | === Server: Configure NFS to export home directories to a client system === | ||
- | |||
- | This section covers configuring NFS to export filesystems to remote computers. For the purpose of this tutorial, our remote filesystems will be the home directories of users defined in our OpenLDAP directory. Let's jump right in on our server and install NFS then make a directory to store our user home directories: | ||
- | < | ||
- | sudo apt-get -y install nfs-kernel-server | ||
- | sudo mkdir -p / | ||
- | </ | ||
- | |||
- | The file ''/ | ||
- | < | ||
- | /home | ||
- | </ | ||
- | |||
- | Start the nfs-kernel-server service and confirm there are no errors: | ||
- | < | ||
- | sudo service nfs-kernel-server start | ||
- | sudo service nfs-kernel-server status | ||
- | </ | ||
- | |||
- | Confirm the filesystem is being exported to the system we expected using the '' | ||
- | < | ||
- | showmount -e | ||
- | |||
- | Export list for cls-kvm1: | ||
- | /home cls-kvm2.itsm.unt.edu | ||
- | </ | ||
- | |||
- | Edit ''/ | ||
- | < | ||
- | /nfs / | ||
- | </ | ||
- | |||
- | === Client: Configure PAM authentication to use LDAP === | ||
- | |||
- | Now that we have our OpenLDAP server configured and populated with users, we can move on to configuring our linux workstation to authenticate using our LDAP directory. | ||
- | |||
- | Logon to the client system ('' | ||
- | < | ||
- | sudo apt-get -y install ldap-auth-client nscd autofs | ||
- | </ | ||
- | |||
- | Configure ldap-auth-config: | ||
- | < | ||
- | sudo dpkg-reconfigure ldap-auth-config | ||
- | </ | ||
- | |||
- | Include the following settings: | ||
- | < | ||
- | LDAP Server URI: ldap:// | ||
- | Distinguised name of the search base: dc=itsm, | ||
- | LDAP version to use: 3 | ||
- | Make local root Database admin: Yes | ||
- | Does the LDAP require login: No | ||
- | LDAP account for root: cn=admin, | ||
- | LDAP root account password | ||
- | </ | ||
- | |||
- | Configure NSS authentication client for LDAP: | ||
- | < | ||
- | sudo auth-client-config -t nss -p lac_ldap | ||
- | </ | ||
- | - /etc/auth | ||
- | |||
- | Update PAM configuration: | ||
- | < | ||
- | sudo pam-auth-update | ||
- | </ | ||
- | Ensure the following are checked and choose Ok: | ||
- | < | ||
- | PAM profiles to enable: | ||
- | * Unix authentication | ||
- | * LDAP Authentication | ||
- | * Register user sessions in the systemd control group hierarchy | ||
- | </ | ||
- | |||
- | Restart the NSCD service: | ||
- | < | ||
- | sudo service nscd restart | ||
- | </ | ||
- | |||
- | Edit ''/ | ||
- | < | ||
- | # | ||
- | password | ||
- | </ | ||
- | |||
- | Confirm the client sees the LDAP accounts as available for authentication; | ||
- | < | ||
- | getent passwd | ||
- | ... | ||
- | tom: | ||
- | olive: | ||
- | kevin: | ||
- | </ | ||
- | |||
- | Test authentication using '' | ||
- | < | ||
- | su - kevin | ||
- | Password: | ||
- | No directory, logging in with HOME=/ | ||
- | groups: cannot find name for group ID 9012 | ||
- | kevin@cls-kvm2:/ | ||
- | </ | ||
- | |||
- | In the next step we will resolve the '' | ||
- | |||
- | === Configure AutoFS to auto-mount user home directories === | ||
- | On the client machine (cls-kvm2), install our AutoFS dependencies: | ||
- | < | ||
- | sudo apt-get install autofs oddjob-mkhomedir | ||
- | </ | ||
- | |||
- | Add a line to ''/ | ||
- | < | ||
- | sudo sh -ec 'echo /nfs \\t/ | ||
- | </ | ||
- | |||
- | Create ''/ | ||
- | < | ||
- | sudo sh -ec 'echo cls-kvm1 \\tcls-kvm1.itsm.unt.edu:/ | ||
- | </ | ||
- | |||
- | Create ''/ | ||
- | < | ||
- | sudo sh -ec 'echo *\\tcls-kvm1.itsm.unt.edu:/ | ||
- | </ | ||
- | |||
- | Restart '' | ||
- | < | ||
- | sudo service autofs restart | ||
- | sudo service autofs status | ||
- | </ | ||
classes/la_slapd.1481841246.txt.gz · Last modified: 2016/12/15 14:34 by curry_searle