summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-wireguard.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-08 22:30:21 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-08 22:30:23 +0200
commitd16348285127f638ae94aa91fdc94d6509d45af1 (patch)
treedba148aa54b7719c9ecae503a3cffe3abceebb55 /src/conf_mode/interfaces-wireguard.py
parent9123a03824f083035f130477bb7b030e559cc9ec (diff)
downloadvyos-1x-d16348285127f638ae94aa91fdc94d6509d45af1.tar.gz
vyos-1x-d16348285127f638ae94aa91fdc94d6509d45af1.zip
vyos.util: introduce chmod_750() for files/directories
Diffstat (limited to 'src/conf_mode/interfaces-wireguard.py')
-rwxr-xr-xsrc/conf_mode/interfaces-wireguard.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/conf_mode/interfaces-wireguard.py b/src/conf_mode/interfaces-wireguard.py
index e9d9ad459..8e80a85a2 100755
--- a/src/conf_mode/interfaces-wireguard.py
+++ b/src/conf_mode/interfaces-wireguard.py
@@ -24,7 +24,7 @@ from netifaces import interfaces
from vyos.config import Config
from vyos.configdict import list_diff
from vyos.ifconfig import WireGuardIf
-from vyos.util import chown, run, is_bridge_member
+from vyos.util import chown, run, is_bridge_member, chmod_750
from vyos import ConfigError
kdir = r'/config/auth/wireguard'
@@ -60,8 +60,7 @@ def _migrate_default_keys():
os.makedirs(location)
chown(location, 'root', 'vyattacfg')
- run(f'sudo chmod 750 {location}')
-
+ chmod_750(location)
os.rename(f'{kdir}/private.key', f'{location}/private.key')
os.rename(f'{kdir}/public.key', f'{location}/public.key')