Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2026 19:50:34 +0000
From:      Vladimir Druzenko <vvd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Cc:        Thomas <freebsd@tsne.dev>
Subject:   git: 02c29695b529 - main - net/wireguard-tools: Add possibility to configure keys in rc script
Message-ID:  <69727f8a.20d7e.66a9311c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=02c29695b52965146eeb066506bcc824dbcd06ab

commit 02c29695b52965146eeb066506bcc824dbcd06ab
Author:     Thomas <freebsd@tsne.dev>
AuthorDate: 2026-01-22 19:47:42 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2026-01-22 19:47:42 +0000

    net/wireguard-tools: Add possibility to configure keys in rc script
    
    Add possibility to ingest WireGuard keys from files using the rc script.
    It basically adds two more options: "wireguard_<iface>_key" and
    "wireguard_<iface>_psk". Both are optional.
    
    PR:     291997
---
 net/wireguard-tools/files/wireguard_lite.in | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/wireguard-tools/files/wireguard_lite.in b/net/wireguard-tools/files/wireguard_lite.in
index 86ffc41018e4..df7014263534 100644
--- a/net/wireguard-tools/files/wireguard_lite.in
+++ b/net/wireguard-tools/files/wireguard_lite.in
@@ -15,6 +15,8 @@
 # wireguard_<iface>_ips (str):    List of IP Addresses for iface
 # wireguard_<iface>_routes (str): List of Routes for this iface
 # wireguard_<iface>_mtu (str):    MTU for iface (default: "1500")
+# wireguard_<iface>_key (str):    Private key file for this iface
+# wireguard_<iface>_psk (str):    Preshared key file for this iface
 
 . /etc/rc.subr
 
@@ -35,9 +37,17 @@ wireguard_start()
 		eval wireguard_ips="\${wireguard_${interface}_ips}"
 		eval wireguard_routes="\${wireguard_${interface}_routes}"
 		eval wireguard_mtu="\${wireguard_${interface}_mtu}"
+		eval wireguard_key="\${wireguard_${interface}_key}"
+		eval wireguard_psk="\${wireguard_${interface}_psk}"
 
 		ifconfig ${interface} create
 		%%PREFIX%%/bin/wg setconf ${interface} ${wireguard_confdir}/${interface}.conf
+		if [ ! -z "${wireguard_key}" ]; then
+			%%PREFIX%%/bin/wg set ${interface} private-key ${wireguard_key}
+		fi
+		if [ ! -z "${wireguard_psk}" ]; then
+			%%PREFIX%%/bin/wg set ${interface} preshared-key ${wireguard_psk}
+		fi
 
 		for ip in ${wireguard_ips}; do
 			if [ "${ip#*:}" != "${ip}" ]; then


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69727f8a.20d7e.66a9311c>