Debian - Fix dc-cert out-of-sync

On Debian it's observed that the dc-cert audit failed due to
a TypeError raised from the write method in tempfile module
in python3. The method only accepts byte string.

Test Plan:
PASSED: Dc-cert audit on Debian
PASSED: Dc-cert audit on Centos

Story: 2010119
Task: 45902

Signed-off-by: Li Zhu <li.zhu@windriver.com>
Change-Id: Icbf5e54a861576933e43d9d7ecd8e7e16a0a4c7b
This commit is contained in:
Li Zhu 2022-07-29 09:37:22 -04:00
parent 66ab17bca1
commit afe8734cfa
2 changed files with 3 additions and 3 deletions

View File

@ -109,10 +109,10 @@ def verify_adminep_cert_chain():
txt_tls_crt = base64.decode_as_text(secret_adminep.data['tls.crt'])
with tempfile.NamedTemporaryFile() as ca_tmpfile:
ca_tmpfile.write(txt_ca_crt)
ca_tmpfile.write(txt_ca_crt.encode('utf8'))
ca_tmpfile.flush()
with tempfile.NamedTemporaryFile() as adminep_tmpfile:
adminep_tmpfile.write(txt_tls_crt)
adminep_tmpfile.write(txt_tls_crt.encode('utf8'))
adminep_tmpfile.flush()
cmd = ['openssl', 'verify', '-CAfile', constants.DC_ROOT_CA_CERT_PATH,

View File

@ -3323,7 +3323,7 @@ def verify_ca_crt(crt):
def verify_intermediate_ca_cert(ca_crt, tls_crt):
with tempfile.NamedTemporaryFile() as tmpfile:
tmpfile.write(ca_crt)
tmpfile.write(ca_crt.encode('utf8'))
tmpfile.flush()
cmd = ['openssl', 'verify', '-CAfile', tmpfile.name]
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,