me
/
guix
Archived
1
0
Fork 0

services: certbot: Add server option.

* gnu/services/certbot.scm (certbot-configuration): Add server option.
(certbot-command): Use server option.
(certbot-actication): Use server option.
(certbot-nginx-server-configurations): Use server option.
* doc/guix.texi (Certificate Services): Document server option.

Co-authored-by: Tobias Geerinckx-Rice <me@tobias.gr>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
Jack Hill 2020-03-05 15:39:48 -05:00 committed by Ludovic Courtès
parent 9ef37e81d6
commit f6713b55a1
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 14 additions and 3 deletions

View File

@ -74,6 +74,7 @@ Copyright @copyright{} 2019, 2020 Simon Tournier@*
Copyright @copyright{} 2020 Wiktor Żelazny@* Copyright @copyright{} 2020 Wiktor Żelazny@*
Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Damien Cassou@*
Copyright @copyright{} 2020 Jakub Kądziołka@* Copyright @copyright{} 2020 Jakub Kądziołka@*
Copyright @copyright{} 2020 Jack Hill@*
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or under the terms of the GNU Free Documentation License, Version 1.3 or
@ -21008,6 +21009,10 @@ and several @code{domains}.
Mandatory email used for registration, recovery contact, and important Mandatory email used for registration, recovery contact, and important
account notifications. account notifications.
@item @code{server} (default: @code{#f})
Optional URL of ACME server. Setting this overrides certbot's default,
which is the Let's Encrypt server.
@item @code{rsa-key-size} (default: @code{2048}) @item @code{rsa-key-size} (default: @code{2048})
Size of the RSA key. Size of the RSA key.

View File

@ -3,6 +3,8 @@
;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> ;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Jack Hill <jackhill@jackhill.us>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -70,6 +72,8 @@
(certificates certbot-configuration-certificates (certificates certbot-configuration-certificates
(default '())) (default '()))
(email certbot-configuration-email) (email certbot-configuration-email)
(server certbot-configuration-server
(default #f))
(rsa-key-size certbot-configuration-rsa-key-size (rsa-key-size certbot-configuration-rsa-key-size
(default #f)) (default #f))
(default-location certbot-configuration-default-location (default-location certbot-configuration-default-location
@ -82,7 +86,7 @@
(define certbot-command (define certbot-command
(match-lambda (match-lambda
(($ <certbot-configuration> package webroot certificates email (($ <certbot-configuration> package webroot certificates email
rsa-key-size default-location) server rsa-key-size default-location)
(let* ((certbot (file-append package "/bin/certbot")) (let* ((certbot (file-append package "/bin/certbot"))
(rsa-key-size (and rsa-key-size (number->string rsa-key-size))) (rsa-key-size (and rsa-key-size (number->string rsa-key-size)))
(commands (commands
@ -101,6 +105,7 @@
"--cert-name" name "--cert-name" name
"--manual-public-ip-logging-ok" "--manual-public-ip-logging-ok"
"-d" (string-join domains ",")) "-d" (string-join domains ","))
(if server `("--server" ,server) '())
(if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '())
(if authentication-hook (if authentication-hook
`("--manual-auth-hook" ,authentication-hook) `("--manual-auth-hook" ,authentication-hook)
@ -113,6 +118,7 @@
"--webroot" "-w" webroot "--webroot" "-w" webroot
"--cert-name" name "--cert-name" name
"-d" (string-join domains ",")) "-d" (string-join domains ","))
(if server `("--server" ,server) '())
(if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '())
(if deploy-hook `("--deploy-hook" ,deploy-hook) '())))))) (if deploy-hook `("--deploy-hook" ,deploy-hook) '()))))))
certificates))) certificates)))
@ -142,7 +148,7 @@
(message (format #f (G_ "~a may need to be run~%") script))) (message (format #f (G_ "~a may need to be run~%") script)))
(match config (match config
(($ <certbot-configuration> package webroot certificates email (($ <certbot-configuration> package webroot certificates email
rsa-key-size default-location) server rsa-key-size default-location)
(with-imported-modules '((guix build utils)) (with-imported-modules '((guix build utils))
#~(begin #~(begin
(use-modules (guix build utils)) (use-modules (guix build utils))
@ -154,7 +160,7 @@
(define certbot-nginx-server-configurations (define certbot-nginx-server-configurations
(match-lambda (match-lambda
(($ <certbot-configuration> package webroot certificates email (($ <certbot-configuration> package webroot certificates email
rsa-key-size default-location) server rsa-key-size default-location)
(list (list
(nginx-server-configuration (nginx-server-configuration
(listen '("80" "[::]:80")) (listen '("80" "[::]:80"))