summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-04-01 18:17:04 +0700
committerGitHub <noreply@github.com>2021-04-01 18:17:04 +0700
commit970bc6dd08666031536e0c79baf919cd5ba21839 (patch)
treeccd2206f63943d10d688aea63441ff37cbeaa134
parentc147d97a26cd554524e7390c52c749cc3f308787 (diff)
parent5b5c09501720932a6ea5d6cbc35605562c057388 (diff)
downloadvyos-1x-970bc6dd08666031536e0c79baf919cd5ba21839.tar.gz
vyos-1x-970bc6dd08666031536e0c79baf919cd5ba21839.zip
Merge pull request #796 from sever-sever/T3217
frr: T3217: Fix permissions for saved configs
-rw-r--r--python/vyos/frr.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index ec0bef37a..668489636 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -68,6 +68,7 @@ Apply the new configuration:
import tempfile
import re
from vyos import util
+from vyos.util import chown
import logging
from logging.handlers import SysLogHandler
import os
@@ -220,8 +221,13 @@ def save_configuration(daemon=None):
if code:
raise OSError(code, output)
- with open(f"{path_config}/{daemon}.conf", "w") as f:
+ daemon_conf = f'{path_config}/{daemon}.conf'
+
+ with open(daemon_conf, "w") as f:
f.write(output)
+ # Set permissions (frr:frr) for /run/frr/{daemon}.conf
+ if os.path.exists(daemon_conf):
+ chown(daemon_conf, 'frr', 'frr')
config = output
return config