First part letsencrypt
This commit is contained in:
parent
08c38e5f8a
commit
10ed037d94
20 changed files with 222 additions and 45 deletions
17
assets/scripts/certbot.sh
Executable file
17
assets/scripts/certbot.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
@todo
|
||||
|
||||
ln -sf /dev/stdout /var/log/letsencrypt/letsencrypt.log
|
||||
|
||||
certbot certonly \
|
||||
--standalone \
|
||||
--preferred-challenges http \
|
||||
--http-01-port 2080 \
|
||||
--agree-tos \
|
||||
--issuance-timeout 90 \
|
||||
--no-eff-email \
|
||||
--non-interactive \
|
||||
--max-log-backups=0 \
|
||||
--post-hook "/scripts/certbot_to_haproxy.sh && systemctl reload haproxy.service"
|
||||
-d dev.globalnetguide.com -d other.domain.com --email info@xpto.us
|
||||
11
assets/scripts/certbot_to_haproxy.sh
Executable file
11
assets/scripts/certbot_to_haproxy.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# @todo
|
||||
|
||||
# Loop through all Let's Encrypt certificates
|
||||
for CERTIFICATE in `find /etc/letsencrypt/live/* -type d`; do
|
||||
CERTIFICATE=`basename $CERTIFICATE`
|
||||
|
||||
# Combine certificate and private key to single file
|
||||
cat /etc/letsencrypt/live/$CERTIFICATE/fullchain.pem /etc/letsencrypt/live/$CERTIFICATE/privkey.pem > /etc/haproxy/certs/$CERTIFICATE.pem
|
||||
done
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import yaml
|
||||
import sys
|
||||
import os
|
||||
|
||||
from easymapping import HaproxyConfigGenerator
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
|
|
@ -13,4 +15,8 @@ with open(sys.argv[1], 'r') as content_file:
|
|||
cfg = HaproxyConfigGenerator(parsed)
|
||||
print(cfg.generate())
|
||||
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open(path + "/letsencrypt_hosts.txt", 'w') as fp:
|
||||
fp.write('\n'.join(cfg.letsencrypt_hosts))
|
||||
|
||||
exit(0)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import os
|
||||
from easymapping import HaproxyConfigGenerator
|
||||
|
||||
# path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open("/tmp/.docker_data", 'r') as content_file:
|
||||
lineList = content_file.readlines()
|
||||
|
||||
|
|
@ -21,6 +20,9 @@ result["lookup_label"] = os.getenv("EASYHAPROXY_LABEL_PREFIX") if os.getenv("EAS
|
|||
cfg = HaproxyConfigGenerator(result)
|
||||
print(cfg.generate(lineList))
|
||||
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open(path + "/letsencrypt_hosts.txt", 'w') as fp:
|
||||
fp.write('\n'.join(cfg.letsencrypt_hosts))
|
||||
# print(jsonStr)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue