From 39b84ec2f8dc0f29881ac6246e96df16eefde987 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Thu, 23 Jul 2020 01:05:36 -0400 Subject: [PATCH] debian 10 --- index.sh | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/index.sh b/index.sh index e2862c6..0f281fa 100755 --- a/index.sh +++ b/index.sh @@ -15,23 +15,47 @@ export ldap_bind_password=$2 export current_host=`hostname` -echo "ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap://$ldap_host" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/bindpw string $ldap_bind_password" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/rootbindpw string $ldap_admin_password" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/dbrootlogin boolean true" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/dblogin boolean true" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/ldapns/ldap_version string 3" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/pam_password string md5" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/ldapns/base-dn string $ldap_base_dn" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/move-to-debconf boolean true" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/rootbinddn string $ldap_admin_dn" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/binddn string $ldap_bind_dn" | debconf-set-selections -echo "ldap-auth-config ldap-auth-config/override boolean true" | debconf-set-selections + +if grep -qiE "^NAME=\"debian" /etc/os-release; then + + echo "libnss-ldap libnss-ldap/rootbindpw string $ldap_admin_password" | debconf-set-selections + echo "libnss-ldap libnss-ldap/bindpw string $ldap_bind_password" | debconf-set-selections + echo "libnss-ldap libnss-ldap/dbrootlogin boolean true" | debconf-set-selections + echo "libnss-ldap libnss-ldap/binddn string $ldap_bind_dn" | debconf-set-selections + echo "libnss-ldap libnss-ldap/confperm boolean false" | debconf-set-selections + echo "libnss-ldap libnss-ldap/rootbinddn string $ldap_admin_dn" | debconf-set-selections + echo "libnss-ldap libnss-ldap/dblogin boolean false" | debconf-set-selections + echo "libnss-ldap libnss-ldap/override boolean true" | debconf-set-selections + echo "shared shared/ldapns/ldap-server string ldap://$ldap_host" | debconf-set-selections + echo "shared shared/ldapns/base-dn string $ldap_base_dn" | debconf-set-selections + echo "shared shared/ldapns/ldap_version string 3" | debconf-set-selections + echo "libpam-ldap libpam-ldap/bindpw string $ldap_bind_password" | debconf-set-selections + echo "libpam-ldap libpam-ldap/rootbindpw string $ldap_admin_password" | debconf-set-selections + echo "libpam-ldap libpam-ldap/dblogin boolean true" | debconf-set-selections + echo "libpam-ldap libpam-ldap/pam_password string crypt" | debconf-set-selections + echo "libpam-ldap libpam-ldap/rootbinddn string $ldap_admin_dn" | debconf-set-selections + echo "libpam-ldap libpam-ldap/override boolean true" | debconf-set-selections + echo "libpam-ldap libpam-ldap/binddn string $ldap_bind_dn" | debconf-set-selections + echo "libpam-ldap libpam-ldap/dbrootlogin boolean true" | debconf-set-selections + +else + echo "ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap://$ldap_host" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/bindpw string $ldap_bind_password" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/rootbindpw string $ldap_admin_password" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/dbrootlogin boolean true" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/dblogin boolean true" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/ldapns/ldap_version string 3" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/pam_password string md5" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/ldapns/base-dn string $ldap_base_dn" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/move-to-debconf boolean true" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/rootbinddn string $ldap_admin_dn" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/binddn string $ldap_bind_dn" | debconf-set-selections + echo "ldap-auth-config ldap-auth-config/override boolean true" | debconf-set-selections +fi DEBIAN_FRONTEND=noninteractive apt install -y libnss-ldap libpam-ldap ldap-utils nscd if which auth-client-config >/dev/null; then auth-client-config -t nss -p lac_ldap - else sed -i '/passwd/ s/$/ ldap/' /etc/nsswitch.conf sed -i '/group/ s/$/ ldap/' /etc/nsswitch.conf