diff --git a/ct/wireguard.sh b/ct/wireguard.sh index 056c1453d..9da383c75 100644 --- a/ct/wireguard.sh +++ b/ct/wireguard.sh @@ -30,10 +30,12 @@ function update_script() { fi apt-get update apt-get -y upgrade - sleep 2 - cd /etc/wgdashboard/src - ./wgd.sh update - ./wgd.sh start + if [[ ! -d /etc/wgdashboard ]]; then + sleep 2 + cd /etc/wgdashboard/src + ./wgd.sh update + ./wgd.sh start + fi exit } @@ -43,5 +45,5 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" -echo -e "${INFO}${YW} WGDashboard Access it using the following URL:${CL}" +echo -e "${INFO}${YW}Access WGDashboard (if installed) using the following URL:${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:10086${CL}" diff --git a/frontend/public/json/wireguard.json b/frontend/public/json/wireguard.json index 838087e4e..f122cbf4d 100644 --- a/frontend/public/json/wireguard.json +++ b/frontend/public/json/wireguard.json @@ -46,6 +46,10 @@ { "text": "Wireguard and WGDashboard are not the same. More info: `https://docs.wgdashboard.dev/what-is-wireguard-what-is-wgdashboard.html`", "type": "info" + }, + { + "text": "WGDashboard installation is optional.`", + "type": "info" } ] } diff --git a/install/wireguard-install.sh b/install/wireguard-install.sh index 47cc24f0f..32bd34371 100644 --- a/install/wireguard-install.sh +++ b/install/wireguard-install.sh @@ -13,28 +13,27 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y git -msg_ok "Installed Dependencies" - msg_info "Installing WireGuard" $STD apt-get install -y wireguard wireguard-tools net-tools iptables DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" install -y iptables-persistent &>/dev/null $STD netfilter-persistent reload 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" +read -r -p "${TAB3}Would you like to add WGDashboard? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + fetch_and_deploy_gh_release "wgdashboard" "donaldzou/WGDashboard" "tarball" "latest" "/etc/wgdashboard" -msg_info "Create Example Config for WGDashboard" -private_key=$(wg genkey) -cat </etc/wireguard/wg0.conf + msg_info "Installing 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 "Create Example Config for WGDashboard" + private_key=$(wg genkey) + cat </etc/wireguard/wg0.conf [Interface] PrivateKey = ${private_key} Address = 10.0.0.1/24 @@ -43,10 +42,10 @@ PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACC PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ListenPort = 51820 EOF -msg_ok "Created Example Config for WGDashboard" + msg_ok "Created Example Config for WGDashboard" -msg_info "Creating Service" -cat </etc/systemd/system/wg-dashboard.service + msg_info "Creating Service" + cat </etc/systemd/system/wg-dashboard.service [Unit] After=syslog.target network-online.target Wants=wg-quick.target @@ -66,8 +65,9 @@ Restart=always [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now wg-dashboard -msg_ok "Created Service" + systemctl enable -q --now wg-dashboard + msg_ok "Created Service" +fi motd_ssh customize