of course it is okay for that dir to already exist...
[lets-encrypt-tiny.git] / certcheck
1 #!/usr/bin/python3
2 ## Call with "--help" for documentation.
3
4 import argparse, certcheck, os
5
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()
13
14 for name in args.certs:
15     if os.path.isdir(name):
16         certcheck.check_dir(name, args.days)
17     else:
18         certcheck.check_file(name, args.days)