2018-10-31 19:17:23 +02:00
|
|
|
#!/usr/bin/python3
|
2017-09-24 17:50:10 +02:00
|
|
|
|
|
|
|
import os
|
|
|
|
import time
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
command = [
|
|
|
|
"certbot",
|
|
|
|
"-n", "--agree-tos", # non-interactive
|
|
|
|
"-d", os.environ["HOSTNAMES"],
|
|
|
|
"-m", "{}@{}".format(os.environ["POSTMASTER"], os.environ["DOMAIN"]),
|
|
|
|
"certonly", "--standalone",
|
|
|
|
"--cert-name", "mailu",
|
2017-11-01 16:24:22 +02:00
|
|
|
"--preferred-challenges", "http", "--http-01-port", "8008",
|
2017-09-24 17:50:10 +02:00
|
|
|
"--keep-until-expiring",
|
|
|
|
"--rsa-key-size", "4096",
|
|
|
|
"--config-dir", "/certs/letsencrypt",
|
|
|
|
"--post-hook", "/config.py"
|
|
|
|
]
|
|
|
|
|
|
|
|
# Wait for nginx to start
|
|
|
|
time.sleep(5)
|
|
|
|
|
|
|
|
# Run certbot every hour
|
|
|
|
while True:
|
|
|
|
subprocess.call(command)
|
|
|
|
time.sleep(3600)
|
|
|
|
|