unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#73465] [PATCH] Wireguard: Rename field private-key to private-key-file
@ 2024-09-25  3:58 Apoorv Singh
  2024-09-26 17:39 ` Sergey Trofimov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Apoorv Singh @ 2024-09-25  3:58 UTC (permalink / raw)
  To: 73465

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

The following patches renames the field private-key to private-key-file as it makes it more clear that it needs path to a file rather than the key it self

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Wireguard rename field private-key to private-key-file --]
[-- Type: text/x-patch, Size: 3041 bytes --]

From 92e6d353a72e9ed0ee7097f2e5e5ff76521455a7 Mon Sep 17 00:00:00 2001
From: apoorv569 <apoorvs569@gmail.com>
Date: Wed, 25 Sep 2024 09:06:05 +0530
Subject: [PATCH 1/2] Wireguard rename field private-key to private-key-file

---
 gnu/services/vpn.scm | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index 7fb4775757..449909e34d 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -741,7 +741,7 @@ (define-record-type* <wireguard-configuration>
                       (default '("10.0.0.1/32")))
   (port               wireguard-configuration-port ;integer
                       (default 51820))
-  (private-key        wireguard-configuration-private-key ;string
+  (private-key-file   wireguard-configuration-private-key-file ;string
                       (default "/etc/wireguard/private.key"))
   (peers              wireguard-configuration-peers ;list of <wiregard-peer>
                       (default '()))
@@ -782,7 +782,7 @@ (define (peers->preshared-keys peer keys)
           keys)))
 
   (match-record config <wireguard-configuration>
-    (wireguard interface addresses port private-key peers dns
+    (wireguard interface addresses port private-key-file peers dns
                pre-up post-up pre-down post-down table)
     (let* ((config-file (string-append interface ".conf"))
            (peer-keys (fold peers->preshared-keys (list) peers))
@@ -807,7 +807,7 @@ (define lines
                            (list (format #f "~{PreUp = ~a~%~}" pre-up)))
                     (format #f "PostUp = ~a set %i private-key ~a\
 ~{ peer ~a preshared-key ~a~}" #$(file-append wireguard "/bin/wg")
-#$private-key '#$peer-keys)
+#$private-key-file '#$peer-keys)
                     #$@(if (null? post-up)
                            '()
                            (list (format #f "~{PostUp = ~a~%~}" post-up)))
@@ -833,22 +833,22 @@ (define lines
 
 (define (wireguard-activation config)
   (match-record config <wireguard-configuration>
-    (private-key wireguard)
+    (private-key-file wireguard)
     #~(begin
         (use-modules (guix build utils)
                      (ice-9 popen)
                      (ice-9 rdelim))
-        (mkdir-p (dirname #$private-key))
-        (unless (file-exists? #$private-key)
+        (mkdir-p (dirname #$private-key-file))
+        (unless (file-exists? #$private-key-file)
           (let* ((pipe
                   (open-input-pipe (string-append
                                     #$(file-append wireguard "/bin/wg")
                                     " genkey")))
                  (key (read-line pipe)))
-            (call-with-output-file #$private-key
+            (call-with-output-file #$private-key-file
               (lambda (port)
                 (display key port)))
-            (chmod #$private-key #o400)
+            (chmod #$private-key-file #o400)
             (close-pipe pipe))))))
 
 ;;; XXX: Copied from (guix scripts pack), changing define to define*.
-- 
2.46.0


[-- Attachment #3: Type: text/plain, Size: 41 bytes --]

.

-- 
- Apoorv Singh
- Sent from Emacs.

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

end of thread, other threads:[~2024-10-05  3:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25  3:58 [bug#73465] [PATCH] Wireguard: Rename field private-key to private-key-file Apoorv Singh
2024-09-26 17:39 ` Sergey Trofimov
2024-09-28  5:29 ` [bug#73465] " Apoorv Singh
2024-09-30  7:04 ` Apoorv Singh
2024-10-05  3:35 ` [bug#73465] Wireguard: Deprecate and rename fields Apoorv Singh

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).