Removing last bash
This commit is contained in:
parent
bcb6251377
commit
91a02166f1
3 changed files with 1 additions and 71 deletions
|
|
@ -1,55 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
source /scripts/functions.sh
|
|
||||||
|
|
||||||
if [ ! -f /scripts/letsencrypt_hosts.txt ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Semaphore
|
|
||||||
if [ -f /tmp/certbot-lock ]; then
|
|
||||||
log "notice" "CERTBOT_JOB" "Another process is running"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
touch /tmp/certbot-lock
|
|
||||||
|
|
||||||
mkdir -p /var/log/letsencrypt
|
|
||||||
ln -sf /dev/stdout /var/log/letsencrypt/letsencrypt.log
|
|
||||||
|
|
||||||
REQUEST_CERTS=""
|
|
||||||
RENEW_CERTS=""
|
|
||||||
|
|
||||||
for domain in $(cat /scripts/letsencrypt_hosts.txt); do
|
|
||||||
if [ ! -f "/certs/letsencrypt/$domain.pem" ]; then
|
|
||||||
REQUEST_CERTS="$REQUES_CERTS -d $domain"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $(find "/certs/letsencrypt/$domain.pem" -mtime +30 -print) ]]; then
|
|
||||||
RENEW_CERTS="$RENEW_CERTS -d $domain"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -n "$REQUEST_CERTS" ]; then
|
|
||||||
log "info" "CERTBOT_JOB" "Requesting certificates for $REQUEST_CERTS"
|
|
||||||
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" \
|
|
||||||
$REQUEST_CERTS --email $EASYHAPROXY_LETSENCRYPT_EMAIL
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$RENEW_CERTS" ]; then
|
|
||||||
log "info" "CERTBOT_JOB" "Resquesting renew certificated fort $RENEW_CERTS"
|
|
||||||
certbot renew --post-hook "/scripts/certbot_to_haproxy.sh"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Release semaphore
|
|
||||||
rm /tmp/certbot-lock
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source /scripts/functions.sh
|
|
||||||
|
|
||||||
# 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 > /certs/letsencrypt/$CERTIFICATE.pem
|
|
||||||
done
|
|
||||||
|
|
||||||
# It will be checked on haproxy-reload.sh
|
|
||||||
touch /tmp/force-reload
|
|
||||||
|
|
@ -157,7 +157,6 @@ class Certbot:
|
||||||
' --no-eff-email'
|
' --no-eff-email'
|
||||||
' --non-interactive'
|
' --non-interactive'
|
||||||
' --max-log-backups=0'
|
' --max-log-backups=0'
|
||||||
' --post-hook "/scripts/certbot_to_haproxy.sh"'
|
|
||||||
' %s --email %s' % (' '.join(request_certs), self.email)
|
' %s --email %s' % (' '.join(request_certs), self.email)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -167,7 +166,7 @@ class Certbot:
|
||||||
ret_reload = True
|
ret_reload = True
|
||||||
|
|
||||||
if len(renew_certs) > 0:
|
if len(renew_certs) > 0:
|
||||||
Functions.run_bash("CERTBOT", "/usb/bin/certbot renew --post-hook /scripts/certbot_to_haproxy.sh", return_result=False)
|
Functions.run_bash("CERTBOT", "/usb/bin/certbot renew", return_result=False)
|
||||||
ret_reload = True
|
ret_reload = True
|
||||||
|
|
||||||
if ret_reload:
|
if ret_reload:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue