From patchwork Thu Jun 24 19:18:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghav Gururajan X-Patchwork-Id: 30685 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 3267F27BC81; Thu, 24 Jun 2021 20:19:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EAB1E27BC78 for ; Thu, 24 Jun 2021 20:19:14 +0100 (BST) Received: from localhost ([::1]:50754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwUsb-0006eK-TX for patchwork@mira.cbaines.net; Thu, 24 Jun 2021 15:19:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwUsQ-0006e8-JK for guix-patches@gnu.org; Thu, 24 Jun 2021 15:19:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwUsP-0003qu-Ra for guix-patches@gnu.org; Thu, 24 Jun 2021 15:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwUsP-0001li-NH for guix-patches@gnu.org; Thu, 24 Jun 2021 15:19:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49213] [PATCH v2] services: certbot: Add option to use CSR file. References: <20210624185111.5959-1-rg@raghavgururajan.name> In-Reply-To: <20210624185111.5959-1-rg@raghavgururajan.name> Resent-From: Raghav Gururajan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 24 Jun 2021 19:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49213 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49213@debbugs.gnu.org Cc: Raghav Gururajan Received: via spool by 49213-submit@debbugs.gnu.org id=B49213.16245623276771 (code B ref 49213); Thu, 24 Jun 2021 19:19:01 +0000 Received: (at 49213) by debbugs.gnu.org; 24 Jun 2021 19:18:47 +0000 Received: from localhost ([127.0.0.1]:44169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwUsA-0001l8-LK for submit@debbugs.gnu.org; Thu, 24 Jun 2021 15:18:46 -0400 Received: from out1.migadu.com ([91.121.223.63]:62335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwUs6-0001ks-7G for 49213@debbugs.gnu.org; Thu, 24 Jun 2021 15:18:45 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raghavgururajan.name; s=key1; t=1624562320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5J1qwjNxQUuFTRYrtH2Q0HnqLDdd7IeDdNM8SfxNL38=; b=dbqx/CrQ2xDEs6SpcnjkSgcfsgvgWz83CiGC74l2xMKEZu3OU+62qMkyqdV4U+vAlET1F9 k/i/9PeuIwawir8lKJSq/izaTrmFBjrWd6hkhbl389i8hL38x2jJtVd49Ctg8+tHoiKOEY KinDzk9vfzqBoKPUaXen9TzZIb2CcqDriErdUCGorJ80brFiFiVtqO7czyc5+s1EYbBNQ8 6FdClP05Ns3uThZv6aMJqx+Zcwd+olZToAL34vwj1p3/XNYS8250SzdTdpEkJDYppHcWSm +Lb0ZuI3ycQT2p3CYKypz1h/bzl6VZJZ3zeDV0a5NbVWfBxooOaqawYXcOMUXw== Date: Thu, 24 Jun 2021 15:18:37 -0400 Message-Id: <20210624191837.6615-1-rg@raghavgururajan.name> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: rg@raghavgururajan.name 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Raghav Gururajan X-ACL-Warn: , Raghav Gururajan via Guix-patches X-Patchwork-Original-From: Raghav Gururajan via Guix-patches via From: Raghav Gururajan X-getmail-retrieved-from-mailbox: Patches * gnu/services/certbot.scm (): Add csr field. (certbot-command): Modify. * doc/guix.texi (Certificate Services): Document it. --- doc/guix.texi | 7 +++++++ gnu/services/certbot.scm | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e8999447..fce72a9fb5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -91,6 +91,7 @@ Copyright @copyright{} 2020 Edgar Vincent@* Copyright @copyright{} 2021 Maxime Devos@* Copyright @copyright{} 2021 B. Wilson@* Copyright @copyright{} 2021 Xinglu Chen@* +Copyright @copyright{} 2021 Raghav Gururajan@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -25934,6 +25935,12 @@ the documentation at @url{https://certbot.eff.org/docs/using.html#hooks}), and gives Let's Encrypt permission to log the public IP address of the requesting machine. +@item @code{csr} (default: @code{#f}) +File name of Certificate Signing Request (CSR) in DER or PEM format. +If @code{#f} is specified, this argument will not be passed to certbot. +If a value is provided, certbot will use it to obtain a certificate, instead of +using a randomly-generated CSR. + @item @code{authentication-hook} (default: @code{#f}) Command to be run in a shell once for each certificate challenge to be answered. For this command, the shell variable @code{$CERTBOT_DOMAIN} diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index 1c67ff63f1..c73142ca81 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -55,6 +55,8 @@ (default '())) (challenge certificate-configuration-challenge (default #f)) + (csr certificate-configuration-csr + (default #f)) (authentication-hook certificate-authentication-hook (default #f)) (cleanup-hook certificate-cleanup-hook @@ -95,7 +97,7 @@ (match-lambda (($ custom-name domains challenge authentication-hook cleanup-hook - deploy-hook) + deploy-hook csr) (let ((name (or custom-name (car domains)))) (if challenge (append @@ -110,6 +112,7 @@ '("--register-unsafely-without-email")) (if server `("--server" ,server) '()) (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) + (if csr `("--csr" ,csr) '()) (if authentication-hook `("--manual-auth-hook" ,authentication-hook) '()) @@ -125,6 +128,7 @@ '("--register-unsafely-without-email")) (if server `("--server" ,server) '()) (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) + (if csr `("--csr" ,csr) '()) (if deploy-hook `("--deploy-hook" ,deploy-hook) '())))))) certificates))) (program-file