Minor fix

Permission fix, script generation fix.
This commit is contained in:
Kirigaya Kazuto 2021-07-27 00:14:10 +00:00
parent 7a94df6b1f
commit dc88a93914
3 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ __pycache__/
*.conf
start.sh
stop.sh
restart.sh

View File

@ -218,7 +218,7 @@ while True:
peer_keepalive = input("Enter Wireguard Peer Keep Alive seconds (default to 30): ").strip() or "30"
else:
peer_endpoint = ""
peer_keepalive = "30"
peer_keepalive = ""
config["peers"].append({
"pubkey": peer_pubk,

View File

@ -46,7 +46,7 @@ AllowedIPs = {}
if info["keepalive"]:
f.write("PersistentKeepalive = {}\n".format(info["keepalive"]))
os.system("chmod 600 {}.conf".format(config["interface"]))
os.system("chmod 600 local/{}.conf".format(config["interface"]))
logger.info("Generating start script...")
with open("start.sh", "w", encoding='utf-8') as f:
@ -89,6 +89,7 @@ tmux attach-session -t tunnel
logger.info("Generating stop script...")
with open("stop.sh", "w", encoding='utf-8') as f:
f.write('''#!/bin/bash
set -x
wg-quick down {}
tmux kill-session -t tunnel
'''.format(config["interface"]))
@ -97,7 +98,9 @@ tmux kill-session -t tunnel
logger.info("Generating restart script...")
with open("restart.sh", "w", encoding='utf-8') as f:
f.write('''#!/bin/bash
./stop.sh && ./start.sh
set -x
./stop.sh
./start.sh
''')