added netbird module
All checks were successful
Update Dispatches / refresh-news (push) Successful in 3s
All checks were successful
Update Dispatches / refresh-news (push) Successful in 3s
This commit is contained in:
62
modules/netbird-strike
Normal file
62
modules/netbird-strike
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# -----------------------------------------------------------------------
|
||||
# Dynasty Module: NetBird Strike (Single-Pass Manifest)
|
||||
# -----------------------------------------------------------------------
|
||||
BLUE='\033[38;5;45m'; GOLD='\033[38;5;178m'; RED='\033[38;5;196m'; NC='\033[0m'
|
||||
|
||||
# 1. Install Check
|
||||
if ! command -v netbird &> /dev/null; then
|
||||
echo -e "${BLUE}🛡️ Initializing NetBird Repository...${NC}"
|
||||
curl -sSL https://pkgs.netbird.io/debian/public.key | sudo gpg --dearmor --yes --output /usr/share/keyrings/netbird-archive-keyring.gpg
|
||||
echo 'deb [signed-by=/usr/share/keyrings/netbird-archive-keyring.gpg] https://pkgs.netbird.io/debian stable main' | sudo tee /etc/apt/sources.list.d/netbird.list
|
||||
sudo apt-get update && sudo apt-get install netbird -y
|
||||
fi
|
||||
|
||||
# 2. Select Instance Type
|
||||
CHOICE=$(whiptail --title "NetBird Instance Selection" --menu "Choose your destination:" 15 60 2 \
|
||||
"1" "NetBird Managed Cloud (Default)" \
|
||||
"2" "Self-Hosted Instance" 3>&1 1>&2 2>&3)
|
||||
|
||||
if [ $? != 0 ]; then exit 0; fi
|
||||
|
||||
case $CHOICE in
|
||||
1)
|
||||
MGMT_URL=""
|
||||
;;
|
||||
2)
|
||||
if whiptail --title "Self-Hosted Choice" --yesno "Are you using the Dynasty Revolution Netbird instance?" 10 60; then
|
||||
MGMT_URL="https://netbird.dynastyrevolution.com"
|
||||
else
|
||||
MGMT_URL=$(whiptail --title "Custom Configuration" --inputbox "Enter your Management URL:" 10 60 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
|
||||
if [ -z "$MGMT_URL" ]; then echo -e "${RED}Error: URL cannot be empty.${NC}"; exit 1; fi
|
||||
ADMIN_URL="$MGMT_URL"
|
||||
;;
|
||||
esac
|
||||
|
||||
# 3. Get Setup Key
|
||||
SETUP_KEY=$(whiptail --title "Authentication" --inputbox "Enter your NetBird Setup Key:" 10 60 3>&1 1>&2 2>&3)
|
||||
|
||||
if [ -z "$SETUP_KEY" ]; then
|
||||
echo -e "${GOLD}🐉 No key provided. Exiting.${NC}"; exit 0
|
||||
fi
|
||||
|
||||
# 4. The Single-Pass Strike
|
||||
echo -e "${BLUE}🐉 Manifesting Bridge...${NC}"
|
||||
|
||||
if [ -z "$MGMT_URL" ]; then
|
||||
# Standard Cloud connection
|
||||
sudo netbird up --setup-key "$SETUP_KEY"
|
||||
else
|
||||
# Integrated Dynasty/Self-Hosted connection in one command
|
||||
sudo netbird up --management-url "$MGMT_URL" --admin-url "$ADMIN_URL" --setup-key "$SETUP_KEY"
|
||||
fi
|
||||
|
||||
# 5. Final Status Manifest
|
||||
if [ $? -eq 0 ]; then
|
||||
NB_STATUS=$(netbird status)
|
||||
whiptail --title "NetBird Connection Successful" --msgbox "The device is now manifested in the mesh.\n\n$NB_STATUS" 20 70
|
||||
else
|
||||
echo -e "${RED}❌ Strike failed. Verify your Setup Key and URL connectivity.${NC}"
|
||||
fi
|
||||
Reference in New Issue
Block a user