Skip to content

Commit

Permalink
Add ca/cert prefix when writing to trusted ca's path dir
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed Sep 5, 2024
1 parent daacf50 commit a871054
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middlewared/middlewared/etc_files/generate_ssl_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def write_certificates(certs: list) -> set:
trusted_cas_path = '/var/local/ca-certificates'
shutil.rmtree(trusted_cas_path, ignore_errors=True)
for cert in filter(lambda c: c['chain_list'] and c['add_to_trusted_store'], certs):
with open(os.path.join(trusted_cas_path, f'{cert["name"]}.crt'), 'w') as f:
cert_type = 'ca' if cert['cert_type'] == 'CA' else 'cert'
with open(os.path.join(trusted_cas_path, f'{cert_type}_{cert["name"]}.crt'), 'w') as f:
f.write('\n'.join(cert['chain_list']))

cp = subprocess.Popen('update-ca-certificates', stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
Expand Down

0 comments on commit a871054

Please sign in to comment.