unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jack Hill <jackhill@jackhill.us>
To: guix-devel@gnu.org
Subject: Certbot with alternative certificate authority
Date: Thu, 5 Mar 2020 13:57:35 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.20.2003051334390.19733@marsh.hcoop.net> (raw)

Hi Guix,

I'm working on making the certbot service work with any certificate 
authority that implements ACME, not just Let's Encrypt. I've done this by 
adding a server field to the certbot-configuration, and then using it in 
the match for certbot-command as follows:

```
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index 0d3be03383..3e71026387 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -70,6 +70,8 @@
    (certificates        certbot-configuration-certificates
                         (default '()))
    (email               certbot-configuration-email)
+  (server              certbot-configuration-server
+                       (default #f))
    (rsa-key-size        certbot-configuration-rsa-key-size
                         (default #f))
    (default-location    certbot-configuration-default-location
@@ -82,7 +84,7 @@
  (define certbot-command
    (match-lambda
      (($ <certbot-configuration> package webroot certificates email
-                                rsa-key-size default-location)
+                                server 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
@@ -101,6 +103,7 @@
                              "--cert-name" name
                              "--manual-public-ip-logging-ok"
                              "-d" (string-join domains ","))
+                      (if server `("--server" ,server) '())
                        (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '())
                        (if authentication-hook
                            `("--manual-auth-hook" ,authentication-hook)
@@ -113,6 +116,7 @@
                              "--webroot" "-w" webroot
                              "--cert-name" name
                              "-d" (string-join domains ","))
+                      (if server `("--server" ,server) '())
                        (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '())
                        (if deploy-hook `("--deploy-hook" ,deploy-hook) '()))))))
                certificates)))
```


However, reconfiguring with the following certbot service:

```
(service certbot-service-type
 	  (certbot-configuration
 		   (email "jackhill@jackhill.us")
 		   (rsa-key-size 4096)
 		   (server "https://example.com/acme/api")
 		   (certificates
 		    (list
 		     (certificate-configuration
 		      (domains '("test.jackhill.us")))))))
```

fails with:

```
Backtrace:
            1 (primitive-load "/tmp/cerbot-test2/bin/guix")
In guix/ui.scm:
   1826:12  0 (run-guix-command _ . _)

guix/ui.scm:1826:12: In procedure run-guix-command:
Throw to key `match-error' with args `("match" "no matching pattern" 4096)'.
```

When removing "(rsa-key-size 4096)" from my configuration, everthing works 
as expected with the default key size.

What error have I made?

Best,
Jack

             reply	other threads:[~2020-03-05 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 18:57 Jack Hill [this message]
2020-03-05 19:49 ` Certbot with alternative certificate authority Jack Hill
2020-03-05 20:42   ` Jack Hill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.2003051334390.19733@marsh.hcoop.net \
    --to=jackhill@jackhill.us \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).