[openwrt/openwrt] wireguard-tools: avoid temp file for key gen
LEDE Commits
lede-commits at lists.infradead.org
Mon Feb 2 03:25:58 PST 2026
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/97789875d5e23ebf3bd311454846649e8fb215bc
commit 97789875d5e23ebf3bd311454846649e8fb215bc
Author: Paul Donald <newtwen+github at gmail.com>
AuthorDate: Sat Jan 31 15:47:30 2026 +0100
wireguard-tools: avoid temp file for key gen
- no longer write any temporary file for key gen
Signed-off-by: Paul Donald <newtwen+github at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21784
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
package/network/utils/wireguard-tools/files/wireguard.sh | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/package/network/utils/wireguard-tools/files/wireguard.sh b/package/network/utils/wireguard-tools/files/wireguard.sh
index 78a432a8d1..8226c327da 100644
--- a/package/network/utils/wireguard-tools/files/wireguard.sh
+++ b/package/network/utils/wireguard-tools/files/wireguard.sh
@@ -112,16 +112,10 @@ ensure_key_is_generated() {
local private_key
private_key="$(uci get network."$1".private_key)"
- if [ "$private_key" == "generate" ]; then
- local ucitmp
- oldmask="$(umask)"
- umask 077
- ucitmp="$(mktemp -d)"
+ if [ "$private_key" = "generate" ] || [ -z "$private_key" ]; then
private_key="$("${WG}" genkey)"
- uci -q -t "$ucitmp" set network."$1".private_key="$private_key" && \
- uci -q -t "$ucitmp" commit network
- rm -rf "$ucitmp"
- umask "$oldmask"
+ uci -q set network."$1".private_key="$private_key" && \
+ uci -q commit network
fi
}
More information about the lede-commits
mailing list