mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-14 00:06:15 +01:00
Merge pull request #1165 from dmach/display-ssl-cert
Fix the '9 - review the server certificate' option in cert trust prompt
This commit is contained in:
commit
298a1fba4b
@ -2,6 +2,8 @@ import binascii
|
|||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
@ -159,4 +161,11 @@ Would you like to
|
|||||||
self.trust_permanently(cert)
|
self.trust_permanently(cert)
|
||||||
return
|
return
|
||||||
elif r == "9":
|
elif r == "9":
|
||||||
print(cert.to_txt())
|
# TODO: avoid calling openssl to convert pem to text
|
||||||
|
pem = cert.public_bytes(encoding=serialization.Encoding.PEM).decode("utf-8")
|
||||||
|
cmd = ["openssl", "x509", "-text"]
|
||||||
|
try:
|
||||||
|
cert_text = subprocess.check_output(cmd, input=pem, encoding="utf-8")
|
||||||
|
print(cert_text)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("ERROR: Unable to display certificate because the 'openssl' executable is not available", file=sys.stderr)
|
||||||
|
Loading…
Reference in New Issue
Block a user