summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-11-16 15:46:09 +0100
committerGitHub <noreply@github.com>2023-11-16 15:46:09 +0100
commit96ed4f8f130aab266646ac399fdd7465b4751e44 (patch)
treeb9541398ac7fd4fc5bbd00a5fed194297062366d /src
parent4131b6cb6b637b1cf6bd332fa2123112ac747c30 (diff)
parent36de14913e0f4370d7c4e2828032a5378d3bba77 (diff)
downloadvyos-1x-96ed4f8f130aab266646ac399fdd7465b4751e44.tar.gz
vyos-1x-96ed4f8f130aab266646ac399fdd7465b4751e44.zip
Merge pull request #2495 from JeffWDH/current
T3983: show pki certificate Doesnt show x509 certificates
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/pki.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/op_mode/pki.py b/src/op_mode/pki.py
index 35c7ce0e2..6c854afb5 100755
--- a/src/op_mode/pki.py
+++ b/src/op_mode/pki.py
@@ -896,11 +896,15 @@ def show_certificate(name=None, pem=False):
cert_subject_cn = cert.subject.rfc4514_string().split(",")[0]
cert_issuer_cn = cert.issuer.rfc4514_string().split(",")[0]
cert_type = 'Unknown'
- ext = cert.extensions.get_extension_for_class(x509.ExtendedKeyUsage)
- if ext and ExtendedKeyUsageOID.SERVER_AUTH in ext.value:
- cert_type = 'Server'
- elif ext and ExtendedKeyUsageOID.CLIENT_AUTH in ext.value:
- cert_type = 'Client'
+
+ try:
+ ext = cert.extensions.get_extension_for_class(x509.ExtendedKeyUsage)
+ if ext and ExtendedKeyUsageOID.SERVER_AUTH in ext.value:
+ cert_type = 'Server'
+ elif ext and ExtendedKeyUsageOID.CLIENT_AUTH in ext.value:
+ cert_type = 'Client'
+ except:
+ pass
revoked = 'Yes' if 'revoke' in cert_dict else 'No'
have_private = 'Yes' if 'private' in cert_dict and 'key' in cert_dict['private'] else 'No'