2 ## Call with "--help" for documentation.
4 import argparse, certcheck, os
6 parser = argparse.ArgumentParser(description='Check for soon-to-expire (and already expired) certificates')
7 parser.add_argument("-d", "--days", metavar='N',
8 dest="days", type=int, default=14,
9 help="Warn about certificates valid for less than N (default 14).")
10 parser.add_argument("certs", metavar='CERTS', nargs='+',
11 help="These certificate files are checked. Directories are searched recursively for files called '*.crt'.")
12 args = parser.parse_args()
14 for name in args.certs:
15 if os.path.isdir(name):
16 certcheck.check_dir(name, args.days)
18 certcheck.check_file(name, args.days)