summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-02-10 17:27:19 +0100
committerClément Lassieur <clement@lassieur.org>2018-02-22 21:43:54 +0100
commita2cb2bbc0ba984398dd79ff7bd37af8960f67ced (patch)
treebaae47df220e0fcb43577ce75f070072a019b122 /gnu
parent0420a293cc25ccf4c0958fd68e6e3ccb9394cb21 (diff)
downloadguix-a2cb2bbc0ba984398dd79ff7bd37af8960f67ced.tar.gz
services: certbot: Allow to set RSA key size.
* doc/guix.texi (Certificate Services): Document it.
* gnu/services/certbot.scm (<cerbot-configuration>, certbot-command,
certbot-activation, certbot-nginx-server-configurations): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/certbot.scm21
1 files changed, 13 insertions, 8 deletions
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index a70a36591d..51f5d719aa 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -60,6 +60,8 @@
   (certificates        certbot-configuration-certificates
                        (default '()))
   (email               certbot-configuration-email)
+  (rsa-key-size        certbot-configuration-rsa-key-size
+                       (default #f))
   (default-location    certbot-configuration-default-location
                        (default
                          (nginx-location-configuration
@@ -70,17 +72,20 @@
 (define certbot-command
   (match-lambda
     (($ <certbot-configuration> package webroot certificates email
-                                default-location)
+                                rsa-key-size default-location)
      (let* ((certbot (file-append package "/bin/certbot"))
+            (rsa-key-size (and rsa-key-size (number->string rsa-key-size)))
             (commands
              (map
               (match-lambda
                 (($ <certificate-configuration> name domains)
-                 (list certbot "certonly" "-n" "--agree-tos"
-                       "-m" email
-                       "--webroot" "-w" webroot
-                       "--cert-name" (or name (car domains))
-                       "-d" (string-join domains ","))))
+                 (append
+                  (list certbot "certonly" "-n" "--agree-tos"
+                        "-m" email
+                        "--webroot" "-w" webroot
+                        "--cert-name" (or name (car domains))
+                        "-d" (string-join domains ","))
+                  (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()))))
               certificates)))
        (program-file
         "certbot-command"
@@ -100,7 +105,7 @@
 (define (certbot-activation config)
   (match config
     (($ <certbot-configuration> package webroot certificates email
-                                default-location)
+                                rsa-key-size default-location)
      (with-imported-modules '((guix build utils))
        #~(begin
            (use-modules (guix build utils))
@@ -110,7 +115,7 @@
 (define certbot-nginx-server-configurations
   (match-lambda
     (($ <certbot-configuration> package webroot certificates email
-                                default-location)
+                                rsa-key-size default-location)
      (list
       (nginx-server-configuration
        (listen '("80" "[::]:80"))