[ltb-dev] [LDAP Tool Box - Feature #295] checkLdapPwdExpiration.sh / minor issues

noreply at lsc-project.org noreply at lsc-project.org
Mon Jan 18 21:07:50 CET 2016

Issue #295 has been updated by Jarbas Peixoto Junior.

File checkLdapPwdExpiration.pl added

Clément OUDOT wrote:
> Jarbas Peixoto Junior wrote:
> > Clément OUDOT wrote:
> > > Sorry, can't reproduce the problem. This script is quite old, I think we will replace it with a Perl script.
> > 
> > Dear Clement, 
> > 
> > I am writing a *perl script* to check the validity of passwords and send e-mail notification of expired passwords and / or breathing.
> > 
> > Next week I finish and make available here.
> > 
> > If you find interesting you can use it in LTB Project.
> That would be great!

Hello Clément,
The following perl script promised.
If you need to, you can change as you wish.
The operation is simple: change the default settings in the script and put it in crontab.

I put like this:

00 21   * * * /root/atualiza-ldap/checkLdapPwdExpiration.pl > /var/www/html/checkLdapPwdExpiration/checkLdapPwdExpiration.csv 2> /var/www/html/checkLdapPwdExpiration/checkLdapPwdExpiration.txt

Feature #295: checkLdapPwdExpiration.sh / minor issues

Author: Benjamin Griese
Status: Assigned
Priority: Low
Assigned to: Clément OUDOT
Category: LDAP Scripts
Target version: ldap-scripts-0.4

while trying to get the expiration mails working I felt into some trouble getting users from my DIT for the below small issues:

searching for users didn't work for me, because my ou's are further branched in sub ou's:
@${MY_LDAP_SEARCHBIN} ${ldap_param} -s -one- -b "${MY_LDAP_SEARCHBASE}" \@

I simply fixed that by using sub instead of one:
@${MY_LDAP_SEARCHBIN} ${ldap_param} -s *sub* -b "${MY_LDAP_SEARCHBASE}" \@

The next problem was the different behaviour/syntax of cut on my system than expected in your script in below lines.
The problem was the character extraction at the beginning by character number 0:
@pwdChangedTime=`grep -w "pwdChangedTime:" ${buffer_file} | cut -d : -f 2 | cut -c 0-15 | sed "s/^ *//;s/ *$//"`@


@y=`echo ${pwdChangedTime} | cut -c 0-4`@

fixed by beginning at 1
@pwdChangedTime=`grep -w "pwdChangedTime:" ${buffer_file} | cut -d : -f 2 | cut -c 1-15 | sed "s/^ *//;s/ *$//"`@


@y=`echo ${pwdChangedTime} | cut -c 1-4`@

Maybe the problem only appears with my version of the coreutils where cut belongs to.

Thanks for your great work anyway. :)

My System: 
Stock OpenLDAP 2.4.20
coreutils-6.12-32.17 (provides /usr/bin/cut)

You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://tools.lsc-project.org/my/account
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ltb-project.org/pipermail/ltb-dev/attachments/20160118/d46e8a6f/attachment.htm>

More information about the ltb-dev mailing list