GNU bug report logs - #73465
[PATCH] Wireguard: Rename field private-key to private-key-file

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Apoorv Singh <apoorvs569@HIDDEN>; Keywords: patch; dated Wed, 25 Sep 2024 05:47:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 73465 <at> debbugs.gnu.org:


Received: (at 73465) by debbugs.gnu.org; 9 Dec 2024 17:05:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 09 12:05:42 2024
Received: from localhost ([127.0.0.1]:55401 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tKhCY-0008W0-6w
	for submit <at> debbugs.gnu.org; Mon, 09 Dec 2024 12:05:42 -0500
Received: from mail-108-mta181.mxroute.com ([136.175.108.181]:33877)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <richard@HIDDEN>) id 1tKhCS-0008Vn-64
 for 73465 <at> debbugs.gnu.org; Mon, 09 Dec 2024 12:05:40 -0500
Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com)
 (Authenticated sender: mN4UYu2MZsgR)
 by mail-108-mta181.mxroute.com (ZoneMTA) with ESMTPSA id
 193ac6221bb0013e01.001 for <73465 <at> debbugs.gnu.org>
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Mon, 09 Dec 2024 17:05:32 +0000
X-Zone-Loop: d95360fe593c87b6a21ab5cf70859130d9699c52b4f8
X-Originating-IP: [136.175.111.3]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=freakingpenguin.com; s=x; h=Content-Type:MIME-Version:Message-ID:Date:
 References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:
 List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=TdJLYv9AdcncdRbZ3t3zJSX7KYx9xTQPtJBD6rz0NqY=; b=nEFi9oel/FgeSOxy6zmzEYPZQv
 61fOt0xovuza0y2iUDN7eWD/2iEy7Pwlpew14SPt3pi8GTpIRFFKsyh9sQT4mSdnsl6lPkaBf8RzT
 Od/rBnlX1botjbDhyfT47qwYuO79tNdoR+R1d6c8aMmWl1Ic+3NmXKJ3F8J4LN0/WzIaUubTK/Vey
 Px6prDiKK2hpDW6KNxtSocn17SIkcUyLEZekUbayk8PnmEGpWGnRYxTAJEG8lNRNJKe58QasO/N9B
 a1jecghSUousKHvqb5iZKB0S5W08kQGxfnOmVBXN+PtGe4kG1ORg1EU0Tt4qD7M3wHyfEbocBSnss
 79xcUF6w==;
From: Richard Sent <richard@HIDDEN>
To: Apoorv Singh <apoorvs569@HIDDEN>
Subject: Re: [bug#73465] Wireguard: Deprecate and rename fields
In-Reply-To: <87y133cjc1.fsf@HIDDEN> (Apoorv Singh's message of "Sat, 05
 Oct 2024 09:05:58 +0530")
References: <87h6a4jsej.fsf@HIDDEN> <87y133cjc1.fsf@HIDDEN>
Date: Mon, 09 Dec 2024 12:05:22 -0500
Message-ID: <87ldwo4wj1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Authenticated-Id: richard@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 73465
Cc: 73465 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

With #73955, private-key better supports g-exp based command redirection,
e.g.

--8<---------------cut here---------------start------------->8---
;; A config of
(wireguard-configuration
  ...
  (private-key (string-append "(<" my-custom-script ">")))

;; Results in
PostUp = ... set %i private-key <(/gnu/store/...-my-custom-script) ...
--8<---------------cut here---------------end--------------->8---

(This was also supported before but was more limited.)

Given that, I think renaming it to private-key-file is more confusing
than keeping it as private-key. Same for preshared-key.

Perhaps we can somehow check the field, see if the user enters a
WG-compatible key literally, and emit a warning? I'm not fluent on the
format to determine the best way for that.
-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




Information forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.

Message received at 73465 <at> debbugs.gnu.org:


Received: (at 73465) by debbugs.gnu.org; 5 Oct 2024 03:37:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 04 23:37:14 2024
Received: from localhost ([127.0.0.1]:37086 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1swvbW-0000Wk-5L
	for submit <at> debbugs.gnu.org; Fri, 04 Oct 2024 23:37:14 -0400
Received: from mail-pl1-f178.google.com ([209.85.214.178]:47261)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <apoorvs569@HIDDEN>) id 1swvbU-0000WT-CG
 for 73465 <at> debbugs.gnu.org; Fri, 04 Oct 2024 23:37:13 -0400
Received: by mail-pl1-f178.google.com with SMTP id
 d9443c01a7336-20b7eb9e81eso32610505ad.2
 for <73465 <at> debbugs.gnu.org>; Fri, 04 Oct 2024 20:37:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1728099362; x=1728704162; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=tI2ng6c7Ai6nEbWKkne6v2eVNDUdQJViLcdj3zPJ9Ps=;
 b=LmnPtecaTuTorJC2/F+AaWgC2EQJUN9YEU/K2wrukRgxibDvS6tXyCvE8hpR518xxe
 p26VFlQ2ToPIdUZTJkyHkBBhyHfYtVSI9rau4o04ttIfYEGmkEiXvUD0R3n+BFFXPg7u
 v9VQmcQT1J2ujaelqQKV5PIu7N4t7DkmcL5vwoDHGRE5wnRgDstnq/cG+dBL6ibNQye6
 c7ZvwQGEY+p3ElvUR579mvB/Y/GE1Gru0iKSAPp8ILggNQ8ytFdENsAB3AbzV4eDtYCd
 +5PQJvzvdflgTUU6XaMSwu/gj2JIB99tprC7baR4cDG6Pq/yid0na/mENaZL16SarAUJ
 5W0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728099362; x=1728704162;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=tI2ng6c7Ai6nEbWKkne6v2eVNDUdQJViLcdj3zPJ9Ps=;
 b=FTA4aRgXuvnDgY2Bk5mKuTF5Ssc5eAjWefUHA44C3F5PmE3/JSOy88Du0HW60DJNsh
 dHzKOoKegNhs4LqS0hnUW1lByqPYClfozsFZojykPlCoXBYu/Pwkg+TVznbjKcNDEqOW
 gU6xPKNzP2sYQYzqii471Z2+aPD76DxTpzbwzsNOvo8KW646HehVENfkOdDcxg2i5meW
 L6kYK0M0foZLfhH5Mv7JBSjpb+aPwaDjHjJ6giL4NBDVGSyF5yYaqwX8IBRu34XlgxQy
 UNw/mV86oLCiIq2YdKtt1PCxkni2Xlu8OSb8DLWDmz9AzayZn1Ux3865BlTYisxVlkNQ
 5W5Q==
X-Gm-Message-State: AOJu0YzMqQlNgyxNkbAqM8ZkZL1gwFOKhAasn/at/RPe3m96CDINV0vn
 XiQEORaqL68Rqra75l05vV+Ku0oG2EgMQzQ709oGVFHoR+V5sXMb45TL
X-Google-Smtp-Source: AGHT+IGFeYWG5IcSb9iE9rmopSqi/MErWZMoK6tPoiuTiznKRUf3XYKd5otbK6uz4R5NaP40tc9Vag==
X-Received: by 2002:a17:903:2447:b0:20b:6f02:b4e5 with SMTP id
 d9443c01a7336-20bfde5968dmr69813285ad.9.1728099362141; 
 Fri, 04 Oct 2024 20:36:02 -0700 (PDT)
Received: from MachineY ([139.5.251.166]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20c1395a533sm5446105ad.204.2024.10.04.20.36.00
 for <73465 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 04 Oct 2024 20:36:01 -0700 (PDT)
From: Apoorv Singh <apoorvs569@HIDDEN>
To: 73465 <at> debbugs.gnu.org
Subject: Wireguard: Deprecate and rename fields
Date: Sat, 05 Oct 2024 09:05:58 +0530
Message-ID: <87y133cjc1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 73465
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--=-=-=
Content-Type: text/plain; format=flowed

The following patch is a V2 for renaming the following fields,
- preshared-key to preshared-key-file
- private-key to private-key-file

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Wireguard-Deprecate-and-rename-fields-with-warning.patch
Content-Description: Wireguard: Deprecate and rename fields

From 1e0ca84d91fbcac58ec1ce45447407b0f7848661 Mon Sep 17 00:00:00 2001
From: apoorv569 <apoorvs569@HIDDEN>
Date: Wed, 25 Sep 2024 09:06:05 +0530
Subject: [PATCH V2] Wireguard: Deprecate and rename fields with warning

- preshared-key to preshared-key-file
- private-key to private-key-file
---
 gnu/services/vpn.scm | 79 +++++++++++++++++++++++++++++---------------
 1 file changed, 52 insertions(+), 27 deletions(-)

diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index aab41680d3..efdb85e3a6 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -67,7 +67,8 @@ (define-module (gnu services vpn)
             wireguard-peer-endpoint
             wireguard-peer-allowed-ips
             wireguard-peer-public-key
-            wireguard-peer-preshared-key
+            wireguard-peer-preshared-key  ; deprecated
+            wireguard-peer-preshared-key-file
             wireguard-peer-keep-alive
 
             wireguard-configuration
@@ -79,7 +80,8 @@ (define-module (gnu services vpn)
             wireguard-configuration-dns
             wireguard-configuration-monitor-ips?
             wireguard-configuration-monitor-ips-interval
-            wireguard-configuration-private-key
+            wireguard-configuration-private-key  ; deprecated
+            wireguard-configuration-private-key-file
             wireguard-configuration-peers
             wireguard-configuration-pre-up
             wireguard-configuration-post-up
@@ -725,8 +727,10 @@ (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
+  (preshared-key     wireguard-peer-preshared-key ;deprecated
                      (default #f))     ;string
+  (preshared-key-file wireguard-peer-preshared-key-file
+                      (default #f))     ;string
   (allowed-ips       wireguard-peer-allowed-ips) ;list of strings
   (keep-alive        wireguard-peer-keep-alive
                      (default #f)))    ;integer
@@ -742,7 +746,9 @@ (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        wireguard-configuration-private-key ;string ;deprecated
+                      (default "/etc/wireguard/private.key"))
+  (private-key-file   wireguard-configuration-private-key-file ;string
                       (default "/etc/wireguard/private.key"))
   (peers              wireguard-configuration-peers ;list of <wiregard-peer>
                       (default '()))
@@ -778,18 +784,31 @@ (define (peer->config peer)
         (string-join (remove string-null? lines) "\n"))))
 
   (define (peers->preshared-keys peer keys)
-    (let ((public-key (wireguard-peer-public-key peer))
-          (preshared-key (wireguard-peer-preshared-key peer)))
-      (if preshared-key
-          (cons* public-key preshared-key keys)
+    (let* ((public-key (wireguard-peer-public-key peer))
+          (preshared-key (wireguard-peer-preshared-key peer))
+          (preshared-key-file (wireguard-peer-preshared-key-file peer))
+          (final-preshared-key (or preshared-key preshared-key-file)))
+
+      ;; XXX Warn about deprecated preshared-key field with newer replacement
+      (when preshared-key
+        (warn-about-deprecation 'preshared-key #f #:replacement 'preshared-key-file))
+
+      (if final-preshared-key
+          (cons* public-key final-preshared-key keys)
           keys)))
 
   (match-record config <wireguard-configuration>
-    (wireguard interface addresses port private-key peers dns
+    (wireguard interface addresses port private-key-file private-key peers dns
                pre-up post-up pre-down post-down table)
+
+    ;; XXX Warn about deprecated private-key field with newer replacement
+    (when private-key
+      (warn-about-deprecation 'private-key #f #:replacement 'private-key-file))
+
     (let* ((config-file (string-append interface ".conf"))
            (peer-keys (fold peers->preshared-keys (list) peers))
            (peers (map peer->config peers))
+           (final-private-key (or private-key private-key-file))
            (config
             (computed-file
              "wireguard-config"
@@ -810,7 +829,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)
+#$final-private-key '#$peer-keys)
                     #$@(if (null? post-up)
                            '()
                            (list (format #f "~{PostUp = ~a~%~}" post-up)))
@@ -836,23 +855,29 @@ (define lines
 
 (define (wireguard-activation config)
   (match-record config <wireguard-configuration>
-    (private-key wireguard)
-    #~(begin
-        (use-modules (guix build utils)
-                     (ice-9 popen)
-                     (ice-9 rdelim))
-        (mkdir-p (dirname #$private-key))
-        (unless (file-exists? #$private-key)
-          (let* ((pipe
-                  (open-input-pipe (string-append
-                                    #$(file-append wireguard "/bin/wg")
-                                    " genkey")))
-                 (key (read-line pipe)))
-            (call-with-output-file #$private-key
-              (lambda (port)
-                (display key port)))
-            (chmod #$private-key #o400)
-            (close-pipe pipe))))))
+    (private-key private-key-file wireguard)
+
+    ;; XXX Warn about deprecated private-key field with newer replacement
+    (when private-key
+      (warn-about-deprecation 'private-key #f #:replacement 'private-key-file))
+
+    (let ((final-private-key (or private-key private-key-file)))
+      #~(begin
+          (use-modules (guix build utils)
+                       (ice-9 popen)
+                       (ice-9 rdelim))
+          (mkdir-p (dirname #$final-private-key))
+          (unless (file-exists? #$final-private-key)
+            (let* ((pipe
+                    (open-input-pipe (string-append
+                                      #$(file-append wireguard "/bin/wg")
+                                      " genkey")))
+                   (key (read-line pipe)))
+              (call-with-output-file #$final-private-key
+                (lambda (port)
+                  (display key port)))
+              (chmod #$final-private-key #o400)
+              (close-pipe pipe)))))))
 
 ;;; XXX: Copied from (guix scripts pack), changing define to define*.
 (define-syntax-rule (define-with-source (variable args ...) body body* ...)
-- 
2.46.0


--=-=-=
Content-Type: text/plain; format=flowed


-- 
- Apoorv Singh
- Sent from Emacs.

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.

Message received at 73465 <at> debbugs.gnu.org:


Received: (at 73465) by debbugs.gnu.org; 30 Sep 2024 07:28:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 30 03:28:48 2024
Received: from [127.0.0.1] (port=44566 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1svApj-00066s-Ik
	for submit <at> debbugs.gnu.org; Mon, 30 Sep 2024 03:28:46 -0400
Received: from [209.85.210.176] (port=50473 helo=mail-pf1-f176.google.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <apoorvs569@HIDDEN>) id 1svAUb-0005GL-FY
 for 73465 <at> debbugs.gnu.org; Mon, 30 Sep 2024 03:09:09 -0400
Received: by mail-pf1-f176.google.com with SMTP id
 d2e1a72fcca58-71c702b2d50so671847b3a.1
 for <73465 <at> debbugs.gnu.org>; Mon, 30 Sep 2024 00:06:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727679902; x=1728284702; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=bhBmXF/5ybyJMiTpzij9PrNx2q6SchOatI1eIHF0hiY=;
 b=X6Ls1o2uOlehXTHVu5XivK1r3yGkjAxMeiNWIzFcuJO+hau8y1T+aO3+jGEnKz9bnP
 1HuU3X2IXW5F1vWczk3umVo/Q4zKYWgKjXUy+YseUZ/Iv81ia81QgTrqCsnJgjnOxMQg
 PySMXhbYZscrT8cEICVUnscoijdYsSYjxVXR+lmzgZQDZw29DsEyV9HVUUvNPiUfKMSu
 mA4k/NaOco80OqF8yPeRe0NP05ki3f6rV+EDzHHIN19YmUf4ec5czqUu4ozMz05H9sAX
 3EogRw0e8X8I5HNsvanbeVqBS0/GVvuWWVvL1FmgsV7qHcxmDB8Xm8jCeHqtGZDFVX6O
 7Yvg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727679902; x=1728284702;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=bhBmXF/5ybyJMiTpzij9PrNx2q6SchOatI1eIHF0hiY=;
 b=hz/cfmP/q0buNtI8MkL/8cUbE56g8v+5iBdxDBYoikKpQiI8q+lbr4Qr+upqvYlzVs
 NbQeYOX3OyX6bSu1eKeXqPQD/YZ4N+c1fD7mj6k7+iv/GKmrL3jAT3mSNRPmIWA28lCh
 V+afc1g4ldtH2TAuzD0HlQmWpIvC3fxuKTMib7lqBDBkKjYy6LHFn7wDohX01gH9gpjO
 mVd4Dz8Uw85W8pO4xtekFmbMMxiR8KgxZ/2oa+GoGcoELGdi6Sjl0qfptNHNQgEDKe6y
 /rBCTX6VAVHE/t3+Wu9ATH8qZkmepm0BS/RhAskP/GHOlnyf4FpyoxQNcus4pFKclJ4g
 vZOg==
X-Gm-Message-State: AOJu0YxvoFvylqY9CnFkUSQwDtopNQp/F/9da2xqW1fbGql/x0wmVBS1
 ao0I+5MDHSEZdbYwkGZgecFtS6+3pcBqpdq7zLekZ/eDCqF02fWrHwou
X-Google-Smtp-Source: AGHT+IHo9m2r3FWZCWuykgRijHc0yYp/BUcxokrdqWtNn6jOtqcAm3l1bUy58UU+gzmq48p9KYh2og==
X-Received: by 2002:a05:6a20:2799:b0:1d4:fae4:7543 with SMTP id
 adf61e73a8af0-1d4fae47560mr13230003637.0.1727679901464; 
 Mon, 30 Sep 2024 00:05:01 -0700 (PDT)
Received: from MachineY ([139.5.251.241]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71b264bccc1sm5551971b3a.82.2024.09.30.00.04.59
 for <73465 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 30 Sep 2024 00:05:00 -0700 (PDT)
From: Apoorv Singh <apoorvs569@HIDDEN>
To: 73465 <at> debbugs.gnu.org
Subject: Wireguard: Rename field private-key to private-key-file
Date: Mon, 30 Sep 2024 12:34:58 +0530
Message-ID: <87cyklzko5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  I made some changes, here is the output of `git diff`, ```
 diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index
 eee7e78c6d..ebac4ad943
 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -67,7 +67,8
 @@ (define-module (gnu services vp [...] 
 Content analysis details:   (1.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE:
 The query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [209.85.210.176 listed in sa-trusted.bondedsender.org]
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (apoorvs569[at]gmail.com)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (apoorvs569[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 T_SPF_HELO_TEMPERROR   SPF: test of HELO record failed (temperror)
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-Debbugs-Envelope-To: 73465
X-Mailman-Approved-At: Mon, 30 Sep 2024 03:28:31 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

I made some changes, here is the output of `git diff`,

```
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index eee7e78c6d..ebac4ad943 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -67,7 +67,8 @@ (define-module (gnu services vpn)
             wireguard-peer-endpoint
             wireguard-peer-allowed-ips
             wireguard-peer-public-key
-            wireguard-peer-preshared-key
+            wireguard-peer-preshared-key  ; deprecated
+            wireguard-peer-preshared-key-file
             wireguard-peer-keep-alive

             wireguard-configuration
@@ -79,7 +80,8 @@ (define-module (gnu services vpn)
             wireguard-configuration-dns
             wireguard-configuration-monitor-ips?
             wireguard-configuration-monitor-ips-interval
-            wireguard-configuration-private-key
+            wireguard-configuration-private-key  ; deprecated
+            wireguard-configuration-private-key-file
             wireguard-configuration-peers
             wireguard-configuration-pre-up
             wireguard-configuration-post-up
@@ -721,15 +723,17 @@ (define strongswan-service-type
 (define-record-type* <wireguard-peer>
   wireguard-peer make-wireguard-peer
   wireguard-peer?
-  (name              wireguard-peer-name)
-  (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
+  (name               wireguard-peer-name)
+  (endpoint           wireguard-peer-endpoint
+                      (default #f))     ;string
+  (public-key         wireguard-peer-public-key)   ;string
+  (preshared-key      wireguard-peer-preshared-key ;deprecated
+                      (default #f))     ;string
+  (preshared-key-file wireguard-peer-preshared-key-file
+                      (default #f))     ;string
+  (allowed-ips        wireguard-peer-allowed-ips) ;list of 
strings
+  (keep-alive         wireguard-peer-keep-alive
+                      (default #f)))    ;integer

 (define-record-type* <wireguard-configuration>
   wireguard-configuration make-wireguard-configuration
@@ -742,6 +746,8 @@ (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 
;deprecated
+                      (default "/etc/wireguard/private.key"))
   (private-key-file   wireguard-configuration-private-key-file 
   ;string
                       (default "/etc/wireguard/private.key"))
   (peers              wireguard-configuration-peers ;list of 
   <wiregard-peer>
@@ -778,18 +784,29 @@ (define (peer->config peer)
         (string-join (remove string-null? lines) "\n"))))

   (define (peers->preshared-keys peer keys)
-    (let ((public-key (wireguard-peer-public-key peer))
-          (preshared-key (wireguard-peer-preshared-key peer)))
-      (if preshared-key
-          (cons* public-key preshared-key keys)
+    (let* ((public-key (wireguard-peer-public-key peer))
+          (preshared-key (wireguard-peer-preshared-key peer))
+          (preshared-key-file (wireguard-peer-preshared-key-file 
peer))
+          (final-preshared-key (or preshared-key 
preshared-key-file)))
+      ;; XXX Warn about deprecated preshared-key field with newer 
replacement
+      (when preshared-key
+        (warn-about-deprecation 'preshared-key #f #:replacement 
'preshared-key-file))
+      (if final-preshared-key
+          (cons* public-key final-preshared-key keys)
           keys)))

   (match-record config <wireguard-configuration>
-    (wireguard interface addresses port private-key-file peers 
     dns
+    (wireguard interface addresses port private-key-file 
private-key peers dns
                pre-up post-up pre-down post-down table)
+
+    ;; XXX Warn about deprecated private-key field with newer 
replacement
+    (when private-key
+      (warn-about-deprecation 'private-key #f #:replacement 
'private-key-file))
+
     (let* ((config-file (string-append interface ".conf"))
            (peer-keys (fold peers->preshared-keys (list) peers))
            (peers (map peer->config peers))
+           (final-private-key (or private-key private-key-file))
            (config
             (computed-file
              "wireguard-config"
@@ -810,7 +827,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-file '#$peer-keys)
+#$final-private-key '#$peer-keys)
                     #$@(if (null? post-up)
                            '()
                            (list (format #f "~{PostUp = ~a~%~}" 
                            post-up)))
@@ -836,23 +853,29 @@ (define lines

 (define (wireguard-activation config)
   (match-record config <wireguard-configuration>
-    (private-key-file wireguard)
-    #~(begin
-        (use-modules (guix build utils)
-                     (ice-9 popen)
-                     (ice-9 rdelim))
-        (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-file
-              (lambda (port)
-                (display key port)))
-            (chmod #$private-key-file #o400)
-            (close-pipe pipe))))))
+    (private-key private-key-file wireguard)
+
+    ;; XXX Warn about deprecated private-key field with newer 
replacement
+    (when private-key
+      (warn-about-deprecation 'private-key #f #:replacement 
'private-key-file))
+
+    (let ((final-private-key (or private-key private-key-file)))
+      #~(begin
+          (use-modules (guix build utils)
+                       (ice-9 popen)
+                       (ice-9 rdelim))
+          (mkdir-p (dirname #$final-private-key))
+          (unless (file-exists? #$final-private-key)
+            (let* ((pipe
+                    (open-input-pipe (string-append
+                                      #$(file-append wireguard 
"/bin/wg")
+                                      " genkey")))
+                   (key (read-line pipe)))
+              (call-with-output-file #$final-private-key
+                (lambda (port)
+                  (display key port)))
+              (chmod #$final-private-key #o400)
+              (close-pipe pipe)))))))

 ;;; XXX: Copied from (guix scripts pack), changing define to 
 define*.
 (define-syntax-rule (define-with-source (variable args ...) body 
 body* ...)
```

If this is desired way of doing this, I will share the formatted 
patch as an attachment. 

-- 
- Apoorv Singh
- Sent from Emacs.




Information forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.

Message received at 73465 <at> debbugs.gnu.org:


Received: (at 73465) by debbugs.gnu.org; 28 Sep 2024 06:41:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 28 02:41:12 2024
Received: from localhost ([127.0.0.1]:47747 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1suR8h-0005Z9-Fr
	for submit <at> debbugs.gnu.org; Sat, 28 Sep 2024 02:41:12 -0400
Received: from mail-io1-f42.google.com ([209.85.166.42]:58468)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <apoorvs569@HIDDEN>) id 1suQBL-0000wU-5q
 for 73465 <at> debbugs.gnu.org; Sat, 28 Sep 2024 01:39:51 -0400
Received: by mail-io1-f42.google.com with SMTP id
 ca18e2360f4ac-8325044e388so110883939f.0
 for <73465 <at> debbugs.gnu.org>; Fri, 27 Sep 2024 22:39:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727501896; x=1728106696; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=4bES5gR/7RMnNBo4E9lUD12rSaBE4LyfNnF02VjAR5o=;
 b=GFX4z9Qt+nZuiOPPcPTUiiw5oTqNxH/vLl219VtWo2vQH7/XN3WQ+D7kot9crGbuGP
 y4DM4kLszuv2ZSkihQkDmoEHC9k1Bcpt9VQG85iSEKyPXizGBoE6q2JPXD89MvF+W3OI
 g9sCcv7/zP84/47c3zMesisPtaGmPcVsFMrp3zzyKQMC4iu2DHo5W23Sx5oC6SNQAauL
 sGztD1RZ9jdHohAkQWq9zUpZrEOpcgP4K0WiuPKOGEiVKKZV85mxKTHEmEF2f3lbnA4M
 5yXPRfnKw2WDij6qZ4cHbjAgm2wiAo9k1IBflnKwip37hECpnNkSXyuDFcWlSkiIzWLb
 SPow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727501896; x=1728106696;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=4bES5gR/7RMnNBo4E9lUD12rSaBE4LyfNnF02VjAR5o=;
 b=SXCuw8fHNmSLrs9DYCLyYCx14va/25zxeUuGppOv8lvoa+mb5pWj71F7SU/dxoj79Y
 ncMzwLg1du1ZRv13pKMoBOx94pg3R8em8RpQBLP1UNlzeOK2NYig+mm/DiTPuuSnZter
 PaEiUrEgFdErR8W99NIv87/YqCbljircoP5IdNv3MZA6rkypz/vlZsvPttF3jT+r3wHm
 Xh9KxIZQc+LZM4dk67ZsbT7DtTIj773quEb6OxvaIp2mveZvnG8WgjlFfZboO+q9MuJh
 5NY41FDBcyFVXo22vDku+jHBLVgjhFU5uM4x5nfDXJE4rrHjAo/im0lu8NxJXUvxmxVK
 rP+w==
X-Gm-Message-State: AOJu0YwT6AA+e5ypgxwQCCuZKJTxpxA0wVmREx3w7RulrcJgo2waHv4R
 X2RAdfgXNJIdoreUIs3DCA3e9AoLXsmFxQiC3iL7Tw1pPcxCK8uCLcyd
X-Google-Smtp-Source: AGHT+IGDgFd3W/gG/tTsZIKziVzTQLXhLdYUD/+dahYzIAR0I2VCg8PJjJO9SKQezEjRMYPVzOZOnw==
X-Received: by 2002:a17:902:d4cf:b0:201:f83e:c25c with SMTP id
 d9443c01a7336-20b367d01bbmr89661115ad.9.1727501370287; 
 Fri, 27 Sep 2024 22:29:30 -0700 (PDT)
Received: from MachineY.disroot.org ([139.5.251.241])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20b37e0d6a0sm20987515ad.169.2024.09.27.22.29.28
 for <73465 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 27 Sep 2024 22:29:29 -0700 (PDT)
From: Apoorv Singh <apoorvs569@HIDDEN>
To: 73465 <at> debbugs.gnu.org
Subject: Wireguard: Rename field private-key to private-key-file
Date: Sat, 28 Sep 2024 10:59:26 +0530
Message-ID: <878qvcjqh5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 73465
X-Mailman-Approved-At: Sat, 28 Sep 2024 02:41:10 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Do you want me to keep both private-key and private-key-file in 
the record but still use private-key for now? but just warn about 
deprecation for the field? Something like,

```
(define-record-type* <wireguard-configuration>
  wireguard-configuration make-wireguard-configuration
  wireguard-configuration?

  ;; other fields here..

  (private-key        wireguard-configuration-private-key-file 
  ;deprecated
                      (default "/etc/wireguard/private.key"))
  (private-key-file   wireguard-configuration-private-key-file 
  ;string
                      (default "/etc/wireguard/private.key"))
```

then, in the `wireguard-configuration-file` procedure, under 
`match-record`, I should do something like,
```
  (match-record config <wireguard-configuration>
    (wireguard interface addresses port private-key peers dns   ;; 
    keeping private-key field here..
               pre-up post-up pre-down post-down table)
    (let* ((config-file (string-append interface ".conf"))
           (peer-keys (fold peers->preshared-keys (list) peers))
           (peers (map peer->config peers))
           (config
            (computed-file
             "wireguard-config"
             #~(begin
                 (use-modules (ice-9 format)
                              (srfi srfi-1))

                 (define lines
                   (list
                     ;; other stuff..

                    (when (not (string-null? #$private-key))
                      (warn-about-deprecation 'private-key
                                              #f
                                              #:replacement 
                                              'private-key-file))

                    (format #f "PostUp = ~a set %i private-key ~a\
~{ peer ~a preshared-key ~a~}" #$(file-append wireguard "/bin/wg")
#$private-key '#$peer-keys)     ;; using private-key field here 
 still..


Sorry I'm not familiar with how all this works. Just making sure 
before I commit any changes.

Also by adjust the documentation you mean edit the 
doc/guix.texi:34373 file and append something like,
```
@item @code{private-key} (default: 
@code{"/etc/wireguard/private.key"})
The private key file for the interface.  It is automatically 
generated
if the file does not exist.  'Using private-key' is deprecated use 
'private-key-file' instead.
```

-- 
- Apoorv Singh
- Sent from Emacs.




Information forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.

Message received at 73465 <at> debbugs.gnu.org:


Received: (at 73465) by debbugs.gnu.org; 26 Sep 2024 18:11:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 26 14:11:48 2024
Received: from localhost ([127.0.0.1]:47723 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1stsxw-0002oO-8U
	for submit <at> debbugs.gnu.org; Thu, 26 Sep 2024 14:11:48 -0400
Received: from mail-lj1-f179.google.com ([209.85.208.179]:50302)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1stsxu-0002nu-MT
 for 73465 <at> debbugs.gnu.org; Thu, 26 Sep 2024 14:11:47 -0400
Received: by mail-lj1-f179.google.com with SMTP id
 38308e7fff4ca-2f75c6ed428so15134001fa.0
 for <73465 <at> debbugs.gnu.org>; Thu, 26 Sep 2024 11:11:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1727374213; x=1727979013; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:subject:cc:to:from:from:to
 :cc:subject:date:message-id:reply-to;
 bh=V4BKRzb7h4z8qypm9NiNqMf9MBeh0dhHQw6sc2jbNKw=;
 b=Y8W4U3b5amlJhIx8LWk48XEG8Zw+qYHsDWIGNe8lHM9YHkuhoTi1oFWkPW8SVR0m7D
 dpjqvUEpcpw+r5OzfsXuVUxtgL2TaEnfYYNaq6sei0oFTNWdf0/viD2iWWyOFgK0vrFN
 UQYyTEDlfaZDvIVOXEKrbnnTDL/cYCSlmYzaJopLgZrVvA5GtxpreD+RXd0Q1jXsO9dy
 wFYYR/Qh+eenXn4tesArMg/19bzefeLRHZi3M40o+p3zMwmiQdRfGb7EP1A/dx63YMGL
 hwBlcX/xbu2ILgIw8I/5qJEsgsydZCdJ13jqkmuWaKbBgBVJqZ5KdnlccWuXwa0F42co
 dldA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727374213; x=1727979013;
 h=mime-version:user-agent:message-id:date:subject:cc:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=V4BKRzb7h4z8qypm9NiNqMf9MBeh0dhHQw6sc2jbNKw=;
 b=a7kXDuWP/vFZfzcYidh7K2WsBH1lziL+CE/ebvGt1oUVEwQC7nNRoGNzVhMKsR3Iid
 b11egUsvGy4MlA4pU2b+WMCNewmaIoi617zAbsVNYTVsnVWsZMkr7ELPkdFxNdMvIXwx
 h9ZN6YuKjagr5QvuOng17JyLspFJ2nPSDaOhChqrnRGe3/BysiFT9RfUyerPPFqgFuae
 r6jjocdq8Xq8duwzbjBDfvVG2i7miZOh/nGyjZXqUyCLZyy5jDAciyUKW5ztuxD/wyn2
 rGGn7LMrrZ2GoroQ9WkgvUByv6Dybid9ut9vWatNyQFz/V9fOV0c+gpz7rjq+ZigrHY7
 Lo+A==
X-Gm-Message-State: AOJu0YzJhWOhBYs3KZukwe1dE08mrnm4GeZNSdfpG/HQC3SfM8oJrB1C
 Hsg+bS86g/+TxZzBPHHXmT9p228PoY90Xmci1KLIu7UeS4PjcwrgZ5iiYebf366FvImO1xIcKe4
 uhtk=
X-Google-Smtp-Source: AGHT+IGWrOz2M6T1JC5eeHOSwRTeED/n+j5Q6VnfEkPxOCkJBrGrit6lxdRx/C+UcxmWRCSncXqLmg==
X-Received: by 2002:a17:907:7da7:b0:a8d:439d:5c3c with SMTP id
 a640c23a62f3a-a93c48efd0fmr32067866b.8.1727372381232; 
 Thu, 26 Sep 2024 10:39:41 -0700 (PDT)
Received: from thinkpad ([2a02:2454:a0a9:e300:a64e:31ff:fe38:fd6c])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-a93c2947e49sm21077466b.135.2024.09.26.10.39.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 26 Sep 2024 10:39:40 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: Apoorv Singh <apoorvs569@HIDDEN>
Subject: Re: [bug#73465] [PATCH] Wireguard: Rename field private-key to
 private-key-file
Date: Thu, 26 Sep 2024 19:39:38 +0200
Message-ID: <87msju1fhh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73465
Cc: 73465 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Apoorv Singh <apoorvs569@HIDDEN> writes:

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

Hi, you have to deprecate the field instead using
`warn-about-deprecation` procedure and to adjust the documentation as
well.

Please note that there is also preshared-key parameter which also takes
a path. It'd be nice to rename it as well for consistency sake.




Information forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Sep 2024 05:46:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 25 01:46:43 2024
Received: from localhost ([127.0.0.1]:42774 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1stKrJ-00045w-Gy
	for submit <at> debbugs.gnu.org; Wed, 25 Sep 2024 01:46:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:45292)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <apoorvs569@HIDDEN>) id 1stJDV-0005Iv-KQ
 for submit <at> debbugs.gnu.org; Wed, 25 Sep 2024 00:01:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <apoorvs569@HIDDEN>)
 id 1stJAz-0004Di-Iz
 for guix-patches@HIDDEN; Tue, 24 Sep 2024 23:58:53 -0400
Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <apoorvs569@HIDDEN>)
 id 1stJAx-0001H1-Qo
 for guix-patches@HIDDEN; Tue, 24 Sep 2024 23:58:53 -0400
Received: by mail-pl1-x630.google.com with SMTP id
 d9443c01a7336-20536dcc6e9so40442355ad.2
 for <guix-patches@HIDDEN>; Tue, 24 Sep 2024 20:58:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727236729; x=1727841529; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=7MuADeabopPi73kiQflAtpMIj5+sChshPoX+nlM5UBw=;
 b=cAsjABAHcp6T3dcagvsjVMDQD57Zouxq2iH0zUdCCdRqZ2qcLqzoUXYuYy726ur0v5
 y9vG9+K443SieVraSd59cgBf7oNhpCLil8T0UsmwK7h7bY8XF5K7Of1TrbJiYGcOyvP7
 bwl+fkWGOTTZRgUb9yr8ULbcfFqa5D365ysg99O/Q8kWAClRYWdn5U+cb7l/APVARgXl
 0DBH2CPJUWHJwSlPyLDUs92r4F//5IFezZXa4l9G1So+v250O8x7Ip5OJyMY6T2OwjqD
 9WtCQeFYct/HLZB6Xfw2zeTBl0iC2OePpJLM2OMFaOfd7B2QD/lMbMKgPCVQbCmaLzAY
 HhqA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727236729; x=1727841529;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=7MuADeabopPi73kiQflAtpMIj5+sChshPoX+nlM5UBw=;
 b=i2GATt7Za4mywdanGbFj8qFEwszAA8/Q32zyanpKXMq2Rpslpdj4/Isiv39Mmpbub3
 iUbkF8UR6ScPgp9g0F1kGZHmfWdX9Q0MDR2c+H1RXwVcCDgNBa9G9u+JRENwVf9yJVW5
 eKv6QB+rpYZCd4VvCMyre+H+ytnKnd22LfWppwPfyYEgRdcCWt5G1NejlAbD91bsos8F
 yNFLIlJkktaD5NAqmYgMXdLCYv+FHVrh1fzzfYrBGh+dKSfXeqZQSaTnMuikiUHhQ/Hk
 mrmW8Z7rOQX0lcaHxGXMTb1qjkzGOB547He8S4h5YXsh/w8N6vX+3it5NcWzgPupH4ir
 oIdw==
X-Gm-Message-State: AOJu0YyLQWJCJuoUU4ArOd9jQdF21hjZtXyVXP/6TWqEyfpLzFkbq8nQ
 eGZWBkg4oau+rK+k/nlup+AQH07Y6se3Gmy78W32DzwHdnKwUWuVRX3w
X-Google-Smtp-Source: AGHT+IFidM/1EKp1jH+3vG9Ojl9xvtRXXu3S5C2CM3Sjak0KnWUsVla4iKLsYgd7/3GhLEVzzMtZeA==
X-Received: by 2002:a17:902:e80d:b0:207:1825:c65e with SMTP id
 d9443c01a7336-20afc43d03emr21474355ad.18.1727236729222; 
 Tue, 24 Sep 2024 20:58:49 -0700 (PDT)
Received: from MachineY ([139.5.251.229]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20af16e024fsm16518925ad.58.2024.09.24.20.58.47
 for <guix-patches@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 24 Sep 2024 20:58:48 -0700 (PDT)
From: Apoorv Singh <apoorvs569@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] Wireguard: Rename field private-key to private-key-file
Date: Wed, 25 Sep 2024 09:28:44 +0530
Message-ID: <87h6a4jsej.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::630;
 envelope-from=apoorvs569@HIDDEN; helo=mail-pl1-x630.google.com
X-Spam_score_int: 15
X-Spam_score: 1.5
X-Spam_bar: +
X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25,
 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.5 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: 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 From 92e6d353a72e9ed0ee7097f2e5e5ff76521455a7 [...] 
 Content analysis details:   (2.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [139.5.251.229 listed in zen.spamhaus.org]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (apoorvs569[at]gmail.com)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (apoorvs569[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
 medium trust [209.51.188.17 listed in list.dnswl.org]
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 25 Sep 2024 01:46:40 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  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 From 92e6d353a72e9ed0ee7097f2e5e5ff76521455a7 [...] 
 
 Content analysis details:   (1.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [139.5.251.229 listed in zen.spamhaus.org]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
                             in digit (apoorvs569[at]gmail.com)
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (apoorvs569[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
                             medium trust
                             [209.51.188.17 listed in list.dnswl.org]
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

--=-=-=
Content-Type: text/plain

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
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Wireguard-rename-field-private-key-to-private-key-fi.patch
Content-Description: Wireguard rename field private-key to private-key-file

From 92e6d353a72e9ed0ee7097f2e5e5ff76521455a7 Mon Sep 17 00:00:00 2001
From: apoorv569 <apoorvs569@HIDDEN>
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


--=-=-=
Content-Type: text/plain; format=flowed

.

-- 
- Apoorv Singh
- Sent from Emacs.

--=-=-=--




Acknowledgement sent to Apoorv Singh <apoorvs569@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#73465; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.