From b7a047a7436b3c7f27b347c792663dba38c6851d Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Mon, 16 Aug 2021 15:26:15 -0400 Subject: [PATCH 1/3] Bug fixed --- src/dashboard.py | 9 ++++++--- src/static/js/configuration.js | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 974b22f..6c85bf6 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -107,7 +107,7 @@ def read_conf_file(config_name): conf_peers = file[peers_start:] peer = -1 for i in conf_peers: - if not is_match("^#(.*)", i): + if not is_match("#(.*)", i): if i == "[Peer]": peer += 1 conf_peer_data["Peers"].append({}) @@ -388,7 +388,8 @@ def cleanIpWithRange(ip): def checkIpWithRange(ip): - return is_match("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|\/)){4}(0|8|16|24|32)(,|$)", ip) + return is_match("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|\/)){4}(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|"+ + "18|19|20|21|22|23|24|25|26|27|28|29|30|31|32)(,|$)", ip) def checkAllowedIPs(ip): @@ -769,7 +770,6 @@ def add_peer(config_name): return "Allowed IP already taken by another peer." if not checkIp(DNS): return "DNS formate is incorrect. Example: 1.1.1.1" - if not checkAllowedIPs(endpoint_allowed_ip): return "Endpoint Allowed IPs format is incorrect." else: @@ -829,6 +829,9 @@ def save_peer_setting(config_name): peers = Query() if len(db.search(peers.id == id)) == 1: check_ip = checkAllowedIP(id, allowed_ip, config_name) + if not checkIpWithRange(endpoint_allowed_ip): + return jsonify({"status": "failed", "msg": "Endpoint Allowed IPs format is incorrect."}) + if private_key != "": check_key = checkKeyMatch(private_key, id, config_name) if check_key['status'] == "failed": diff --git a/src/static/js/configuration.js b/src/static/js/configuration.js index 329dabd..3498f70 100644 --- a/src/static/js/configuration.js +++ b/src/static/js/configuration.js @@ -96,6 +96,8 @@ $("#save_peer").click(function(){ }else{ $("#add_peer_alert").html("Please fill in all required box."); $("#add_peer_alert").removeClass("d-none"); + $(this).removeAttr("disabled") + $(this).html("Save") } }) var qrcodeModal = new bootstrap.Modal(document.getElementById('qrcode_modal'), { @@ -249,6 +251,8 @@ $("#save_peer_setting").click(function (){ }else{ $("#setting_peer_alert").html("Please fill in all required box."); $("#setting_peer_alert").removeClass("d-none"); + $("#save_peer_setting").removeAttr("disabled") + $("#save_peer_setting").html("Save") } From f5aa45a3e14b11bd5938d58ac9ba330056573a01 Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Mon, 16 Aug 2021 15:27:10 -0400 Subject: [PATCH 2/3] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 541d261..f971034 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,9 @@ [Interface] ... SaveConfig = true - # Need to include this line to allow WireGuard Tool to save your configuration + # Need to include this line to allow WireGuard Tool to save your configuration, + # or if you just want it to monitor your WireGuard Interface and don't need to + # make any changes with the dashboard, you can set it to false. [Peer] PublicKey = abcd1234 From ef818388c8958cb4d22e6d9656883dc0d3b5f461 Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Mon, 16 Aug 2021 15:28:43 -0400 Subject: [PATCH 3/3] Update dashboard.py --- src/dashboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dashboard.py b/src/dashboard.py index 6c85bf6..192ca8b 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -18,7 +18,7 @@ from tinydb import TinyDB, Query from icmplib import ping, multiping, traceroute, resolve, Host, Hop # Dashboard Version -dashboard_version = 'v2.2' +dashboard_version = 'v2.2.1' # Dashboard Config Name dashboard_conf = 'wg-dashboard.ini' # Default Wireguard IP