diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-26 14:48:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-26 14:48:37 +0200 |
commit | b35188de4f872c76c0b8320b8f9ccefb63a081ae (patch) | |
tree | a91c8d8455801db4db401f82ac7ac054bcda28e3 | |
parent | 6b3ec33cb381583800a6027db9acdf0db5c2c9bb (diff) | |
parent | b0c2698aeff5497c96485101fdfffcde895a41f2 (diff) | |
download | vyos-1x-b35188de4f872c76c0b8320b8f9ccefb63a081ae.tar.gz vyos-1x-b35188de4f872c76c0b8320b8f9ccefb63a081ae.zip |
Merge pull request #3520 from vyos/mergify/bp/sagitta/pr-3518
op-mode: T6400: pki: unable to generate fingerprint for ACME issued certificates (backport #3518)
-rwxr-xr-x | src/op_mode/pki.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/op_mode/pki.py b/src/op_mode/pki.py index ad2c1ada0..4490e609c 100755 --- a/src/op_mode/pki.py +++ b/src/op_mode/pki.py @@ -876,7 +876,7 @@ def show_certificate_authority(name=None, pem=False): print("Certificate Authorities:") print(tabulate.tabulate(data, headers)) -def show_certificate(name=None, pem=False): +def show_certificate(name=None, pem=False, fingerprint_hash=None): headers = ['Name', 'Type', 'Subject CN', 'Issuer CN', 'Issued', 'Expiry', 'Revoked', 'Private Key', 'CA Present'] data = [] certs = get_config_certificate() @@ -897,6 +897,9 @@ def show_certificate(name=None, pem=False): if name and pem: print(encode_certificate(cert)) return + elif name and fingerprint_hash: + print(get_certificate_fingerprint(cert, fingerprint_hash)) + return ca_name = get_certificate_ca(cert, ca_certs) cert_subject_cn = cert.subject.rfc4514_string().split(",")[0] @@ -923,12 +926,6 @@ def show_certificate(name=None, pem=False): print("Certificates:") print(tabulate.tabulate(data, headers)) -def show_certificate_fingerprint(name, hash): - cert = get_config_certificate(name=name) - cert = load_certificate(cert['certificate']) - - print(get_certificate_fingerprint(cert, hash)) - def show_crl(name=None, pem=False): headers = ['CA Name', 'Updated', 'Revokes'] data = [] @@ -1074,7 +1071,7 @@ if __name__ == '__main__': if args.fingerprint is None: show_certificate(None if args.certificate == 'all' else args.certificate, args.pem) else: - show_certificate_fingerprint(args.certificate, args.fingerprint) + show_certificate(args.certificate, fingerprint_hash=args.fingerprint) elif args.crl: show_crl(None if args.crl == 'all' else args.crl, args.pem) else: |