diff options
author | Daniil Baturin <daniil@vyos.io> | 2020-07-26 14:06:31 +0300 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2020-07-26 14:06:31 +0300 |
commit | 5f78e67c746e9357cbb59fe066c2b32f34bc92ae (patch) | |
tree | 7a392c617c7a008f134a676436eb29eda24c98a4 /src/op_mode/wireguard.py | |
parent | 9578890e1e4dc31da7387a6ad810d2efb22391e7 (diff) | |
parent | 675942ce3e2329a0122da189cd5944df08d7fcab (diff) | |
download | vyos-1x-5f78e67c746e9357cbb59fe066c2b32f34bc92ae.tar.gz vyos-1x-5f78e67c746e9357cbb59fe066c2b32f34bc92ae.zip |
Merge branch 'current' of https://github.com/vyos/vyos-1x into current
Diffstat (limited to 'src/op_mode/wireguard.py')
-rwxr-xr-x | src/op_mode/wireguard.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/op_mode/wireguard.py b/src/op_mode/wireguard.py index 15bf63e81..e08bc983a 100755 --- a/src/op_mode/wireguard.py +++ b/src/op_mode/wireguard.py @@ -21,22 +21,17 @@ import shutil import syslog as sl import re +from vyos.config import Config from vyos.ifconfig import WireGuardIf - +from vyos.util import cmd +from vyos.util import run +from vyos.util import check_kmod from vyos import ConfigError -from vyos.config import Config -from vyos.util import cmd, run dir = r'/config/auth/wireguard' psk = dir + '/preshared.key' -def check_kmod(): - """ check if kmod is loaded, if not load it """ - if not os.path.exists('/sys/module/wireguard'): - sl.syslog(sl.LOG_NOTICE, "loading wirguard kmod") - if run('sudo modprobe wireguard') != 0: - sl.syslog(sl.LOG_ERR, "modprobe wireguard failed") - raise ConfigError("modprobe wireguard failed") +k_mod = 'wireguard' def generate_keypair(pk, pub): """ generates a keypair which is stored in /config/auth/wireguard """ @@ -106,7 +101,7 @@ def del_key_dir(kname): if __name__ == '__main__': - check_kmod() + check_kmod(k_mod) parser = argparse.ArgumentParser(description='wireguard key management') parser.add_argument( '--genkey', action="store_true", help='generate key-pair') |