]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Updating do_dns_tlsa.sh script
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 25 Jul 2025 13:47:58 +0000 (09:47 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 25 Jul 2025 13:47:58 +0000 (09:47 -0400)
cron/mailleur.cron
support/do_dns_tlsa.sh

index 9c4767868af9a5b47556f5f749a2fa7c57be8d50..bb01438d5740ae2a6c76d9d465ae31de1a6f9b86 100644 (file)
@@ -2,5 +2,5 @@
 #shell script to manage rpplication ecurring homeworking task
 #---------------------------------------------------
 #to update lets encrypt certificate
-#1 1 1 * * mailleur  PATH=/usr/sbin:$PATH /usr/lib/mailleur/support/do_dns_tlsa.sh
+#1 1 1 * * root  PATH=/usr/sbin:$PATH /usr/lib/mailleur/support/do_dns_tlsa.sh
 
index ca9e1d22c3195a9665cf8428c81404a2e825d66d..8134ce14b441ce175f7bb20c748d7379c41154ca 100755 (executable)
@@ -5,6 +5,8 @@
 #-------------------------------------------------------------------
 #comment in if working in production
 DRY_RUN="--dry-run"
+STAGGING="--staging"
+MRKR=`date +"%F"`
 APPNAME=mailleur
 #-------------------------------------------------------------------
 WRKDIR=/etc/certbot/$APPNAME
@@ -61,22 +63,38 @@ gen_cert()
 #Request certificate (with a steady key) via cerbot
 #Note" this is done in dry-run mode (remove it to
 #pass in production mode)
+
+#removing previous 
+rm -f ./$MKKR-*
 certbot certonly                                       \
        --apache                                        \
        --force-renewal                                 \
        --csr ./request.csr                             \
-       --fullchain-path ./$APPNAME-fullchain.pem       \
-       --chain-path ./$APPNAME-chain.pem               \
-       --cert-path ./$APPNAME-cert.pem                 \
+       --fullchain-path ./$MKKR-fullchain.pem          \
+       --chain-path ./$MKKR-chain.pem                  \
+       --cert-path ./$MKKR-cert.pem                    \
        --work-dir .                                    \
        --logs-dir ./logs                               \
-       $DRY_RUN
+       $STAGING
+
+ln -nsf                                                        \
+       ./$MKKR-fullchain.pem                           \
+       ./$APPNAME-fullchain.pem
+
+ln -nsf                                                        \
+       ./$MKKR-chain.pem                               \
+       ./$APPNAME-chain.pem
+
+ln -nsf                                                        \
+       ./$MKKR-cert.pem                                \
+       ./$APPNAME-cert.pem
+
 }
 
 gen_dane ()
 
 {
-SUM=`openssl ec -in ./ec_key.pem -pubout -outform DER | sha256sum`
+SUM=`openssl ec -in ./ec_key.pem -pubout -outform DER 2>/dev/null | sha256sum`
 
 (
 echo ";--------------------------------------------"