From 0a87bc3cceaee83e2b54cff39aedf784467193c9 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 3 Mar 2022 11:27:50 -0800 Subject: [PATCH] Make Issuer CN more unique Fixes #35 --- tls_gen/gen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tls_gen/gen.py b/tls_gen/gen.py index 93675b0..56883ca 100644 --- a/tls_gen/gen.py +++ b/tls_gen/gen.py @@ -10,6 +10,7 @@ import stat import tempfile +from datetime import datetime from os import path from subprocess import run @@ -109,13 +110,14 @@ def prepare_ca_directory(dir_name): def generate_root_ca(opts): prepare_ca_directory(root_ca_path()) + iso_date = datetime.now().isoformat() args = ["-x509", "-days", str(opts.validity_days), "-newkey", "rsa:{}".format(opts.key_bits), "-keyout", root_ca_key_path(), "-out", root_ca_certificate_path(), "-outform", "PEM", - "-subj", "/CN=TLSGenSelfSignedtRootCA/L=$$$$/"] + "-subj", "/CN=TLSGenSelfSignedtRootCA {}/L=$$$$/".format(iso_date)] if len(opts.password) > 0: args.append("-passout") args.append("pass:{}".format(opts.password))