summaryrefslogtreecommitdiff
path: root/src/op_mode/wireguard.py
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-09-10 11:28:53 -0700
committerhagbard <vyosdev@derith.de>2019-09-10 11:28:53 -0700
commitdb07e6fa76d90eaf80a06729753fb89266437674 (patch)
tree03fc289e6a3ab71d11e80a0d625338f4d506c33a /src/op_mode/wireguard.py
parent1017c8103f12ebd6db4f250d8a154571fff32db1 (diff)
downloadvyos-1x-db07e6fa76d90eaf80a06729753fb89266437674.tar.gz
vyos-1x-db07e6fa76d90eaf80a06729753fb89266437674.zip
[wireguard]: T1650 - cli option to delete default wg key
Diffstat (limited to 'src/op_mode/wireguard.py')
-rwxr-xr-xsrc/op_mode/wireguard.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/op_mode/wireguard.py b/src/op_mode/wireguard.py
index e48da2e40..4e93ec6aa 100755
--- a/src/op_mode/wireguard.py
+++ b/src/op_mode/wireguard.py
@@ -91,18 +91,16 @@ def genpsk():
subprocess.call(['wg genpsk'], shell=True)
-
def list_key_dirs():
- """ lists all dirs under /config/auth/wireguard """
+ """ lists all dirs under /config/auth/wireguard """
if os.path.exists(dir):
nks = next(os.walk(dir))[1]
for nk in nks:
print (nk)
-
def del_key_dir(kname):
""" deletes /config/auth/wireguard/<kname> """
- kdir = "{0}/{1}".format(dir, kname)
+ kdir = "{0}/{1}".format(dir,kname)
if not os.path.isdir(kdir):
print ("named keypair {} not found".format(kname))
return 1
@@ -133,24 +131,26 @@ if __name__ == '__main__':
if args.location:
genkey("{0}/{1}".format(dir, args.location))
else:
- genkey(dir)
-
+ genkey("{}/default".format(dir))
if args.showpub:
if args.location:
showkey("{0}/{1}/public.key".format(dir, args.location))
else:
- showkey("{}/public.key".format(dir))
+ showkey("{}/default/public.key".format(dir))
if args.showpriv:
if args.location:
showkey("{0}/{1}/private.key".format(dir, args.location))
else:
- showkey("{}/private".format(dir))
+ showkey("{}/default/private.key".format(dir))
if args.genpsk:
genpsk()
if args.listkdir:
list_key_dirs()
if args.delkdir:
- del_key_dir(args.location)
+ if args.location:
+ del_key_dir(args.location)
+ else:
+ del_key_dir("default")
except ConfigError as e:
print(e)