mirror of
https://github.com/optim-enterprises-bv/Mailu-OIDC.git
synced 2025-11-01 10:37:45 +00:00
simplify as per ghostwheel42's suggestion
This commit is contained in:
@@ -32,39 +32,11 @@ command2 = [
|
||||
"--post-hook", "/config.py"
|
||||
]
|
||||
|
||||
def format_for_nginx(fullchain, output):
|
||||
""" We may want to strip ISRG Root X1 out
|
||||
"""
|
||||
certs = []
|
||||
with open(fullchain, 'r') as pem:
|
||||
cert = ''
|
||||
for line in pem:
|
||||
cert += line
|
||||
if '-----END CERTIFICATE-----' in line:
|
||||
certs += [cert]
|
||||
cert = ''
|
||||
with open(output, 'w') as pem:
|
||||
for cert in certs[:-1] if len(certs)>2 and os.getenv('LETSENCRYPT_SHORTCHAIN', default="False") else certs:
|
||||
pem.write(cert)
|
||||
|
||||
def add_DANE_pin(chain, output):
|
||||
with open(output, 'w') as pem:
|
||||
with open(chain, 'r') as chain:
|
||||
for line in chain:
|
||||
pem.write(line)
|
||||
with open('/etc/ssl/certs/ca-cert-ISRG_Root_X1.pem', 'r') as isrgx1:
|
||||
for line in isrgx1:
|
||||
pem.write(line)
|
||||
|
||||
# Wait for nginx to start
|
||||
time.sleep(5)
|
||||
|
||||
# Run certbot every day
|
||||
while True:
|
||||
subprocess.call(command)
|
||||
format_for_nginx('/certs/letsencrypt/live/mailu/fullchain.pem', '/certs/letsencrypt/live/mailu/nginx-chain.pem')
|
||||
add_DANE_pin('/certs/letsencrypt/live/mailu/chain.pem', '/certs/letsencrypt/live/mailu/nginx-chain-DANE.pem')
|
||||
subprocess.call(command2)
|
||||
format_for_nginx('/certs/letsencrypt/live/mailu-ecdsa/fullchain.pem', '/certs/letsencrypt/live/mailu-ecdsa/nginx-chain.pem')
|
||||
add_DANE_pin('/certs/letsencrypt/live/mailu-ecdsa/chain.pem', '/certs/letsencrypt/live/mailu-ecdsa/nginx-chain-DANE.pem')
|
||||
time.sleep(86400)
|
||||
|
||||
Reference in New Issue
Block a user