• R/O
  • HTTP
  • SSH
  • HTTPS

packages: Commit

Community maintained packages for ImmortalWrt.


Commit MetaInfo

Révision9a836f4307255a66072fa1d390dfbde90d221578 (tree)
l'heure2022-01-20 23:12:22
AuteurNick Hainke <vincent@syst...>
CommiterNick Hainke

Message de Log

wg-installer: create wireguard key if it does not exist

Check if the key exists which is given by

option wg_key '/etc/wgserver/wg.key'

Signed-off-by: Nick Hainke <vincent@systemli.org>
(cherry picked from commit 324fa79d7c8a90e899a81bbb3ae0c5a5a602f88e)

Change Summary

Modification

--- a/net/wg-installer/Makefile
+++ b/net/wg-installer/Makefile
@@ -22,7 +22,7 @@ define Package/wg-installer-server
2222 $(call Package/wg-installer/Default)
2323 TITLE+= (server)
2424 MENU:=1
25- DEPENDS+=+rpcd +uhttpd +uhttpd-mod-ubus
25+ DEPENDS+=+rpcd +uhttpd +uhttpd-mod-ubus +coreutils-dirname
2626 endef
2727
2828 define Package/wg-installer-server/install
@@ -53,7 +53,7 @@ endef
5353
5454 define Package/wg-installer-server-hotplug-babeld
5555 $(call Package/wg-installer-server)
56- DEPENDS:=wg-installer-server +coreutils-dirname +coreutils-realpath
56+ DEPENDS:=wg-installer-server +coreutils-realpath
5757 endef
5858
5959 define Package/wg-installer-server-hotplug-babeld/install
@@ -63,7 +63,7 @@ endef
6363
6464 define Package/wg-installer-server-hotplug-olsrd
6565 $(call Package/wg-installer-server)
66- DEPENDS:=wg-installer-server +coreutils-dirname +coreutils-realpath
66+ DEPENDS:=wg-installer-server +coreutils-realpath
6767 endef
6868
6969 define Package/wg-installer-server-hotplug-olsrd/install
--- a/net/wg-installer/wg-server/lib/wg_functions.sh
+++ b/net/wg-installer/wg-server/lib/wg_functions.sh
@@ -75,6 +75,9 @@ wg_register () {
7575 gw_key="/tmp/run/wgserver/${ifname}.key"
7676 gw_pub="/tmp/run/wgserver/${ifname}.pub"
7777 wg genkey | tee "$gw_key" | wg pubkey > "$gw_pub"
78+ else
79+ [ -d "$(dirname $gw_key)" ] || mkdir -p "$(dirname $gw_key)"
80+ [ -f "$gw_key" ] || wg genkey | tee "$gw_key" | wg pubkey > "$gw_pub"
7881 fi
7982 wg_server_pubkey=$(cat "$gw_pub")
8083
Afficher sur ancien navigateur de dépôt.