diff --git a/README.md b/README.md index b92cddc..1be589a 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,51 @@ # Wireguard Dashboard -Welcome to contribute or provide suggestions ;) -## Intro Monitoring Wireguard is not convinient, need to login into server and type `wg show`. That's why this platform is being created, to view all configurations in a more straight forward way. -## Installation -**Requirement:** + +[TOC] + +## 💡Features + +- Add peers in configuration +- Manage peer names +- Delete peers +- And many more coming up! Welcome to contribute to this project! + +## 📝Requirement + - Ubuntu 18.04.1 LTS, other OS might work, but haven't test yet. -- Wireguard +- **Wireguard** - Configuration files under **/etc/wireguard** - Python 3.7 - - Flask -**Install:** -1. `git clone https://github.com/donaldzou/Wireguard-Dashboard.git` -2. `cd Wireguard-Dashboard\src` -3. `python3 dashboard.py` -4. Access your server! e.g (http://your_server_ip:10086) +## 🛠Install -## Example +**1. Install Python Dependencies** + +``` +$ python3 -m pip install flask tinydb +``` + +**2. Install Wireguard Dashboard** + +``` +$ git clone https://github.com/donaldzou/Wireguard-Dashboard.git +$ cd Wireguard-Dashboard/src +$ python3 dashboard.py +``` + +Access your server with port `10086` ! e.g (http://your_server_ip:10086) + +**3. Install with Production Mode (Optional)** + +``` +$ cd Wireguard-Dashboard/src +$ export FLASK_APP=dashboard.py +$ export FLASK_RUN_HOST=0.0.0.0 +$ export FLASK_ENV=development +$ export FLASK_DEBUG=0 +$ flask run +``` + +## 🔍Example ![Index Image](https://github.com/donaldzou/Wireguard-Dashboard/raw/main/src/static/index.png) -![Conf Image](https://github.com/donaldzou/Wireguard-Dashboard/raw/main/src/static/configuration.png) +![Conf Image](https://github.com/donaldzou/Wireguard-Dashboard/raw/main/src/static/configuration.png) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b2b0c82 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Flask==1.1.2 +tinydb==4.3.0 \ No newline at end of file diff --git a/src/dashboard.py b/src/dashboard.py index 190b75b..82f9b5d 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -2,11 +2,7 @@ import os from flask import Flask, request, render_template, redirect, url_for import subprocess from datetime import datetime, date, time, timedelta -import sqlite3 -import time -import requests from operator import itemgetter -import collections from tinydb import TinyDB, Query conf_location = "/etc/wireguard" app = Flask("Wireguard Dashboard") @@ -14,9 +10,6 @@ app.config['TEMPLATES_AUTO_RELOAD'] = True css = "" conf_data = {} - - - def get_conf_peer_key(config_name): keys = [] try: peer_key = subprocess.check_output("wg show "+config_name+" peers", shell=True)