Compare commits

..

No commits in common. "561419f1a2465c4def1c175a9eec21038b6d1215" and "de1a4b0914c63849912cb5187117191b8eeba1b0" have entirely different histories.

3 changed files with 84 additions and 50 deletions

View File

@ -12,14 +12,6 @@ Be cautious of copycat or coat-tailing sites that exploit the project's populari
- 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. - 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.
## 2024-08-21
### Changed
- **WireGuard LXC** [(Commit)](https://github.com/tteck/Proxmox/commit/723365a79df7cc0fd29b1af8f7ef200a7e0921b1)
- Refactor Code
- Breaking Change
## 2024-08-19 ## 2024-08-19
### Changed ### Changed

View File

@ -19,11 +19,11 @@ EOF
header_info header_info
echo -e "Loading..." echo -e "Loading..."
APP="Wireguard" APP="Wireguard"
var_disk="4" var_disk="2"
var_cpu="1" var_cpu="1"
var_ram="512" var_ram="512"
var_os="debian" var_os="debian"
var_version="12" var_version="11"
variables variables
color color
catch_errors catch_errors
@ -53,9 +53,70 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -d /etc/wireguard ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /etc/pivpn/wireguard ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_error "Update WireGuard via apt" UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \
"1" "Update ${APP} LXC" ON \
"2" "Install WGDashboard" OFF \
3>&1 1>&2 2>&3)
header_info
if [ "$UPD" == "1" ]; then
msg_info "Updating ${APP} LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
msg_ok "Updated ${APP} LXC"
exit exit
fi
if [ "$UPD" == "2" ]; then
if [[ -f /etc/systemd/system/wg-dashboard.service ]]; then
cd /etc/wgdashboard/src
chmod u+x wgd.sh
./wgd.sh update
msg_ok "Updated Successfully"
exit
fi
IP=$(hostname -I | awk '{print $1}')
msg_info "Installing Python3-pip"
apt-get install -y python3-pip &>/dev/null
pip install flask &>/dev/null
pip install ifcfg &>/dev/null
pip install flask_qrcode &>/dev/null
pip install icmplib &>/dev/null
msg_ok "Installed Python3-pip"
msg_info "Installing WGDashboard"
WGDREL=$(curl -s https://api.github.com/repos/donaldzou/WGDashboard/releases/latest |
grep "tag_name" |
awk '{print substr($2, 2, length($2)-3) }')
git clone -b ${WGDREL} https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard &>/dev/null
cd /etc/wgdashboard/src
chmod u+x wgd.sh
./wgd.sh install &>/dev/null
chmod -R 755 /etc/wireguard
msg_ok "Installed WGDashboard"
msg_info "Creating Service"
service_path="/etc/systemd/system/wg-dashboard.service"
echo "[Unit]
After=systemd-networkd.service
[Service]
WorkingDirectory=/etc/wgdashboard/src
ExecStart=/usr/bin/python3 /etc/wgdashboard/src/dashboard.py
Restart=always
[Install]
WantedBy=default.target" >$service_path
chmod 664 /etc/systemd/system/wg-dashboard.service
systemctl daemon-reload
systemctl enable wg-dashboard.service &>/dev/null
systemctl start wg-dashboard.service &>/dev/null
msg_ok "Created Service"
echo -e "WGDashboard should be reachable by going to the following URL.
${BL}http://${IP}:10086${CL} admin|admin \n"
exit
fi
} }
start start
@ -63,5 +124,3 @@ build_container
description description
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "WGDashboard should be reachable by going to the following URL.
${BL}http://${IP}:10086${CL} admin|admin \n"

View File

@ -17,45 +17,28 @@ msg_info "Installing Dependencies"
$STD apt-get install -y curl $STD apt-get install -y curl
$STD apt-get install -y sudo $STD apt-get install -y sudo
$STD apt-get install -y mc $STD apt-get install -y mc
$STD apt-get install -y git $STD apt-get install -y gunicorn
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing WireGuard" msg_info "Installing WireGuard (using pivpn.io)"
$STD apt-get install -y wireguard wireguard-tools net-tools iptables OPTIONS_PATH='/options.conf'
msg_ok "Installed WireGuard" cat >$OPTIONS_PATH <<EOF
IPv4dev=eth0
msg_info "Installing WGDashboard" install_user=root
git clone -q https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard VPN=wireguard
cd /etc/wgdashboard/src pivpnNET=$(printf "10.%d.%d.0" $((RANDOM % 256)) $((RANDOM % 256)))
chmod u+x wgd.sh subnetClass=24
$STD ./wgd.sh install ALLOWED_IPS="0.0.0.0/0, ::0/0"
echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf pivpnMTU=1420
$STD sysctl -p /etc/sysctl.conf pivpnPORT=51820
msg_ok "Installed WGDashboard" pivpnDNS1=1.1.1.1
pivpnDNS2=8.8.8.8
msg_info "Creating Service" pivpnHOST=
cat <<EOF >/etc/systemd/system/wg-dashboard.service pivpnPERSISTENTKEEPALIVE=25
[Unit] UNATTUPG=1
After=syslog.target network-online.target
Wants=wg-quick.target
ConditionPathIsDirectory=/etc/wireguard
[Service]
Type=forking
PIDFile=/etc/wgdashboard/src/gunicorn.pid
WorkingDirectory=/etc/wgdashboard/src
ExecStart=/etc/wgdashboard/src/wgd.sh start
ExecStop=/etc/wgdashboard/src/wgd.sh stop
ExecReload=/etc/wgdashboard/src/wgd.sh restart
TimeoutSec=120
PrivateTmp=yes
Restart=always
[Install]
WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now wg-dashboard.service $STD bash <(curl -fsSL https://install.pivpn.io) --unattended options.conf
msg_ok "Created Service" msg_ok "Installed WireGuard"
motd_ssh motd_ssh
customize customize