Compare commits

..

10 Commits
v2.3 ... v2.3.1

Author SHA1 Message Date
Donald Cheng Hong Zou
ed13babf6a Merge branch 'main' of https://github.com/donaldzou/Wireguard-Dashboard into main 2021-09-08 22:01:01 -04:00
Donald Cheng Hong Zou
80db82eb93 Update dashboard.py 2021-09-08 22:00:53 -04:00
Donald Zou
8d20334d6e Update README.md 2021-09-08 21:59:15 -04:00
Donald Zou
03a95ad018 Merge pull request #79 from donaldzou/v2.3.1
Update README.md
2021-09-08 21:58:02 -04:00
Donald Cheng Hong Zou
aa59cc8af0 Update README.md 2021-09-08 21:57:50 -04:00
Donald Zou
80d63c2c89 Merge pull request #78 from donaldzou/v2.3.1
Changed dashboard naming to WGDashboard
2021-09-08 21:56:48 -04:00
Donald Cheng Hong Zou
03a4acd72b Changed dashboard naming to WGDashboard 2021-09-08 21:56:31 -04:00
Donald Cheng Hong Zou
53118cf660 Merge branch 'main' of https://github.com/donaldzou/Wireguard-Dashboard into main 2021-09-08 16:58:40 -04:00
Donald Cheng Hong Zou
16b1baf81e Update README.md 2021-09-08 16:58:36 -04:00
Donald Zou
960e0d0965 Update README.md 2021-09-08 14:50:26 -04:00
6 changed files with 40 additions and 42 deletions

View File

@@ -4,9 +4,10 @@
<p align="center"> <p align="center">
<img alt="Wireguard Dashboard Logo" src="img/logo.png" width="128"> <img alt="WGDashboard" src="img/logo.png" width="128">
</p> </p>
<h1 align="center">Wireguard Dashboard</h1> <h1 align="center">WGDashboard</h1>
<p align="center"><small>Note: This project is not affiliate to the official WireGuard Project ;)</small></p>
<p align="center"> <p align="center">
<img src="http://ForTheBadge.com/images/badges/made-with-python.svg"> <img src="http://ForTheBadge.com/images/badges/made-with-python.svg">
@@ -16,11 +17,10 @@
</p> </p>
<p align="center">Monitoring WireGuard is not convinient, need to login into server and type <code>wg show</code>. That's why this platform is being created, to view all configurations and manage them in a easier way.</p> <p align="center">Monitoring WireGuard is not convinient, need to login into server and type <code>wg show</code>. That's why this platform is being created, to view all configurations and manage them in a easier way.</p>
## 📣 What's New: v2.3 ## 📣 What's New: v2.3
- 🎉 **New Features** - 🎉 **New Features**
- **Update directly from `wgd.sh`:** Now you can update Wireguard Dashboard directly from the bash script. - **Update directly from `wgd.sh`:** Now you can update WGDashboard directly from the bash script.
- **Displaying Peers:** You can switch the display mode between list and table in the configuration page. - **Displaying Peers:** You can switch the display mode between list and table in the configuration page.
- 🪚 **Bug Fixed** - 🪚 **Bug Fixed**
- [Peer DNS Validation Fails #67](https://github.com/donaldzou/wireguard-dashboard/issues/67): Added DNS format check. [❤️ @realfian] - [Peer DNS Validation Fails #67](https://github.com/donaldzou/wireguard-dashboard/issues/67): Added DNS format check. [❤️ @realfian]
@@ -42,8 +42,8 @@
- [📝 Requirement](#-requirement) - [📝 Requirement](#-requirement)
- [🛠 Install](#-install) - [🛠 Install](#-install)
- [🪜 Usage](#-usage) - [🪜 Usage](#-usage)
- [Start/Stop/Restart Wireguard Dashboard](#startstoprestart-wireguard-dashboard) - [Start/Stop/Restart WGDashboard](#startstoprestart-wireguard-dashboard)
- [Autostart Wireguard Dashboard on boot](#autostart-wireguard-dashboard-on-boot) - [Autostart WGDashboard on boot](#autostart-wireguard-dashboard-on-boot)
- [✂️ Dashboard Configuration](#%EF%B8%8F-dashboard-configuration) - [✂️ Dashboard Configuration](#%EF%B8%8F-dashboard-configuration)
- [Dashboard Configuration file](#dashboard-configuration-file) - [Dashboard Configuration file](#dashboard-configuration-file)
- [Generating QR code and peer configuration file (.conf)](#generating-qr-code-and-peer-configuration-file-conf) - [Generating QR code and peer configuration file (.conf)](#generating-qr-code-and-peer-configuration-file-conf)
@@ -74,7 +74,7 @@
> **If you have tested on other OS and it works perfectly please provide it to me in [#31](https://github.com/donaldzou/wireguard-dashboard/issues/31). Thank you!** > **If you have tested on other OS and it works perfectly please provide it to me in [#31](https://github.com/donaldzou/wireguard-dashboard/issues/31). Thank you!**
- **WireGuard** and **Wireguard-Tools (`wg-quick`)** are installed. - **WireGuard** and **WireGuard-Tools (`wg-quick`)** are installed.
> Don't know how? Check this <a href="https://www.wireguard.com/install/">official documentation</a> > Don't know how? Check this <a href="https://www.wireguard.com/install/">official documentation</a>
@@ -97,18 +97,18 @@
- Python 3.7+ & Pip3 - Python 3.7+ & Pip3
## 🛠 Install ## 🛠 Install
1. **Download Wireguard Dashboard** 1. Download WGDashboard
```shell ```shell
git clone -b v2.2.1 https://github.com/donaldzou/wireguard-dashboard.git git clone -b v2.3.1 https://github.com/donaldzou/wireguard-dashboard.git
2. Open the Wireguard Dashboard folder 2. Open the WGDashboard folder
```shell ```shell
cd wireguard-dashboard/src cd wireguard-dashboard/src
``` ```
3. Install Wireguard Dashboard 3. Install WGDashboard
```shell ```shell
sudo chmod u+x wgd.sh sudo chmod u+x wgd.sh
@@ -121,7 +121,7 @@
sudo chmod -R 755 /etc/wireguard sudo chmod -R 755 /etc/wireguard
``` ```
5. Run Wireguard Dashboard 5. Run WGDashboard
```shell ```shell
./wgd.sh start ./wgd.sh start
@@ -137,7 +137,7 @@
## 🪜 Usage ## 🪜 Usage
#### Start/Stop/Restart Wireguard Dashboard #### Start/Stop/Restart WGDashboard
```shell ```shell
@@ -152,7 +152,7 @@ cd Wireguard-Dashboard/src
./wgd.sh restart # Restart the dasboard ./wgd.sh restart # Restart the dasboard
``` ```
#### Autostart Wireguard Dashboard on boot (>= v2.2) #### Autostart WGDashboard on boot (>= v2.2)
In the `src` folder, it contained a file called `wg-dashboard.service`, we can use this file to let our system to autostart the dashboard after reboot. The following guide has tested on **Ubuntu**, most **Debian** based OS might be the same, but some might not. Please don't hesitate to provide your system if you have tested the autostart on another system. In the `src` folder, it contained a file called `wg-dashboard.service`, we can use this file to let our system to autostart the dashboard after reboot. The following guide has tested on **Ubuntu**, most **Debian** based OS might be the same, but some might not. Please don't hesitate to provide your system if you have tested the autostart on another system.
@@ -247,7 +247,7 @@ In the `src` folder, it contained a file called `wg-dashboard.service`, we can u
└─6602 /usr/bin/python3 /root/wireguard-dashboard/src/dashboard.py └─6602 /usr/bin/python3 /root/wireguard-dashboard/src/dashboard.py
Aug 03 22:31:26 ubuntu-wg systemd[1]: Started wg-dashboard.service. Aug 03 22:31:26 ubuntu-wg systemd[1]: Started wg-dashboard.service.
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Serving Flask app "Wireguard Dashboard" (lazy loading) Aug 03 22:31:27 ubuntu-wg python3[6602]: * Serving Flask app "WGDashboard" (lazy loading)
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Environment: production Aug 03 22:31:27 ubuntu-wg python3[6602]: * Environment: production
Aug 03 22:31:27 ubuntu-wg python3[6602]: WARNING: This is a development server. Do not use it in a production deployment. Aug 03 22:31:27 ubuntu-wg python3[6602]: WARNING: This is a development server. Do not use it in a production deployment.
Aug 03 22:31:27 ubuntu-wg python3[6602]: Use a production WSGI server instead. Aug 03 22:31:27 ubuntu-wg python3[6602]: Use a production WSGI server instead.
@@ -273,7 +273,7 @@ In the `src` folder, it contained a file called `wg-dashboard.service`, we can u
#### Dashboard Configuration file #### Dashboard Configuration file
Since version 2.0, Wireguard Dashboard will be using a configuration file called `wg-dashboard.ini`, (It will generate automatically after first time running the dashboard). More options will include in future versions, and for now it included the following config: Since version 2.0, WGDashboard will be using a configuration file called `wg-dashboard.ini`, (It will generate automatically after first time running the dashboard). More options will include in future versions, and for now it included the following config:
| | Description | Default | Available in Setting | | | Description | Default | Available in Setting |
| --------------- | ------------------------------------------------------------ | ------------------------ | -------------------- | | --------------- | ------------------------------------------------------------ | ------------------------ | -------------------- |
@@ -288,8 +288,6 @@ Since version 2.0, Wireguard Dashboard will be using a configuration file called
| | If `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **User can only edit the file directly in system**. | | | | | If `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **User can only edit the file directly in system**. | | |
| `version` | Dashboard Version | `v2.2` | No | | `version` | Dashboard Version | `v2.2` | No |
<p align=center>Latest Version: v2.2</p>
**Except `auth_req` due to security consideration.** **Except `auth_req` due to security consideration.**
#### Generating QR code and peer configuration file (.conf) #### Generating QR code and peer configuration file (.conf)
@@ -441,7 +439,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://github.com/antonioag95"><img src="https://avatars.githubusercontent.com/u/30556866?v=4?s=100" width="100px;" alt=""/><br /><sub><b>antonioag95</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=antonioag95" title="Tests">⚠️</a> <a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=antonioag95" title="Code">💻</a></td> <td align="center"><a href="https://github.com/antonioag95"><img src="https://avatars.githubusercontent.com/u/30556866?v=4?s=100" width="100px;" alt=""/><br /><sub><b>antonioag95</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=antonioag95" title="Tests">⚠️</a> <a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=antonioag95" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/tonjo"><img src="https://avatars.githubusercontent.com/u/4726289?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tonjo</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=tonjo" title="Code">💻</a></td> <td align="center"><a href="https://github.com/tonjo"><img src="https://avatars.githubusercontent.com/u/4726289?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tonjo</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=tonjo" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/reafian"><img src="https://avatars.githubusercontent.com/u/11992416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Newton</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=reafian" title="Code">💻</a></td> <td align="center"><a href="https://github.com/reafian"><img src="https://avatars.githubusercontent.com/u/11992416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Newton</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=reafian" title="Code">💻</a></td>
<td align="center"><a href="http://www.davejlong.com"><img src="https://avatars.githubusercontent.com/u/175317?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Long</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=davejlong" title="Code">💻</a></td> <td align="center"><a href="https://github.com/davejlong"><img src="https://avatars.githubusercontent.com/u/175317?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Long</b></sub></a><br /><a href="https://github.com/donaldzou/wireguard-dashboard/commits?author=davejlong" title="Code">💻</a></td>
</tr> </tr>
</table> </table>

View File

@@ -1,5 +1,5 @@
""" """
< Wireguard Dashbaord > - by Donald Zou [https://github.com/donaldzou] < WGDashboard > - by Donald Zou [https://github.com/donaldzou]
Under Apache-2.0 License Under Apache-2.0 License
""" """
@@ -22,13 +22,13 @@ from flask_qrcode import QRcode
from tinydb import TinyDB, Query from tinydb import TinyDB, Query
from icmplib import ping, multiping, traceroute, resolve, Host, Hop from icmplib import ping, multiping, traceroute, resolve, Host, Hop
# Dashboard Version # Dashboard Version
dashboard_version = 'v2.3' dashboard_version = 'v2.3.1'
# Dashboard Config Name # Dashboard Config Name
dashboard_conf = 'wg-dashboard.ini' dashboard_conf = 'wg-dashboard.ini'
# Upgrade Required # Upgrade Required
update = "" update = ""
# Flask App Configuration # Flask App Configuration
app = Flask("Wireguard Dashboard") app = Flask("WGDashboard")
app.secret_key = secrets.token_urlsafe(16) app.secret_key = secrets.token_urlsafe(16)
app.config['TEMPLATES_AUTO_RELOAD'] = True app.config['TEMPLATES_AUTO_RELOAD'] = True
# Enable QR Code Generator # Enable QR Code Generator

View File

@@ -1,7 +1,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Wireguard Dashboard | {{ title }}</title> <title>WGDashboard | {{ title }}</title>
<link rel="icon" href="{{ url_for('static',filename='img/logo.png') }}"/> <link rel="icon" href="{{ url_for('static',filename='img/logo.png') }}"/>
<link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css') }}"> <link rel="stylesheet" href="{{ url_for('static',filename='css/bootstrap.min.css') }}">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='css/dashboard.css') }}"> <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='css/dashboard.css') }}">

View File

@@ -1,5 +1,5 @@
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow"> <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" href="/">Wireguard Dashboard</a> <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" href="/">WGDashboard</a>
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-toggle="collapse" <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-toggle="collapse"
data-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation"> data-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>

View File

@@ -2,7 +2,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Wireguard Dashboard | Login</title> <title>WGDashboard | Login</title>
<link rel="icon" href="{{ url_for('static',filename='logo.png') }}"/> <link rel="icon" href="{{ url_for('static',filename='logo.png') }}"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='css/dashboard.css') }}"> <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='css/dashboard.css') }}">

View File

@@ -1,21 +1,21 @@
#!/bin/bash #!/bin/bash
app_name="dashboard.py" app_name="dashboard.py"
app_official_name="Wireguard Dashboard" app_official_name="WGDashboard"
dashes='------------------------------------------------------------' dashes='------------------------------------------------------------'
equals='============================================================' equals='============================================================'
help () { help () {
printf "=================================================================================\n" printf "=================================================================================\n"
printf "+ <Wireguard Dashboard> by Donald Zou - https://github.com/donaldzou +\n" printf "+ <WGDashboard> by Donald Zou - https://github.com/donaldzou +\n"
printf "=================================================================================\n" printf "=================================================================================\n"
printf "| Usage: ./wgd.sh <option> |\n" printf "| Usage: ./wgd.sh <option> |\n"
printf "| |\n" printf "| |\n"
printf "| Available options: |\n" printf "| Available options: |\n"
printf "| start: To start Wireguard Dashboard |\n" printf "| start: To start WGDashboard. |\n"
printf "| stop: To stop Wireguard Dashboard. |\n" printf "| stop: To stop WGDashboard. |\n"
printf "| debug: To start Wireguard Dashboard in debug mode (i.e run in foreground). |\n" printf "| debug: To start WGDashboard in debug mode (i.e run in foreground). |\n"
printf "| update: To update Wireguard Dashboard to the newest version from GitHub. |\n" printf "| update: To update WGDashboard to the newest version from GitHub. |\n"
printf "| install: To install Wireguard Dashboard. |\n" printf "| install: To install WGDashboard. |\n"
printf "| Thank you for using! Your support is my motivation ;) |\n" printf "| Thank you for using! Your support is my motivation ;) |\n"
printf "=================================================================================\n" printf "=================================================================================\n"
} }
@@ -24,7 +24,7 @@ install_wgd(){
# Check Python3 version # Check Python3 version
version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");') version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");')
if [ $version_pass == "0" ] if [ $version_pass == "0" ]
then printf "| Wireguard Dashboard required Python3.7+ |\n" then printf "| WGDashboard required Python3.7+ |\n"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
exit 1 exit 1
fi fi
@@ -34,7 +34,7 @@ install_wgd(){
fi fi
printf "| Installing latest Python dependencies |\n" printf "| Installing latest Python dependencies |\n"
python3 -m pip install -r requirements.txt > /dev/null 2>&1 python3 -m pip install -r requirements.txt > /dev/null 2>&1
printf "| Wireguard Dashboard installed successfully! |\n" printf "| WGDashboard installed successfully! |\n"
printf "| Starting Dashboard |\n" printf "| Starting Dashboard |\n"
start_wgd start_wgd
} }
@@ -51,7 +51,7 @@ check_wgd_status(){
start_wgd () { start_wgd () {
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Starting Wireguard Dashboard in the background. |\n" printf "| Starting WGDashboard in the background. |\n"
if [ ! -d "log" ] if [ ! -d "log" ]
then mkdir "log" then mkdir "log"
fi fi
@@ -67,7 +67,7 @@ stop_wgd() {
start_wgd_debug() { start_wgd_debug() {
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Starting Wireguard Dashboard in the foreground. |\n" printf "| Starting WGDashboard in the foreground. |\n"
python3 "$app_name" python3 "$app_name"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
} }
@@ -78,7 +78,7 @@ update_wgd() {
printf "| Are you sure you want to update to the %s? (Y/N): " "$new_ver" printf "| Are you sure you want to update to the %s? (Y/N): " "$new_ver"
read up read up
if [ "$up" = "Y" ]; then if [ "$up" = "Y" ]; then
printf "| Shutting down Wireguard Dashboard... |\n" printf "| Shutting down WGDashboard... |\n"
kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')" kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')"
printf "| Downloading %s from GitHub... |\n" "$new_ver" printf "| Downloading %s from GitHub... |\n" "$new_ver"
git stash > /dev/null 2>&1 git stash > /dev/null 2>&1
@@ -102,7 +102,7 @@ if [ "$#" != 1 ];
if [ "$1" = "start" ]; then if [ "$1" = "start" ]; then
if check_wgd_status; then if check_wgd_status; then
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Wireguard Dashboard is already running. |\n" printf "| WGDashboard is already running. |\n"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
else else
start_wgd start_wgd
@@ -111,11 +111,11 @@ if [ "$#" != 1 ];
if check_wgd_status; then if check_wgd_status; then
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
stop_wgd stop_wgd
printf "| Wireguard Dashboard is stopped. |\n" printf "| WGDashboard is stopped. |\n"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
else else
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Wireguard Dashboard is not running. |\n" printf "| WGDashboard is not running. |\n"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
fi fi
elif [ "$1" = "update" ]; then elif [ "$1" = "update" ]; then
@@ -126,7 +126,7 @@ if [ "$#" != 1 ];
if check_wgd_status; then if check_wgd_status; then
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
stop_wgd stop_wgd
printf "| Wireguard Dashboard is stopped. |\n" printf "| WGDashboard is stopped. |\n"
sleep 2 sleep 2
start_wgd start_wgd
else else
@@ -134,7 +134,7 @@ if [ "$#" != 1 ];
fi fi
elif [ "$1" = "debug" ]; then elif [ "$1" = "debug" ]; then
if check_wgd_status; then if check_wgd_status; then
printf "| Wireguard Dashboard is already running. |\n" printf "| WGDashboard is already running. |\n"
else else
start_wgd_debug start_wgd_debug
fi fi