{"id":1902,"date":"2019-01-04T00:14:29","date_gmt":"2019-01-03T21:14:29","guid":{"rendered":"http:\/\/kifarunix.com\/?p=1902"},"modified":"2019-01-04T12:40:49","modified_gmt":"2019-01-04T09:40:49","slug":"configure-openldap-client-on-debian-9-stretch","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/configure-openldap-client-on-debian-9-stretch\/","title":{"rendered":"Configure OpenLDAP Client on Debian 9 Stretch"},"content":{"rendered":"<p>This articles describes how to configure OpenLDAP client on Debian 9 Stretch. You can check our previous article on how to <a href=\"https:\/\/kifarunix.com\/install-and-configure-openldap-server-on-debian-9-stretch\/\" target=\"_blank\" rel=\"noopener\">install and configure OpenLDAP Server on Debian 9 Stretch<\/a>.<\/p>\n<h2>Install and Configure OpenLDAP Client on Debian 9 Stretch<\/h2>\n<p>Install the required packages.<\/p>\n<pre>apt -y install libnss-ldap libpam-ldap ldap-utils<\/code><\/pre>\n<h2>Configure OpenLDAP client on Debian 9 Stretch<\/h2>\n<p>During the installation process, you will receive different configuration prompts.<\/p>\n<p>Define LDAP server&#8217;s URI.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-uri.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1903\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-uri.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1776\" height=\"416\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-uri.png 1776w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-uri-768x180.png 768w\" sizes=\"(max-width: 1776px) 100vw, 1776px\" \/><\/a><\/p>\n<p>Set the distinguished name of the LDAP search base.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-base-dn.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1904\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-base-dn.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1835\" height=\"355\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-base-dn.png 1835w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-base-dn-768x149.png 768w\" sizes=\"(max-width: 1835px) 100vw, 1835px\" \/><\/a><\/p>\n<p>Specify LDAP protocol version.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-version.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1905\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-version.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1690\" height=\"385\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-version.png 1690w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-version-768x175.png 768w\" sizes=\"(max-width: 1690px) 100vw, 1690px\" \/><\/a><\/p>\n<p>Set the LDAP administrator suffix.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1906\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1836\" height=\"417\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix.png 1836w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix-768x174.png 768w\" sizes=\"(max-width: 1836px) 100vw, 1836px\" \/><\/a><\/p>\n<p>Enter the LDAP admin account password for libnss-ldap LDAP authentication.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1907\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1489\" height=\"448\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password.png 1489w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password-768x231.png 768w\" sizes=\"(max-width: 1489px) 100vw, 1489px\" \/><\/a><\/p>\n<p>On nsswitch configuration, select Ok and press Enter to proceed. We will configure nsswitch later.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/nsswitch.conf_.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1908\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/nsswitch.conf_.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1869\" height=\"386\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/nsswitch.conf_.png 1869w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/nsswitch.conf_-768x159.png 768w\" sizes=\"(max-width: 1869px) 100vw, 1869px\" \/><\/a><\/p>\n<p>Allow LDAP admin account to assume local root behavior. This allows using the usual <code class=\"command\">passwd<\/code> command for changing passwords stored in the LDAP database.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-local-account.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1909\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-local-account.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1345\" height=\"417\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-local-account.png 1345w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-local-account-768x238.png 768w\" sizes=\"(max-width: 1345px) 100vw, 1345px\" \/><\/a><\/p>\n<p>Disable LDAP database login requirement.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/disable-database-login.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1910\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/disable-database-login.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1034\" height=\"356\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/disable-database-login.png 1034w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/disable-database-login-768x264.png 768w\" sizes=\"(max-width: 1034px) 100vw, 1034px\" \/><\/a><\/p>\n<p>Enter LDAP administrator account suffix.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix-1-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1912\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix-1-1.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1534\" height=\"386\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix-1-1.png 1534w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-suffix-1-1-768x193.png 768w\" sizes=\"(max-width: 1534px) 100vw, 1534px\" \/><\/a><\/p>\n<p>Set the LDAP administrator account password. Press Enter to complete installation and configuration.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1913\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password-1.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"1777\" height=\"479\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password-1.png 1777w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-admin-password-1-768x207.png 768w\" sizes=\"(max-width: 1777px) 100vw, 1777px\" \/><\/a><\/p>\n<p>Modify <code>nsswitch.conf<\/code> to use ldap datasource such that it looks like;.<\/p>\n<pre>vim \/etc\/nsswitch.conf<\/code><\/pre>\n<pre>...\r\npasswd:         compat\t<strong>ldap<\/strong>\r\ngroup:          compat\t<strong>ldap<\/strong>\r\nshadow:         compat\t<strong>ldap<\/strong>\r\ngshadow:        files\r\n...<\/code><\/pre>\n<p>Edit the <code>\/etc\/pam.d\/common-password<\/code> and remove the <code>use_authtok<\/code> on the highlighted line below. <code>use_authtok<\/code>\u00a0 causes the PAM module to use the earlier provided password when changing the password..<\/p>\n<pre>vim \/etc\/pam.d\/common-password<\/code><\/pre>\n<pre>...\r\n# here are the per-package modules (the \"Primary\" block)\r\npassword\t[success=2 default=ignore]\tpam_unix.so obscure sha512\r\n<strong>password\t[success=1 user_unknown=ignore default=die]\tpam_ldap.so try_first_pass<\/strong>\r\n# here's the fallback if no module succeeds\r\npassword\trequisite\t\t\tpam_deny.so\r\n# prime the stack with a positive return value if there isn't one already;\r\n...<\/code><\/pre>\n<p>To enable automatic user home directory creation at first login, add the line <code>session optional pam_mkhomedir.so skel=\/etc\/skel umask=077<\/code> to the <code>\/etc\/pam.d\/common-session<\/code> between the <code>pam_ldap.so<\/code> and <code>pam_systemd.so<\/code>.<\/p>\n<pre>vim \/etc\/pam.d\/common-session<\/code><\/pre>\n<pre># and here are more per-package modules (the \"Additional\" block)\r\nsession\trequired\tpam_unix.so \r\nsession\toptional\t\t\tpam_ldap.so \r\n<strong>session optional        pam_mkhomedir.so skel=\/etc\/skel umask=077<\/strong>\r\nsession\toptional\tpam_systemd.so \r\n# end of pam-auth-update config<\/code><\/pre>\n<p>Reboot the LDAP client for the changes to take effect. After reboot, try logging in as an LDAP user. See screenshot below.<\/p>\n<p><a href=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-client-login-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1926 size-full\" src=\"http:\/\/kifarunix.com\/wp-content\/uploads\/2019\/01\/ldap-client-login-1.png\" alt=\"Configure OpenLDAP Client on Debian 9 Stretch\" width=\"721\" height=\"400\" title=\"\"><\/a><\/p>\n<p>You have successfully authenticated to Debian 9 Strecth as an LDAP user.<\/p>\n<p>That is all it takes configure OpenLDAP client on Debian 9 Stretch. In our next article, we will discuss how to configure LDAP client to use SSSD for LDAP authentication on Debian 9 stretch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This articles describes how to configure OpenLDAP client on Debian 9 Stretch. You can check our previous article on how to install and configure OpenLDAP<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[285,121],"tags":[],"class_list":["post-1902","post","type-post","status-publish","format-standard","hentry","category-directory-server","category-howtos","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1902"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=1902"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1902\/revisions"}],"predecessor-version":[{"id":1927,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1902\/revisions\/1927"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=1902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=1902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=1902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}