Skip to content

Commit f76b630

Browse files
authored
Merge pull request #1 from jayalpes/jayalpes-patch-ldap_param
Update checkLdapPwdExpiration.sh
2 parents 026c70b + 3cbc1f2 commit f76b630

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

checkLdapPwdExpiration.sh

+17-4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@
7474
#
7575
MY_LDAP_HOSTURI="ldap://localhost:389"
7676

77+
#
78+
# LDAP custom parameters
79+
# eg: -E pr=500/noprompt
80+
# eg: -o ldif-wrap=no
81+
# eg: -Q -Y EXTERNAL
82+
# eg (default): -x
83+
#
84+
# For Authentication use : -E pr=500/noprompt -o ldif-wrap=no -x
85+
# For socket use : -E pr=500/noprompt -o ldif-wrap=no -Q -Y EXTERNAL
86+
#
87+
#LDAP_PARAM="-E pr=500/noprompt -o ldif-wrap=no -x"
88+
7789
#
7890
# LDAP root DN (optional)
7991
# eg: cn=Manager,dc=example,dc=com
@@ -135,12 +147,11 @@ MY_LDAP_MAIL_ATTR=mail
135147
#
136148
export LC_ALL=en_US.UTF-8
137149

138-
139150
#
140151
# Mail from
141-
#MY_MAIL_FROM=""
142-
143152
#
153+
#MY_MAIL_FROM="[email protected]"
154+
144155
# Mail body message, with particular variables :
145156
# %name : user name
146157
# %login : user login
@@ -222,7 +233,9 @@ getTimeInSeconds() {
222233
tmp_dir="/tmp/$$.checkldap.tmp"
223234
result_file="${tmp_dir}/res.tmp.1"
224235
buffer_file="${tmp_dir}/buf.tmp.1"
225-
ldap_param="-LLL -H ${MY_LDAP_HOSTURI} -x"
236+
[ -z "${LDAP_PARAM}" ] && LDAP_PARAM="-x" # default authorization
237+
echo "${LDAP_PARAM}" | grep -E "Q|Y|x" 1>/dev/null || LDAP_PARAM="${LDAP_PARAM} -x"
238+
ldap_param="${LDAP_PARAM} -LLL -H ${MY_LDAP_HOSTURI}"
226239
nb_users=0
227240
nb_expired_users=0
228241
nb_warning_users=0

0 commit comments

Comments
 (0)