Tool

Check Certificate Expiration Perl Script

Author Info

29 May 2009 - 11:02am
Submitted by: rridley

tool
Reads:

1507

Score:
0
0
 
Comments:

2

license: 
GPL

The script will report if a certificate is expired, if it expires today, or if it will expire within a month.

I use Net::LDAP and Date::Manip in the perl script. The corresponding packages on SLES are:

  • perl
  • perl-DateManip
  • perl-ldap

The options needed for the script to run are:

checkcerts.pl LDAP-IP-or-DNS-name Bind-DN Bind-password

Example:

checkcerts.pl 10.20.30.40 cn=admin,o=novell novell

The user that is used for this script only needs to have the following rights:

Entry: Browse, Inherit (for the entire tree)
Attribute: ObjectClass & ndspkinotafter - Read, Compare, Inherit

The easiest way to use this script would be to create a cron job on one server that runs once a week.

An example for the script results to be emailed to idmadmins:

/usr/local/bin/certreport.pl 10.20.30.40 cn=admin,o=novell password | nail -s "Certificate Expiration Report for `date -I`" -r certreport@mydomain.com idmadmins@mydomain.com

You would need to create a job for each tree you want to monitor.

The following example would run against the 10.20.30.40 tree at 1:00AM every Saturday:

0 1 * * 6  /usr/local/bin/certreport.pl 10.20.30.40 cn=admin,o=novell password | nail -s "Certificate Expiration Report for `date -I`" -r certreport@mydomain.com idmadmins@mydomain.com

AttachmentSize
checkcerts.tgz721 bytes

Author Info

29 May 2009 - 11:02am
Submitted by: rridley




User Comments

No output

Submitted by mo71211 on 4 September 2009 - 11:02am.

I ran the script and followed the example. And it produced no output. Am I doing something wrong?

If it produced no output and

Submitted by rridley on 4 September 2009 - 12:49pm.

If it produced no output and did not provide an error then you don't have any expired (or soon to expire) certificates. The user used to login to the tree should also have enough rights to browse the tree and read the ndspkinotafter attribute on the certificate objects (the ndspkikeymaterial objectclass).

© 2009 Novell, Inc. All Rights Reserved.