From 5b5c09501720932a6ea5d6cbc35605562c057388 Mon Sep 17 00:00:00 2001 From: sever-sever Date: Thu, 1 Apr 2021 09:15:26 +0000 Subject: frr: T3217: Fix permissions for saved configs --- python/vyos/frr.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3