X-Git-Url: https://pwan.org/git/?p=certmaster.git;a=blobdiff_plain;f=scripts%2Fcertmaster-ca;h=7370ef3fee48de971da480582c151e313574edb4;hp=27e190ea55e6ea31fac1f93391dfc345fdaa8904;hb=1c44d82bc9270466521e8c8d5339d0213935f385;hpb=7e743092d11acb95be40a415c3a9207fd040a0cf diff --git a/scripts/certmaster-ca b/scripts/certmaster-ca index 27e190e..7370ef3 100755 --- a/scripts/certmaster-ca +++ b/scripts/certmaster-ca @@ -31,11 +31,17 @@ def parseargs(args): help='sign requests of hosts specified') parser.add_option('-c', '--clean', default=False, action="store_true", help="clean out all certs or csrs for the hosts specified") + parser.add_option("", "--list-signed", default=False, action="store_true", + help='list all signed certs') + parser.add_option("", "--list-cert-hash", default=False, action="store_true", + help="list the cert hash for signed certs") (opts, args) = parser.parse_args() - if not opts.list and not opts.sign and not opts.clean: + # gotta be a better way... + if not opts.list and not opts.sign and not opts.clean \ + and not opts.list_signed and not opts.list_cert_hash: parser.print_help() sys.exit(1) @@ -88,5 +94,29 @@ def main(args): return 0 + if opts.list_signed: + hostglobs = ["*"] + if args: + hostglobs = args + + signed_certs = cm.get_signed_certs(args) + + for i in signed_certs: + print i + + return 0 + + if opts.list_cert_hash: + hostglobs = ["*"] + if args: + hostglobs = args + + cert_hashes = cm.get_cert_hashes(hostglobs) + + for i in cert_hashes: + print i + + return 0 + if __name__ == "__main__": sys.exit(main(sys.argv[1:]))