Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions fortanix_kmip_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ def generate_certs(app_id, args):
os.makedirs(args.cert_dir, exist_ok=True)

# Clean existing certificate files only
key_path = os.path.join(args.cert_dir, "private.key")
cert_path = os.path.join(args.cert_dir, "certificate.crt")
for cert_file in [key_path, cert_path]:
key_path = os.path.join(args.cert_dir, "client_key.pem")
cert_path = os.path.join(args.cert_dir, "client_certificate.pem")
server_cert_path = os.path.join(args.cert_dir, "root_certificate.pem")
for cert_file in [key_path, cert_path, server_cert_path]:
if os.path.isfile(cert_file):
os.remove(cert_file)

Expand Down Expand Up @@ -221,7 +222,7 @@ def download_server_cert(args):
result.stdout, re.DOTALL)

if match:
server_cert_path = os.path.join(args.cert_dir, "server.crt")
server_cert_path = os.path.join(args.cert_dir, "root_certificate.pem")
with open(server_cert_path, 'w') as f:
f.write(match.group(0))
print(f"Server certificate saved")
Expand Down