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 *.conf
start.sh start.sh
stop.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" peer_keepalive = input("Enter Wireguard Peer Keep Alive seconds (default to 30): ").strip() or "30"
else: else:
peer_endpoint = "" peer_endpoint = ""
peer_keepalive = "30" peer_keepalive = ""
config["peers"].append({ config["peers"].append({
"pubkey": peer_pubk, "pubkey": peer_pubk,

View File

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