From: Richard Sent <richard@freakingpenguin.com>
To: "Clément Lassieur" <clement@lassieur.org>
Cc: help-guix@gnu.org
Subject: Re: Using gexps in wireguard-service-type postup
Date: Sun, 28 Jan 2024 13:36:19 -0500 [thread overview]
Message-ID: <87v87dnw4c.fsf@freakingpenguin.com> (raw)
In-Reply-To: <87wmrttuz3.fsf@lassieur.org> ("Clément Lassieur"'s message of "Sun, 28 Jan 2024 15:04:32 +0100")
Clément Lassieur <clement@lassieur.org> writes:
On 2024-01-28 09:04, Clément Lassieur wrote:
> Hi Richard,
> which would be se same as
>
> (private-key #~(string-append #$sudo "/bin/sudo -u user <(pass ...)"))
Thanks. I made some progress with this, although I wound up hitting
another hurdle with the preshared-key.
When setting private-key, the following works fine:
--8<---------------cut here---------------start------------->8---
(private-key
#~(string-append "<("
#$sudo "/bin/sudo" " -u richard "
#$password-store "/bin/pass ls " #$wireguard-nickleslan-private-key-key
")"))
--8<---------------cut here---------------end--------------->8---
preshared-key, unfortunately, doesn't follow that same pattern. When
setting preshared keys with the following snippet:
--8<---------------cut here---------------start------------->8---
(wireguard-peer
...
(preshared-key
#~(string-append "<("
#$sudo "/bin/sudo -u richard "
#$password-store "/bin/pass ls " #$wireguard-nickleslan-preshared-key-key
")")))
--8<---------------cut here---------------end--------------->8---
I wind up with a wireguard.conf file with the following line.
--8<---------------cut here---------------start------------->8---
PostUp = /gnu/store/4cnl0h79zc599xryr5jh66d7yq643zk4-wireguard-tools-1.0.20210914/bin/wg set %i private-key <(/gnu/store/gnybfg31is632dyaivd907f2h0wff80d-sudo-1.9.14p3/bin/sudo -u richard /gnu/store/ppd5qmx2b5fadjhww65xw09zkjphll6r-password-store-1.7.4/bin/pass ls System/WireGuard/NicklesBread/private.key) peer EHoPXGJvQVVpQ6PZ/XQtHx0p5FWEVCS3y2oI2O+Y9zo= preshared-key (string-append <( /gnu/store/gnybfg31is632dyaivd907f2h0wff80d-sudo-1.9.14p3 /bin/sudo -u richard /gnu/store/ppd5qmx2b5fadjhww65xw09zkjphll6r-password-store-1.7.4 /bin/pass ls System/WireGuard/NicklesBread/preshared.key ))
--8<---------------cut here---------------end--------------->8---
Emphasis on how everything after preshared-key is a Lisp sexp, not
evaluated output. I'm guessing this is because in gnu/services/vpn.scm,
the relevant code is
l
--8<---------------cut here---------------start------------->8---
(format #f "PostUp = ~a set %i private-key ~a\
~{ peer ~a preshared-key ~a~}" #$(file-append wireguard "/bin/wg")
#$private-key '#$peer-keys)
--8<---------------cut here---------------end--------------->8---
Peer keys is quoted immediately before the ungexp. I'm curious why that
would be done and how I can get preshared-key set correctly.
I did try changing preshared-key to (preshared-key #~,(...)), but that
didn't accomplish anything besides creating a wireguard.config file with
`preshared-key (unquote (string-append ...))` I assume this is because a
quote (') is used instead of a quasiquote (`).
Is there anything on my end I can do to fix this or does it have to be
resolved in Guix proper?
--
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.
next prev parent reply other threads:[~2024-01-28 18:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 2:19 Using gexps in wireguard-service-type postup Richard Sent
2024-01-28 12:51 ` Marek Paśnikowski
2024-01-28 14:04 ` Clément Lassieur
2024-01-28 18:36 ` Richard Sent [this message]
2024-01-28 22:59 ` Clément Lassieur
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=87v87dnw4c.fsf@freakingpenguin.com \
--to=richard@freakingpenguin.com \
--cc=clement@lassieur.org \
--cc=help-guix@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.
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).