‘certbot-configuration-deploy-hook’ is stateful

  • Open
  • quality assurance status badge
Details
One participant
  • Ludovic Courtès
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 6 Sep 2021 09:53
(address . bug-guix@gnu.org)
871r62b0n9.fsf@inria.fr
Hi,

I use certbot “deploy hooks” like this (excerpt from
‘hydra/bayfront.scm’ in guix/maintenance.git):

Toggle snippet (22 lines)
(define %nginx-deploy-hook
;; Hook that restarts nginx when a new certificate is deployed.
(program-file "nginx-deploy-hook"
#~(let ((pid (call-with-input-file "/var/run/nginx/pid"
read)))
(kill pid SIGHUP))))

(define %certbot-configuration
(certbot-configuration
(webroot "/var/www")
(email "ludovic.courtes@inria.fr")
(certificates
(list (certificate-configuration
(domains '("bayfront.guix.gnu.org"
"logs.guix.gnu.org"
"bayfront.guix.info"
"hpc.guix.info"
"guix-hpc.bordeaux.inria.fr"
"coordinator.bayfront.guix.gnu.org"))
(deploy-hook %nginx-deploy-hook))))))

The problem is that cerbot records the deploy hook file name once for
all:

Toggle snippet (6 lines)
ludo@bayfront ~$ sudo grep -r ryb6000fbb4lyb4ad294srkj4x8m821w /etc/letsencrypt/
Password:
/etc/letsencrypt/renewal/hpc.guix.info.conf:renew_hook = /gnu/store/ryb6000fbb4lyb4ad294srkj4x8m821w-nginx-deploy-hook
/etc/letsencrypt/renewal/guix-hpc.bordeaux.inria.fr.conf:renew_hook = /gnu/store/ryb6000fbb4lyb4ad294srkj4x8m821w-nginx-deploy-hook

After GC, the certbot config ends up pointing to a non-existing hook:

Toggle snippet (13 lines)
ludo@bayfront ~$ sudo certbot renew

[...]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/hpc.guix.info.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Renewing an existing certificate for hpc.guix.info
Hook 'deploy-hook' reported error code 127
Hook 'deploy-hook' ran with error output:
/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/sh: /gnu/store/ryb6000fbb4lyb4ad294srkj4x8m821w-nginx-deploy-hook: No such file or directory

Most likely, the only solution would be to populate a fixed directory
name, say /etc/nginx/hooks/deploy, such that certbot configuration
remains valid.

Thoughts?

Ludo’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 50423@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 50423
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch