summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2018-08-27 08:35:39 -0700
committerhagbard <vyosdev@derith.de>2018-08-27 08:35:39 -0700
commit00e809cd899cb8a9b55b1eb547ffa2e7d6e86a24 (patch)
treef1cb13fd0360e4c0064287cffb987f2b2a0b72f7
parent6b27311f86c65cde3d44629015c6a6e49d31a794 (diff)
downloadvyos-1x-00e809cd899cb8a9b55b1eb547ffa2e7d6e86a24.tar.gz
vyos-1x-00e809cd899cb8a9b55b1eb547ffa2e7d6e86a24.zip
T793: wiregurard preshared-key op-mode script and interface implementation
-rw-r--r--op-mode-definitions/wireguard.xml12
-rwxr-xr-xsrc/op_mode/wireguard_key.py4
2 files changed, 14 insertions, 2 deletions
diff --git a/op-mode-definitions/wireguard.xml b/op-mode-definitions/wireguard.xml
index a7e156d8d..75fb05228 100644
--- a/op-mode-definitions/wireguard.xml
+++ b/op-mode-definitions/wireguard.xml
@@ -14,6 +14,12 @@
</properties>
<command>${vyos_op_scripts_dir}/wireguard_key.py --genkey</command>
</leafNode>
+ <leafNode name="preshared-key">
+ <properties>
+ <help>generate a wireguard preshared key</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/wireguard_key.py --genpsk</command>
+ </leafNode>
</children>
</node>
</children>
@@ -34,6 +40,12 @@
</properties>
<command>${vyos_op_scripts_dir}/wireguard_key.py --showpriv</command>
</leafNode>
+ <leafNode name="preshared-key">
+ <properties>
+ <help>show wireguard preshared key</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/wireguard_key.py --showpsk</command>
+ </leafNode>
</children>
</node>
<node name="interfaces">
diff --git a/src/op_mode/wireguard_key.py b/src/op_mode/wireguard_key.py
index 6177853c4..c7208843d 100755
--- a/src/op_mode/wireguard_key.py
+++ b/src/op_mode/wireguard_key.py
@@ -54,7 +54,7 @@ def genkey():
### if umask 077 makes trouble, 027 will work
old_umask = os.umask(0o077)
if os.path.exists(pk) and os.path.exists(pub):
- choice = input("You have a wireguard key-pair already, do you want to re-generate? [y/n] ")
+ choice = input("You already have a wireguard key-pair already, do you want to re-generate? [y/n] ")
if choice == 'y' or choice == 'Y':
generate_keypair()
else:
@@ -79,7 +79,7 @@ def showkey(key):
def genpsk():
old_umask = os.umask(0o077)
if os.path.exists(psk):
- choice = input("You have a wireguard key-pair already, do you want to re-generate? [y/n] ")
+ choice = input("You already have a preshared-key, do you want to re-generate? [y/n] ")
if choice == 'y' or choice == 'Y':
generate_psk()
else: