Compare commits

..

3 Commits

Author SHA1 Message Date
tteckster 561419f1a2
Update CHANGELOG.md 2024-08-21 16:14:24 -04:00
tteckster 723365a79d
Update wireguard-install.sh
- refactor code
- breaking change
2024-08-21 16:12:01 -04:00
tteckster 9d579083bf
Update wireguard.sh
- refactor code
- breaking change
2024-08-21 16:10:49 -04:00
3 changed files with 50 additions and 84 deletions

View File

@ -12,6 +12,14 @@ 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="2" var_disk="4"
var_cpu="1" var_cpu="1"
var_ram="512" var_ram="512"
var_os="debian" var_os="debian"
var_version="11" var_version="12"
variables variables
color color
catch_errors catch_errors
@ -53,70 +53,9 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -d /etc/pivpn/wireguard ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /etc/wireguard ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ msg_error "Update WireGuard via apt"
"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
@ -124,3 +63,5 @@ 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,29 +17,46 @@ 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 gunicorn $STD apt-get install -y git
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing WireGuard (using pivpn.io)" msg_info "Installing WireGuard"
OPTIONS_PATH='/options.conf' $STD apt-get install -y wireguard wireguard-tools net-tools iptables
cat >$OPTIONS_PATH <<EOF
IPv4dev=eth0
install_user=root
VPN=wireguard
pivpnNET=$(printf "10.%d.%d.0" $((RANDOM % 256)) $((RANDOM % 256)))
subnetClass=24
ALLOWED_IPS="0.0.0.0/0, ::0/0"
pivpnMTU=1420
pivpnPORT=51820
pivpnDNS1=1.1.1.1
pivpnDNS2=8.8.8.8
pivpnHOST=
pivpnPERSISTENTKEEPALIVE=25
UNATTUPG=1
EOF
$STD bash <(curl -fsSL https://install.pivpn.io) --unattended options.conf
msg_ok "Installed WireGuard" msg_ok "Installed WireGuard"
msg_info "Installing WGDashboard"
git clone -q https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard
cd /etc/wgdashboard/src
chmod u+x wgd.sh
$STD ./wgd.sh install
echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
$STD sysctl -p /etc/sysctl.conf
msg_ok "Installed WGDashboard"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/wg-dashboard.service
[Unit]
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
systemctl enable -q --now wg-dashboard.service
msg_ok "Created Service"
motd_ssh motd_ssh
customize customize