diff --git a/cluster/auto.create.all.dir.sh b/cluster/auto.create.all.dir.sh index 15ac2e6..dfd051e 100755 --- a/cluster/auto.create.all.dir.sh +++ b/cluster/auto.create.all.dir.sh @@ -12,8 +12,8 @@ group_cn="ur1:div:lab:r423:ipr:app:calcul:util_calcul" group_base="ou=grouper,dc=univ-rennes1,dc=fr" ldap_url="ldap://ldap.univ-rennes1.fr" -ldap_user=$(sed -n 's/\(^ldap_default_bind_dn = \)\(.*\)/\2/p' /etc/sssd/sssd.conf) -ldap_tok=$(find /etc/sssd/conf.d -type f -exec sed -n 's/\(^ldap_default_authtok = \)\(.*\)/\2/p' {} \; -quit) +ldap_user=$(sed -n 's/\(^binddn \)\(.*\)/\2/p' /etc/nslcd.conf) +ldap_passwd=$(sed -n 's/\(^bindpw \)\(.*\)/\2/p' /etc/nslcd.conf) new_user_list_path="/tmp/cluster.user.list" old_user_list_path="/tmp/cluster.user.list.old" @@ -43,7 +43,7 @@ if [ -s "${new_user_list_path}" ]; then exit 1 else [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : New User list — Get the user list." - if command ldapsearch -ZZ -D "${ldap_user}" -w "${ldap_tok}" -H "${ldap_url}" -s one -b "${group_base}" "(cn=${group_cn})" member | sed -n 's/\(^member: uid=\)\(.*\)\(,ou=.*\)/\2/p' > "${new_user_list_path}"; then + if command ldapsearch -ZZ -D "${ldap_user}" -w "${ldap_passwd}" -H "${ldap_url}" -s one -b "${group_base}" "(cn=${group_cn})" member | sed -n 's/\(^member: uid=\)\(.*\)\(,ou=.*\)/\2/p' > "${new_user_list_path}"; then if [ -s "${new_user_list_path}" ]; then [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : New User list — ${new_user_list_path} successfully created." command chmod 0400 -- "${new_user_list_path}"