From patchwork Mon Apr 3 13:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saku Laesvuori X-Patchwork-Id: 48963 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7CA61172B8; Mon, 3 Apr 2023 14:34:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3239F170D6 for ; Mon, 3 Apr 2023 14:34:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjKK3-0007KT-Lp; Mon, 03 Apr 2023 09:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjKJv-0007I2-LT for guix-patches@gnu.org; Mon, 03 Apr 2023 09:34:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjKJv-00029Q-5t for guix-patches@gnu.org; Mon, 03 Apr 2023 09:34:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pjKJu-0000n3-HD for guix-patches@gnu.org; Mon, 03 Apr 2023 09:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62642] [PATCH] services: certbot: Fix nginx crash when certbot is used without domains Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 03 Apr 2023 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62642 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62642@debbugs.gnu.org Cc: Saku Laesvuori X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16805288052984 (code B ref -1); Mon, 03 Apr 2023 13:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Apr 2023 13:33:25 +0000 Received: from localhost ([127.0.0.1]:43729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjKJJ-0000m4-3e for submit@debbugs.gnu.org; Mon, 03 Apr 2023 09:33:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:51392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjKJG-0000lw-Ul for submit@debbugs.gnu.org; Mon, 03 Apr 2023 09:33:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjKJG-0006ej-IJ for guix-patches@gnu.org; Mon, 03 Apr 2023 09:33:22 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjKJE-00022w-KX for guix-patches@gnu.org; Mon, 03 Apr 2023 09:33:21 -0400 Received: from localhost.localdomain (185-185-168-253.localnetip.fi [185.185.168.253]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 1943034009E; Mon, 3 Apr 2023 15:33:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1680528813; bh=zatl4EdA0bu8eWvevljNb9xXf/srAwIQhHwRBr4YKPU=; h=From:To:Cc:Subject:Date; b=TwU38LUJUK91SiOu/rBd96OeGggiO65jTUVNbpGTzl9J+mB3WSK0CVLH0+wyg+5kM hhIQLa26h/jYnJMSY2VUUSYWe6WZOZmc7Fd8jwT85uUvNI8zUy0huIbANaOr6hURmZ OKSWiHSU6czYqciISp9MrI9XHuvH5ziI4WepUric= Date: Mon, 3 Apr 2023 16:32:41 +0300 Message-Id: <20230403133241.14760-1-saku@laesvuori.fi> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Saku Laesvuori X-ACL-Warn: , Saku Laesvuori via Guix-patches X-Patchwork-Original-From: Saku Laesvuori via Guix-patches via From: Saku Laesvuori Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: 2cf71e725d55bc5bf1ad663b7c696516299cc8a7 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 (($ 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)