From f2ae2b08573c959fb41fd1480aa226acc6d007d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=8C?= Date: Wed, 18 Mar 2026 21:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20setup-relay.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup-relay.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/setup-relay.sh b/setup-relay.sh index 1ffae0e..119addf 100644 --- a/setup-relay.sh +++ b/setup-relay.sh @@ -144,8 +144,25 @@ fi if [[ -n "$_PREREAD_SECRET" ]]; then info "Found existing secret in /opt/netbird-relay/relay.env" - ask AUTH_SECRET "Keep existing secret or enter a new one" "$_PREREAD_SECRET" - success "Using secret." + echo " 1) Keep existing secret" + echo " 2) Generate a new random secret" + echo " 3) Enter a different secret manually" + ask _SECRET_CHOICE " Choose [1/2/3]" "1" + case "$_SECRET_CHOICE" in + 2) + AUTH_SECRET="$(generate_secret)" + success "Generated new secret: ${BOLD}${AUTH_SECRET}${RESET}" + warn "Update NB_AUTH_SECRET on ALL relay servers and your main server config." + ;; + 3) + ask AUTH_SECRET "Paste your shared secret" "" + success "Using supplied secret." + ;; + *) + AUTH_SECRET="$_PREREAD_SECRET" + success "Keeping existing secret." + ;; + esac elif ask_yn "Generate a new random secret automatically?" "y"; then AUTH_SECRET="$(generate_secret)" success "Generated secret: ${BOLD}${AUTH_SECRET}${RESET}"