Merge 415b606f9f5d181844455068b406b927c093c40c into 0f4cab45f2524c4588e299ecb29cf6b0bf176345

This commit is contained in:
Losty 2020-02-02 00:59:29 +01:00 committed by GitHub
commit 59696a5ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,4 @@
import sys
import os
import errno
import time
import json
import docker
@ -88,6 +86,10 @@ def restartContainerWithDomains(domains):
def createCerts(args):
# Read JSON file
data = json.loads(open(args.certificate).read())
keys = "uppercase"
if args.resolverid:
data = data[args.resolverid]
keys = "lowercase"
# Determine ACME version
acme_version = 2 if 'acme-v02' in data['Account']['Registration']['uri'] else 1
@ -108,10 +110,16 @@ def createCerts(args):
fullchain = c['Certificate']['Certificate']
sans = c['Domains']['SANs']
elif acme_version == 2:
name = c['Domain']['Main']
privatekey = c['Key']
fullchain = c['Certificate']
sans = c['Domain']['SANs']
if keys == "uppercase":
name = c['Domain']['Main']
privatekey = c['Key']
fullchain = c['Certificate']
sans = c['Domain']['SANs']
else:
name = c['domain']['main']
privatekey = c['key']
fullchain = c['certificate']
sans = [] #c['domain']['sans'] # not sure what this is - can't find any here...
if (args.include and name not in args.include) or (args.exclude and name in args.exclude):
continue
@ -212,6 +220,7 @@ if __name__ == "__main__":
description='Extract traefik letsencrypt certificates.')
parser.add_argument('-c', '--certificate', default='acme.json', type=PathType(
exists=True), help='file that contains the traefik certificates (default acme.json)')
parser.add_argument('--resolverid', help='Traefik certificate-resolver-id.')
parser.add_argument('-d', '--directory', default='.',
type=PathType(type='dir'), help='output folder')
parser.add_argument('-f', '--flat', action='store_true',

View File

@ -1,2 +1,2 @@
watchdog3
watchdog
docker