From patchwork Thu Jun 24 21:59:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raghav Gururajan X-Patchwork-Id: 30688 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 035FC27BC81; Thu, 24 Jun 2021 23:01:13 +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 4241A27BC78 for ; Thu, 24 Jun 2021 23:01:12 +0100 (BST) Received: from localhost ([::1]:51318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwXPL-0004fB-C3 for patchwork@mira.cbaines.net; Thu, 24 Jun 2021 18:01:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwXPC-0004ey-MK for guix-patches@gnu.org; Thu, 24 Jun 2021 18:01:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwXPC-0001TZ-Ea for guix-patches@gnu.org; Thu, 24 Jun 2021 18:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwXPC-0006kx-Bp for guix-patches@gnu.org; Thu, 24 Jun 2021 18:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49213] [PATCH v4] 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 22:01:02 +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.162457200225794 (code B ref 49213); Thu, 24 Jun 2021 22:01:02 +0000 Received: (at 49213) by debbugs.gnu.org; 24 Jun 2021 22:00:02 +0000 Received: from localhost ([127.0.0.1]:44278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwXOD-0006hZ-4Q for submit@debbugs.gnu.org; Thu, 24 Jun 2021 18:00:01 -0400 Received: from out1.migadu.com ([91.121.223.63]:26033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwXOA-0006hP-DX for 49213@debbugs.gnu.org; Thu, 24 Jun 2021 18:00:00 -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=1624571996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u/mqX7lx8NF/gqiPMIAc+K2C3SN2kYUlqIsTn6zfpPE=; b=suDi/p8BRW6WkPjFhWm6UO2MtLXm8+DMlaMY6Criilij0KVAZFt1byMr/IqO6up4PmTJf1 cbjfL+ZwgdvzwglzgTwRSR5q2U34xO0TegyUkuSNIXuxxtttoDOkdNlXWQWZcQwmjKxlKQ qc2zb6nOKQhajvPyTpWaTCBKck33pUfjjRJk95I2hwb4ptkZFS13ucmA3lhaJOOmNg0A43 NWaZwb+jGU6S5iyEMhF9tUSxygVUCyatKwf5C7udgeWNVI3Tl79iCZ0ZFLoSBvkOGwIaSC 9Mh7Jl2zTG448hIONBWtiZdNFw5WaNRlmwrKLHawSGjrix3obrsCNPzJ2qKRew== Date: Thu, 24 Jun 2021 17:59:54 -0400 Message-Id: <20210624215954.11287-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 | 9 +++++++++ gnu/services/certbot.scm | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 15e8999447..560d7af83f 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,14 @@ 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 specified, certbot will use it to obtain a certificate, instead of +using a self-generated CSR. +The domain-name(s) mentioned in @code{domains}, must be consistent with the +domain-name(s) mentioned in CSR file. + @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..46b5abd2ef 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2019 Julien Lepiller ;;; Copyright © 2020 Jack Hill ;;; Copyright © 2020 Tobias Geerinckx-Rice +;;; Copyright © 2021 Raghav Gururajan ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,6 +56,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 @@ -94,8 +97,8 @@ (map (match-lambda (($ custom-name domains challenge - authentication-hook cleanup-hook - deploy-hook) + csr authentication-hook + cleanup-hook deploy-hook) (let ((name (or custom-name (car domains)))) (if challenge (append @@ -105,6 +108,7 @@ "--cert-name" name "--manual-public-ip-logging-ok" "-d" (string-join domains ",")) + (if csr `("--csr" ,csr) '()) (if email `("--email" ,email) '("--register-unsafely-without-email")) @@ -120,6 +124,7 @@ "--webroot" "-w" webroot "--cert-name" name "-d" (string-join domains ",")) + (if csr `("--csr" ,csr) '()) (if email `("--email" ,email) '("--register-unsafely-without-email"))