Selaa lähdekoodia

Renew letsencrypt certs by default

Bob Mottram 9 vuotta sitten
vanhempi
commit
d2ab7bbe18
2 muutettua tiedostoa jossa 8 lisäystä ja 13 poistoa
  1. 1
    1
      src/freedombone-addcert
  2. 7
    12
      src/freedombone-renew-cert

+ 1
- 1
src/freedombone-addcert Näytä tiedosto

172
     systemctl stop nginx
172
     systemctl stop nginx
173
 
173
 
174
     cd ${INSTALL_DIR}/letsencrypt
174
     cd ${INSTALL_DIR}/letsencrypt
175
-    ./letsencrypt-auto certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME
175
+    ./letsencrypt-auto certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME --renew-by-default
176
     if [ ! "$?" = "0" ]; then
176
     if [ ! "$?" = "0" ]; then
177
         echo $"Failed to install letsencrypt for domain $LETSENCRYPT_HOSTNAME"
177
         echo $"Failed to install letsencrypt for domain $LETSENCRYPT_HOSTNAME"
178
         systemctl start nginx
178
         systemctl start nginx

+ 7
- 12
src/freedombone-renew-cert Näytä tiedosto

37
 PROVIDER='startssl'
37
 PROVIDER='startssl'
38
 DH_KEYLENGTH=2048
38
 DH_KEYLENGTH=2048
39
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
39
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
40
+INSTALL_DIR=/root/build
40
 
41
 
41
 function show_help {
42
 function show_help {
42
     echo ''
43
     echo ''
54
 function renew_letsencrypt {
55
 function renew_letsencrypt {
55
     if [ ! -f /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem ]; then
56
     if [ ! -f /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem ]; then
56
         echo $"Adding Let's Encrypt certificate"
57
         echo $"Adding Let's Encrypt certificate"
57
-        ${PROJECT_NAME}-addcert -e $HOSTNAME -s $LETSENCRYPT_SERVER --dhkey $DH_KEYLENGTH
58
-        if [ ! "$?" = "0" ]; then
59
-            echo $"Unable to add Let's encrypt certificate"
60
-            exit 6328
61
-        fi
62
     else
58
     else
63
         echo $"Renewing Let's Encrypt certificate"
59
         echo $"Renewing Let's Encrypt certificate"
64
-        letsencrypt renew \
65
-                    --cert-path /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem \
66
-                    --key-path /etc/letsencrypt/live/${HOSTNAME}/privkey.pem
67
-        if [ ! "$?" = "0" ]; then
68
-            echo $"Unable to renew Let's encrypt certificate"
69
-            exit 2624
70
-        fi
60
+    fi
61
+
62
+    ${PROJECT_NAME}-addcert -e $HOSTNAME -s $LETSENCRYPT_SERVER --dhkey $DH_KEYLENGTH
63
+    if [ ! "$?" = "0" ]; then
64
+        echo $"Unable to add Let's encrypt certificate"
65
+        exit 6328
71
     fi
66
     fi
72
 
67
 
73
     # Ensure that links are in place
68
     # Ensure that links are in place