From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WDSTDQr7uGVZGgEAe85BDQ:P1 (envelope-from ) for ; Tue, 30 Jan 2024 14:35:06 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id WDSTDQr7uGVZGgEAe85BDQ (envelope-from ) for ; Tue, 30 Jan 2024 14:35:06 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=zancanaro.id.au header.s=k1 header.b=rKQjjuac; dmarc=fail reason="SPF not aligned (relaxed)" header.from=zancanaro.id.au (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1706621706; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=FFCdlmL7eBeYb4p3N/ixkyd085/voHOrsRd9KVdWcGA=; b=UM+VHwvbpX5UejyVnJYKDHQ4jj835P0VUjd5/hti5MgELh+r8sGTeDTTxq5jJWEz1t8/PM O+PuuJUg/rlsA+QY39Uks0mgecarywFFzo0G1a2dEdBUrmvVZDUcMhkzk+TPOOanhrcSQ6 LTLqBhMubojOIL2lESuLNF/Rem06MFW/QxdVyfKeR/9S4+KIQDFqwm+5wl572Hh44mvq5d MXu9fLZXNsTKJnhYNgP8i8Wia9KFyqQObytmtlQm2qtTTxBnLeCwsq37TlagLCPbXWyVUW EFCqwhi3kbvJTOyyEWFWkaeZdJCJC+ebFEfGyiH5fvks2NCJb5t3EposA0+pLA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=zancanaro.id.au header.s=k1 header.b=rKQjjuac; dmarc=fail reason="SPF not aligned (relaxed)" header.from=zancanaro.id.au (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1706621706; a=rsa-sha256; cv=none; b=kEDDcqzcruMyn3SddAW+cU4YzzvkRIUGmWgLS6s6SlekC5SUSvM1yvpBqXUYEeIJOMzI1B AcwrPLGBgj5W/rf91tkEwqxTGPvhGn9jdNS4v0fzAEcFHTukyyWs8Cktz9l03CUumU4Sqm IT71bM0r8M3SqXkF0qD9umjflBR3PL/Jh3BVZ/3/slGfinl21pbinl71PWV3tS7HZtOcyf fm/anxgIsftzBDvg8k4BqnluFA/gjybHxg38BOtQ+oOwy/G/fGC7vyMYtsOdKnX51asryI wY0XnLuaQmVV6WMlKqsz6GlsLVWYbJU0/eRWAcxzjdaYnOmF319gFi6YLmyl6w== 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 1EFEE36748 for ; Tue, 30 Jan 2024 14:35:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUoFV-0007RB-8n; Tue, 30 Jan 2024 08:34:02 -0500 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 1rUoFK-0007Oc-MA for guix-devel@gnu.org; Tue, 30 Jan 2024 08:33:50 -0500 Received: from voltorb.zancanaro.id.au ([45.77.50.64]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUoFI-00069p-K2 for guix-devel@gnu.org; Tue, 30 Jan 2024 08:33:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=k1; bh=+IVbxuFNV4gzCer CKJwKlBtHs5M9VdGs4Vx8gX7+aFg=; h=references:in-reply-to:date:subject: cc:to:from; d=zancanaro.id.au; b=rKQjjuacyRsbywmEvDSunmzCrqUK5IupedGeG WuhNJLJDHCvEu1sF6LAW61v/lbWkzUzZHU2GqjAI9d8rtWgEPlrvMJuMP3QM2ZhlieWkTZ md5MqBeWR30NAssaAh9xJEnmEpOPJ1b09P9wEVHhNDqK5VOr7ww7gYIFNcmCbuHc= Received: by voltorb.zancanaro.id.au (OpenSMTPD) with ESMTPSA id b7629d1f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 30 Jan 2024 13:33:28 +0000 (UTC) From: Carlo Zancanaro To: 46961@debbugs.gnu.org Cc: clement@lassieur.org, brice@waegenei.re, guix-devel@gnu.org Subject: [PATCH v2 3/4] services: certbot: Add a default deploy hook to reload nginx. Date: Tue, 30 Jan 2024 13:26:39 +0000 Message-ID: <0816d35e69610090994eb7da45715b4ee366d791.1706621200.git.carlo@zancanaro.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=45.77.50.64; envelope-from=carlo@zancanaro.id.au; helo=voltorb.zancanaro.id.au 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_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 3.83 X-Spam-Score: 3.83 X-Migadu-Queue-Id: 1EFEE36748 X-Migadu-Scanner: mx12.migadu.com X-TUID: 9svQsfJoQgNs * gnu/services/certbot.scm (%default-deploy-hook): New variable. ()[deploy-hook]: Use it as default deploy hook. * doc/guix.texi (Certificate services): Document new default deploy hook. Change-Id: Ibb10481170a6fda7df72492072b939dd6a6ad176 --- doc/guix.texi | 6 +++++- gnu/services/certbot.scm | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 58a65fe0b7..0f372a460f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -32681,7 +32681,7 @@ Certificate Services additionally @code{$CERTBOT_AUTH_OUTPUT} will contain the standard output of the @code{auth-hook} script. -@item @code{deploy-hook} (default: @code{#f}) +@item @code{deploy-hook} (default: @code{%default-deploy-hook}) Command to be run in a shell once for each successfully issued certificate. For this command, the shell variable @code{$RENEWED_LINEAGE} will point to the config live subdirectory (for @@ -32690,6 +32690,10 @@ Certificate Services contain a space-delimited list of renewed certificate domains (for example, @samp{"example.com www.example.com"}. +The default deploy hook calls the @code{reload} action of the +@code{nginx} Shepherd service, to reload the newly generated +certificates. + @item @code{start-self-signed?} (default: @code{#t}) Whether to generate an initial self-signed certificate during system activation. This option is particularly useful to allow @code{nginx} to diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index 10b99f5630..490b9e8d6d 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -37,7 +37,8 @@ (define-module (gnu services certbot) #:use-module (srfi srfi-1) #:use-module (ice-9 format) #:use-module (ice-9 match) - #:export (certbot-service-type + #:export (%default-deploy-hook + certbot-service-type certbot-configuration certbot-configuration? certificate-configuration)) @@ -49,6 +50,14 @@ (define-module (gnu services certbot) ;;; Code: +(define %default-deploy-hook + (program-file + "reload-nginx.scm" + (with-imported-modules '((gnu services herd)) + #~(begin + (use-modules (gnu services herd)) + (with-shepherd-action 'nginx ('reload) result result))))) + (define-record-type* certificate-configuration make-certificate-configuration certificate-configuration? @@ -65,7 +74,7 @@ (define-record-type* (cleanup-hook certificate-cleanup-hook (default #f)) (deploy-hook certificate-configuration-deploy-hook - (default #f)) + (default %default-deploy-hook)) (start-self-signed? certificate-configuration-start-self-signed? (default #t))) -- 2.41.0