From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +OviECeMLGSCHgAASxT56A (envelope-from ) for ; Tue, 04 Apr 2023 22:44:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QC3xDyeMLGRS1QAAG6o9tA (envelope-from ) for ; Tue, 04 Apr 2023 22:44:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C0B2C49AE for ; Tue, 4 Apr 2023 22:44:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjnVe-0001Lg-77; Tue, 04 Apr 2023 16:44:06 -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 1pjnVc-0001LY-QF for guix-patches@gnu.org; Tue, 04 Apr 2023 16:44: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 1pjnVa-0008Hw-Gc for guix-patches@gnu.org; Tue, 04 Apr 2023 16:44:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pjnVa-0007mt-6E for guix-patches@gnu.org; Tue, 04 Apr 2023 16:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62642] [PATCH v2] 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: Tue, 04 Apr 2023 20:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62642 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62642@debbugs.gnu.org Received: via spool by 62642-submit@debbugs.gnu.org id=B62642.168064103229909 (code B ref 62642); Tue, 04 Apr 2023 20:44:02 +0000 Received: (at 62642) by debbugs.gnu.org; 4 Apr 2023 20:43:52 +0000 Received: from localhost ([127.0.0.1]:50370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjnVP-0007mK-Ug for submit@debbugs.gnu.org; Tue, 04 Apr 2023 16:43:52 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:43278 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pjnVO-0007mC-1Y for 62642@debbugs.gnu.org; Tue, 04 Apr 2023 16:43:50 -0400 Received: from X-kone (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 7ECDD342467; Tue, 4 Apr 2023 22:44:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1680641056; bh=p08MHGBkNtg/YMphhuUfdrd72LmG2TbrsLSMbGu37I0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=FblHpwopY/Imt/DTMGgbIZ54t3T/jt2dZGJhlmo3ZLZrB1toeC/bAaYdWHhBclxDa UHhDTKHK+zBYiGgg8mBA//V0dFtJAgAr2UZDQLWY6DsiMHDkG6YZnxKZRINW7teLqE 168+f3+e9BCWgoBc1a6aQtP5bc3iZI59YrqdDVk4= Date: Tue, 4 Apr 2023 23:43:46 +0300 Message-ID: <20230404204346.urftnbdrquetm7jw@X-kone> References: <20230403133241.14760-1-saku@laesvuori.fi> <66755b58-1cb1-eae6-a4ac-69c174ed58aa@makinata.eu> <20230403180659.zhbtbfnn2uhgplgc@X-kone> <84bb2e1c-db0c-ac08-9275-ffcc0f828b1c@makinata.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yx4sf7wuvknlvz7r" Content-Disposition: inline In-Reply-To: <84bb2e1c-db0c-ac08-9275-ffcc0f828b1c@makinata.eu> 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 From: Saku Laesvuori via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680641063; a=rsa-sha256; cv=none; b=g0eWfGdXf2+X6kN8Bwv8IPwRcvEV+TAJ89DYTgE6l+l1FeH3i+NS7uDJOmU4PNBwvJZ3IS YiYPQLxlbhCLo5kRkJqQ1fx/cnI0NCxXvKibp3R0lPJezm0QIqujy3V1NHCwNdM7v1IVEq b34Gr5zOLrVxPIeHIfmGI91KTMPtzWdA0QevDBjogQoTn/LFXEHUC65oRhvPABFmR8uERD RygTJ+G7Of+X73O9wFibCQ6a4RlTXh9OILRBqlBgzMZcgt4sd3/tvf6N7F/8XmwGZEaz+c vzZ/CHJ+xhWCEJ27BPTGsL6tL6nzsjHSpOLotTZ4k7NTz2CYRnwn8QUotyUe3Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=laesvuori.fi header.s=mail header.b=FblHpwop; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680641063; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=bGIOW4jh7LrJVHMgn5GOqmsrV0IMPVmKzU9/pZz8Smw=; b=d5ea4yCyZqlsoA4XuBI8cR7GIiDXeYYQHiWUhc4x9jKrwoGsP5xXVLN6vpMxRY7TdeRcV4 Yf4MbLqHq+iY2K92TGcz+vMAuugH6rrZUH/etNhXAEMykZ6Ai0gLD+mYOhQ7dMMA04u8EF WtViFYvZhvKvuUhdePxLLzZKvkjy60+g/2My7ur0kpCJKyHq9o7wvuMY9SwvSEHoWNHeUa 2sk9wzzTN0z6oTsePhP6Zfzx9xpHS9y7wr7a4k5fBIDOqfgY0dzZI9X6dvSyx7vq23RNGY CiOb6PPckGmMiLZ5HYu65mXY7EXaCXLdNQS8zt82P14Ji227w2P564GZQDeYIQ== X-Migadu-Spam-Score: -3.82 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=laesvuori.fi header.s=mail header.b=FblHpwop; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Spam-Score: -3.82 X-Migadu-Queue-Id: C0B2C49AE X-TUID: dUdCm8bkbKrP --yx4sf7wuvknlvz7r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * 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. --- gnu/services/certbot.scm | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index 8e6784df2b..0c45471659 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -173,20 +173,24 @@ (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)))))))) + (define (certificate->nginx-server certificate-configuration) + (match-record certificate-configuration = =20 + (domains challenge) + (nginx-server-configuration + (listen '("80" "[::]:80")) + (ssl-certificate #f) + (ssl-certificate-key #f) + (server-name domains) + (locations + (filter identity + (append + (if challenge + '() + (list (nginx-location-configuration + (uri "/.well-known") + (body (list (list "root " webroot ";")))))) + (list default-location))))))) + (map certificate->nginx-server certificates)))) =20 (define certbot-service-type (service-type (name 'certbot) base-commit: 2cf71e725d55bc5bf1ad663b7c696516299cc8a7 --=20 2.39.2 --yx4sf7wuvknlvz7r Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmQsjAEACgkQJX0oSiod OjLzmBAAti74eE2JPOnhPOiwwDmeHnc84Kyqia5yszDrUFHr6m4P/00z0lYGZL1b 5wkH5lejh48nkyvQGLbBoJR+Blb3nIN2J6cPq2Ocz/JIFmO+6WlyE4lYCACqRATX gqLTJIojwB4m4T8FUWQEissXcX7OqoaztIEVh9AfXW4BontPSQsbwk+GnsFaPe8G AOIytFm3+pD/ZL2otcTzWP3IPEdI5UBkYTDlNA5l3sd5uFE4JqR4CeANu4Y+U4LW rJo/AyADCicUPRUTg/eDc0NdzycpMXzCpb9i+WImsq72zXWH7J2AUoZqrHfiC2Ye i/swvaywqN1tWVO2Bfkg7sqpu8TNRHRzNIo4bR8UuiEmOvRpOyV9DQP5osFldWnM /9jT8jyrq99vBgogk+tYIb08t08sTN5gtWgnsVD0gpBMti13myV066HmCiZkbvD5 Gxz7sheQbXCdAXWSfA9Fa2Zt+4xcn3VF8tTpOZiymJZjPumQUdJnaQHgLjoDdHH7 a47z1D1fTxUvvbV2rbuZ5Y71YHzWnfcS505hyPGZUeoXKTByYA2QwgqN1jTSeG1o aasuS7Gbt2o5vFk71ju+3jTMnRBa8b546vaFA8uTfvTupjLmcT54aKd3bNjG5PuP N8byiAhkjKNy8cMIrFnH3A2BBABviUOccS2U45VUL+nhosz6Las= =Wak2 -----END PGP SIGNATURE----- --yx4sf7wuvknlvz7r--