mirror of
https://github.com/Kiritow/wg-ops.git
synced 2024-03-22 13:11:37 +08:00
Minor fix
Permission fix, script generation fix.
This commit is contained in:
parent
7a94df6b1f
commit
dc88a93914
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,3 +8,4 @@ __pycache__/
|
||||||
*.conf
|
*.conf
|
||||||
start.sh
|
start.sh
|
||||||
stop.sh
|
stop.sh
|
||||||
|
restart.sh
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user