GNU bug report logs -
#52689
[PATCH] services: wireguard: Add DNS config field.
Previous Next
Reported by: Nathan Dehnel <ncdehnel <at> gmail.com>
Date: Mon, 20 Dec 2021 23:53:02 UTC
Severity: normal
Tags: patch
Done: Mathieu Othacehe <othacehe <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52689 in the body.
You can then email your comments to 52689 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#52689
; Package
guix-patches
.
(Mon, 20 Dec 2021 23:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nathan Dehnel <ncdehnel <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 20 Dec 2021 23:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Nathan Dehnel <5498361+Gooberpatrol66 <at> users.noreply.github.com>
* gnu/services/vpn.scm (wireguard-configuration): Add dns field
* doc/guix.texi: Document dns field
---
doc/guix.texi | 3 +++
gnu/services/vpn.scm | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index aca88cdada..8e9cd8df18 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -28601,6 +28601,9 @@ The IP addresses to be assigned to the above interface.
@item @code{port} (default: @code{51820})
The port on which to listen for incoming connections.
+@item @code{dns} (default: @code{#f})
+The DNS server(s) to announce to VPN clients via DHCP.
+
@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.
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index 6004e41d8d..1a8f2c8d6a 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -67,6 +67,7 @@ (define-module (gnu services vpn)
wireguard-configuration-interface
wireguard-configuration-addresses
wireguard-configuration-port
+ wireguard-configuration-dns
wireguard-configuration-private-key
wireguard-configuration-peers
@@ -715,7 +716,9 @@ (define-record-type* <wireguard-configuration>
(private-key wireguard-configuration-private-key ;string
(default "/etc/wireguard/private.key"))
(peers wireguard-configuration-peers ;list of <wiregard-peer>
- (default '())))
+ (default '()))
+ (dns wireguard-configuration-dns ;string
+ (default #f)))
(define (wireguard-configuration-file config)
(define (peer->config peer)
@@ -739,7 +742,7 @@ (define (peer->config peer)
"\n"))))
(match-record config <wireguard-configuration>
- (wireguard interface addresses port private-key peers)
+ (wireguard interface addresses port private-key peers dns)
(let* ((config-file (string-append interface ".conf"))
(peers (map peer->config peers))
(config
@@ -755,6 +758,7 @@ (define (peer->config peer)
Address = ~a
PostUp = ~a set %i private-key ~a
~a
+~a
~{~a~^~%~}"
#$(string-join addresses ",")
#$(file-append wireguard "/bin/wg")
@@ -762,6 +766,9 @@ (define (peer->config peer)
#$(if port
(format #f "ListenPort = ~a" port)
"")
+ #$(if dns
+ (format #f "DNS = ~a" (string-join dns ","))
+ "")
(list #$@peers)))))))))
(file-append config "/" config-file))))
--
2.33.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#52689
; Package
guix-patches
.
(Tue, 21 Dec 2021 20:19:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52689 <at> debbugs.gnu.org (full text, mbox):
* gnu/services/vpn.scm (wireguard-configuration): Add dns field
* doc/guix.texi: Document dns field
---
Redid the patch to change the comment from string to list of strings
doc/guix.texi | 3 +++
gnu/services/vpn.scm | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index aca88cdada..8e9cd8df18 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -28601,6 +28601,9 @@ The IP addresses to be assigned to the above interface.
@item @code{port} (default: @code{51820})
The port on which to listen for incoming connections.
+@item @code{dns} (default: @code{#f})
+The DNS server(s) to announce to VPN clients via DHCP.
+
@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.
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index 6004e41d8d..4ea9bcc12e 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -67,6 +67,7 @@ (define-module (gnu services vpn)
wireguard-configuration-interface
wireguard-configuration-addresses
wireguard-configuration-port
+ wireguard-configuration-dns
wireguard-configuration-private-key
wireguard-configuration-peers
@@ -715,7 +716,9 @@ (define-record-type* <wireguard-configuration>
(private-key wireguard-configuration-private-key ;string
(default "/etc/wireguard/private.key"))
(peers wireguard-configuration-peers ;list of <wiregard-peer>
- (default '())))
+ (default '()))
+ (dns wireguard-configuration-dns ;list of strings
+ (default #f)))
(define (wireguard-configuration-file config)
(define (peer->config peer)
@@ -739,7 +742,7 @@ (define (peer->config peer)
"\n"))))
(match-record config <wireguard-configuration>
- (wireguard interface addresses port private-key peers)
+ (wireguard interface addresses port private-key peers dns)
(let* ((config-file (string-append interface ".conf"))
(peers (map peer->config peers))
(config
@@ -755,6 +758,7 @@ (define (peer->config peer)
Address = ~a
PostUp = ~a set %i private-key ~a
~a
+~a
~{~a~^~%~}"
#$(string-join addresses ",")
#$(file-append wireguard "/bin/wg")
@@ -762,6 +766,9 @@ (define (peer->config peer)
#$(if port
(format #f "ListenPort = ~a" port)
"")
+ #$(if dns
+ (format #f "DNS = ~a" (string-join dns ","))
+ "")
(list #$@peers)))))))))
(file-append config "/" config-file))))
--
2.33.1
Reply sent
to
Mathieu Othacehe <othacehe <at> gnu.org>
:
You have taken responsibility.
(Wed, 22 Dec 2021 08:10:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Nathan Dehnel <ncdehnel <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 22 Dec 2021 08:10:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 52689-done <at> debbugs.gnu.org (full text, mbox):
Hello,
I added your copyright and pushed with an edited commit message.
Thanks,
Mathieu
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 19 Jan 2022 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 148 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.