Adds support for SubjectAltName in CSR generation

To use this feature, add multiple domain names in the configuration,
separated by spaces
This commit is contained in:
David Klaftenegger 2016-02-28 16:21:56 +01:00 committed by Markus Hauschild
parent 53d2ad4bf6
commit ffb4fde1c6
1 changed files with 11 additions and 1 deletions

View File

@ -147,7 +147,17 @@ def cert_get(domain, settings):
server_thread.start()
try:
cr = subprocess.check_output(['openssl', 'req', '-new', '-sha256', '-key', key_file, '-out', csr_file, '-subj', '/CN=%s' % domain])
allnames = domain.split(' ')
if len(allnames) == 1:
cr = subprocess.check_output(['openssl', 'req', '-new', '-sha256', '-key', key_file, '-out', csr_file, '-subj', '/CN=%s' % domain])
else:
cnt = 0
altnames = []
for alias in allnames[1:]
cnt = cnt + 1
altnames.append('DNS.%d=%s' % cnt, alias)
subject = '/CN=%s subjectAltName=%s' % allnames[0], ','.join(altnames)
cr = subprocess.check_output(['openssl', 'req', '-new', '-sha256', '-key', key_file, '-out', csr_file, '-reqexts', 'SAN', '-subj', subject])
# get certificate
crt = acme_tiny.get_crt(acc_file, csr_file, challenge_dir)