From 08032f165f77d3a1b2f4517de9f8c1bd9d290916 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 19 May 2024 18:06:50 -0400 Subject: [PATCH 1/4] Update add-tailscale-lxc.sh Code refactoring --- misc/add-tailscale-lxc.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/misc/add-tailscale-lxc.sh b/misc/add-tailscale-lxc.sh index e5bcfaec5..133073333 100644 --- a/misc/add-tailscale-lxc.sh +++ b/misc/add-tailscale-lxc.sh @@ -59,8 +59,14 @@ lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file EOF header_info msg "Installing Tailscale..." -lxc-attach -n $CTID -- bash -c "$(curl -fsSL https://tailscale.com/install.sh)" &>/dev/null || exit -msg "Installed Tailscale" -sleep 2 -msg "\e[1;32m ✔ Completed Successfully!\e[0m" +pct exec "$CTID" -- bash -c ' +ID=$(grep "^ID=" /etc/os-release | cut -d"=" -f2) +VER=$(grep "^VERSION_CODENAME=" /etc/os-release | cut -d"=" -f2) +wget -qO- https://pkgs.tailscale.com/stable/$ID/$VER.noarmor.gpg >/usr/share/keyrings/tailscale-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/$ID $VER main" >/etc/apt/sources.list.d/tailscale.list +apt-get update &>/dev/null +apt-get install -y tailscale &>/dev/null +' || exit +msg "\e[1;32m ✔ Installed Tailscale\e[0m" + msg "\e[1;31m Reboot ${CTID} LXC to apply the changes, then run tailscale up in the LXC console\e[0m" From 8c09fafa6e2d206c9373325ba08a12633e88f8b6 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 19 May 2024 18:08:25 -0400 Subject: [PATCH 2/4] Create add-netbird-lxc.sh --- misc/add-netbird-lxc.sh | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 misc/add-netbird-lxc.sh diff --git a/misc/add-netbird-lxc.sh b/misc/add-netbird-lxc.sh new file mode 100644 index 000000000..054271060 --- /dev/null +++ b/misc/add-netbird-lxc.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ ____ _ __ + / | / /__ / /_/ __ )(_)________/ / + / |/ / _ \/ __/ __ / / ___/ __ / + / /| / __/ /_/ /_/ / / / / /_/ / +/_/ |_/\___/\__/_____/_/_/ \__,_/ + +EOF +} +header_info +set -e +while true; do + read -p "This will add NetBird to an existing LXC Container ONLY. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info +echo "Loading..." +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} + +NODE=$(hostname) +MSG_MAX_LENGTH=0 +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') + +while [ -z "${CTID:+x}" ]; do + CTID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --radiolist \ + "\nSelect a container to add NetBird to:\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done + +CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf +cat <>$CTID_CONFIG_PATH +lxc.cgroup2.devices.allow: c 10:200 rwm +lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file +EOF +header_info +msg "Installing NetBird..." +pct exec "$CTID" -- bash -c ' +apt install -y ca-certificates gpg &>/dev/null +wget -qO- https://pkgs.netbird.io/debian/public.key | gpg --dearmor >/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" >/etc/apt/sources.list.d/netbird.list +apt-get update &>/dev/null +apt-get install -y netbird-ui &>/dev/null +' || exit +msg "\e[1;32m ✔ Installed NetBird.\e[0m" +sleep 2 +msg "\e[1;31m Reboot ${CTID} LXC to apply the changes, then run netbird up in the LXC console\e[0m" From b503418cdb62c7cbadf9a04235de061f9dfd9abc Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 19 May 2024 18:21:43 -0400 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf93a3970..9c41a84e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,15 @@ - All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment. - 🚨 **The scripts in the repository will no longer provide support for Proxmox VE 7 starting from July 2024 (scripts will not execute on PVE7). Subsequent Proxmox VE - Support Lifecycle** +## 2024-05-19 + +### Changed + +- **Netbird** + - NEW Script +- **Tailscale** + - Refactor Code + ## 2024-05-18 ### Changed From 2a8a65e7544e8a9cbfacaf5246d4f643e798b8db Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 19 May 2024 20:30:22 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c41a84e0..37a99022f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ ### Changed -- **Netbird** +- **NetBird** - NEW Script - **Tailscale** - Refactor Code