mage automated wg provisioning work
This commit is contained in:
21
src/wg-easy-create-client.py
Normal file
21
src/wg-easy-create-client.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from dotenv import load_dotenv
|
||||
from utils.wg_easy import get_env_auth, ensure_client_and_config
|
||||
|
||||
load_dotenv()
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("Usage: wg-easy-create-client.py <name>")
|
||||
|
||||
name = sys.argv[1]
|
||||
|
||||
base, auth = get_env_auth()
|
||||
|
||||
# Ensure client exists and fetch its configuration
|
||||
client_id, iface, cfg_text = ensure_client_and_config(base, auth, name)
|
||||
|
||||
out = f"wg-{name}.conf"
|
||||
with open(out, "w") as f:
|
||||
f.write(cfg_text)
|
||||
print(f"✅ Saved config to {out} (id={client_id}, iface={iface}).")
|
||||
Reference in New Issue
Block a user