From: Felix Fietkau Date: Sun, 31 Mar 2024 15:56:45 +0000 (+0200) Subject: unet-cli: emit id by default X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=cbbe9d337a17010067b6883fcbad9ed9e994cc36;p=project%2Funetd.git unet-cli: emit id by default Use the public auth key as id. This provides more entropy for the network id Signed-off-by: Felix Fietkau --- diff --git a/scripts/unet-cli b/scripts/unet-cli index 6dbf060..3191e91 100755 --- a/scripts/unet-cli +++ b/scripts/unet-cli @@ -1,8 +1,7 @@ #!/usr/bin/env ucode - 'use strict'; -import { access, basename, dirname, mkstemp, open, writefile } from 'fs'; +import { access, basename, dirname, mkstemp, open, writefile, popen } from 'fs'; function assert(cond, message) { if (!cond) { @@ -355,6 +354,7 @@ if (command == "create") { args[key] ??= `${val}`; if (!access(`${file}.key`)) system(`${unet_tool} -G > ${file}.key`); + net_data.config.id = trim(popen(`unet-tool -P -K ${file}.key`).read("all")); } if (command == "sign") {