Subject: bug#62642: closed (Re: bug#62642: [PATCH] services: certbot: Fix nginx crash when certbot is used without domains)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 18 Jun 2023 21:13:02 +0000

Your bug report

#62642: [PATCH] services: certbot: Fix nginx crash when certbot is used without domains

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
62642: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62642
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#62642: [PATCH] services: certbot: Fix nginx crash when certbot is used without domains
From: Ludovic Courtès <[email-masked]>
To: Saku Laesvuori <[email-masked]>
Cc: [email-masked], Bruno Victal <[email-masked]>
Date: Sun, 18 Jun 2023 23:11:56 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Saku,

Saku Laesvuori <[email-masked]> skribis:

> * gnu/services/certbot.scm (certbot-nginx-server-configurations):
> Don't return a broken nginx-server-configuration with empty server_name
> when no certificate domains are configured. Instead add a separate
> server for every certificate, so 0 certificates adds 0 servers.

Finally applied.

Thank you, and thanks to Bruno for reviewing!

Ludo’.

Subject: [PATCH] services: certbot: Fix nginx crash when certbot is used without domains
From: Saku Laesvuori <[email-masked]>
To: [email-masked]
Cc: Saku Laesvuori <[email-masked]>
Date: Mon, 3 Apr 2023 16:32:41 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/services/certbot.scm (certbot-nginx-server-configurations):
Don't return a broken nginx-server-configuration when no certificate
domains are configured.
---
 gnu/services/certbot.scm | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index 8e6784df2b..3d9d207f8a 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -173,20 +173,21 @@ (define certbot-nginx-server-configurations
   (match-lambda
     (($ <certbot-configuration> package webroot certificates email
                                 server rsa-key-size default-location)
-     (list
-      (nginx-server-configuration
-       (listen '("80" "[::]:80"))
-       (ssl-certificate #f)
-       (ssl-certificate-key #f)
-       (server-name
-        (apply append (map certificate-configuration-domains certificates)))
-       (locations
-        (filter identity
-                (list
-                 (nginx-location-configuration
-                  (uri "/.well-known")
-                  (body (list (list "root " webroot ";"))))
-                 default-location))))))))
+     (if (null? certificates) '()
+       (list
+        (nginx-server-configuration
+        (listen '("80" "[::]:80"))
+        (ssl-certificate #f)
+        (ssl-certificate-key #f)
+        (server-name
+         (apply append (map certificate-configuration-domains certificates)))
+        (locations
+         (filter identity
+                 (list
+                  (nginx-location-configuration
+                   (uri "/.well-known")
+                   (body (list (list "root " webroot ";"))))
+                  default-location)))))))))
 
 (define certbot-service-type
   (service-type (name 'certbot)

base-commit: 2cf71e725d55bc5bf1ad663b7c696516299cc8a7
-- 
2.39.2