summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-16 13:11:46 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-16 13:11:50 +0100
commit545f5ca254be5d4309e55070933a280108967ab3 (patch)
treec36dfb842bff8bea44c82f4e2a6bcf5c190663ad
parent666f5b5f9226d47ebe0a296d9cd5d4ed397331b4 (diff)
downloadvyos-1x-545f5ca254be5d4309e55070933a280108967ab3.tar.gz
vyos-1x-545f5ca254be5d4309e55070933a280108967ab3.zip
ddclient: change file permission on generated config
ddclient complains when the file permission is not user = rw.
-rwxr-xr-xsrc/conf_mode/dynamic_dns.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py
index d55e732df..9f2d3b836 100755
--- a/src/conf_mode/dynamic_dns.py
+++ b/src/conf_mode/dynamic_dns.py
@@ -18,6 +18,7 @@ import os
import sys
import jinja2
+from stat import S_IRUSR, S_IWUSR
from vyos.config import Config
from vyos import ConfigError
@@ -271,6 +272,9 @@ def generate(dyndns):
with open(config_file, 'w') as f:
f.write(config_text)
+ # Config file must be accessible only by its owner
+ os.chmod(config_file, S_IRUSR | S_IWUSR)
+
return None
def apply(dyndns):