all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#55055] [PATCH] gnu: wireguard: Add support for PresharedKey
@ 2022-04-21 13:26 Paul Alesius
  2022-04-21 14:25 ` Maxime Devos
  2022-12-26 16:53 ` bug#55055: " Mathieu Othacehe
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Alesius @ 2022-04-21 13:26 UTC (permalink / raw)
  To: 55055


[-- Attachment #1.1: Type: text/plain, Size: 193 bytes --]

The WireGuard configuration supports a PresharedKey attribute for
additional security. This patch adds support for configuring a PresharedKey
attribute.

Tested, working.

With regards,
- Paul

[-- Attachment #1.2: Type: text/html, Size: 292 bytes --]

[-- Attachment #2: guix.wg-psk.patch --]
[-- Type: application/octet-stream, Size: 1744 bytes --]

diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index b24e9cffb3..e3f5ff0d05 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -62,6 +62,7 @@ (define-module (gnu services vpn)
             wireguard-peer-allowed-ips
             wireguard-peer-public-key
             wireguard-peer-keep-alive
+            wireguard-peer-preshared-key
 
             wireguard-configuration
             wireguard-configuration?
@@ -701,6 +702,8 @@ (define-record-type* <wireguard-peer>
   (endpoint          wireguard-peer-endpoint
                      (default #f))     ;string
   (public-key        wireguard-peer-public-key)   ;string
+  (preshared-key     wireguard-peer-preshared-key
+                     (default #f))   ;string
   (allowed-ips       wireguard-peer-allowed-ips) ;list of strings
   (keep-alive        wireguard-peer-keep-alive
                      (default #f)))    ;integer
@@ -727,16 +730,20 @@ (define (wireguard-configuration-file config)
   (define (peer->config peer)
     (let ((name (wireguard-peer-name peer))
           (public-key (wireguard-peer-public-key peer))
+          (preshared-key (wireguard-peer-preshared-key peer))
           (endpoint (wireguard-peer-endpoint peer))
           (allowed-ips (wireguard-peer-allowed-ips peer))
           (keep-alive (wireguard-peer-keep-alive peer)))
       (format #f "[Peer] #~a
 PublicKey = ~a
 AllowedIPs = ~a
-~a~a"
+~a~a~a"
               name
               public-key
               (string-join allowed-ips ",")
+              (if preshared-key
+                  (format #f "PresharedKey = ~a\n" preshared-key)
+                  "")
               (if endpoint
                   (format #f "Endpoint = ~a\n" endpoint)
                   "")

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-26 16:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-21 13:26 [bug#55055] [PATCH] gnu: wireguard: Add support for PresharedKey Paul Alesius
2022-04-21 14:25 ` Maxime Devos
     [not found]   ` <CAL8jUGUyedoy+9va2qGJR5QpXn5B6cn7dWODyBJ0kxq1HQ+GYQ@mail.gmail.com>
2022-04-21 20:41     ` [bug#55055] Fwd: " Paul Alesius
2022-04-21 21:55       ` Maxime Devos
2022-04-21 21:59       ` Maxime Devos
2022-04-21 21:48     ` Maxime Devos
2022-12-26 16:53 ` bug#55055: " Mathieu Othacehe

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.