unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 50423@debbugs.gnu.org
Subject: bug#50423: ‘certbot-configuration-deploy-hook’ is stateful
Date: Mon, 06 Sep 2021 09:53:30 +0200	[thread overview]
Message-ID: <871r62b0n9.fsf@inria.fr> (raw)

Hi,

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

--8<---------------cut here---------------start------------->8---
(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))))))
--8<---------------cut here---------------end--------------->8---

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

--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---

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

--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---

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’.




                 reply	other threads:[~2021-09-06  7:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r62b0n9.fsf@inria.fr \
    --to=ludo@gnu.org \
    --cc=50423@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).