summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-08 22:26:10 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-08 22:26:14 +0200
commit091e921fe433bbeedae24224400186c2b705dbe8 (patch)
tree68a6f380b349257f21e6e2f08681e5f5b7bd9bf9 /src
parent12a67646986e89d94d1e41d410c7314488aa1cbe (diff)
downloadvyos-1x-091e921fe433bbeedae24224400186c2b705dbe8.tar.gz
vyos-1x-091e921fe433bbeedae24224400186c2b705dbe8.zip
wireguard: T2226: fix generation of psk
Commit 264e0059449 ("util: T2226: rewrite wireguard oper to use run") changed the code on PSK key generation, but the generated key must be output to stdout.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/wireguard.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/op_mode/wireguard.py b/src/op_mode/wireguard.py
index d940d79eb..1b90f4fa7 100755
--- a/src/op_mode/wireguard.py
+++ b/src/op_mode/wireguard.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018 VyOS maintainers and contributors
+# Copyright (C) 2018-2020 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,8 +13,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import argparse
import os
@@ -27,7 +25,7 @@ from vyos.ifconfig import WireGuardIf
from vyos import ConfigError
from vyos.config import Config
-from vyos.util import run
+from vyos.util import cmd, run
dir = r'/config/auth/wireguard'
psk = dir + '/preshared.key'
@@ -88,10 +86,11 @@ def genpsk():
it's stored only in the cli config
"""
- run('wg genpsk')
+ psk = cmd('wg genpsk')
+ print(psk)
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: