diff options
author | sever-sever <v.gletenko@vyos.io> | 2021-04-01 09:15:26 +0000 |
---|---|---|
committer | sever-sever <v.gletenko@vyos.io> | 2021-04-01 09:15:26 +0000 |
commit | 5b5c09501720932a6ea5d6cbc35605562c057388 (patch) | |
tree | ccd2206f63943d10d688aea63441ff37cbeaa134 /python/vyos/frr.py | |
parent | c147d97a26cd554524e7390c52c749cc3f308787 (diff) | |
download | vyos-1x-5b5c09501720932a6ea5d6cbc35605562c057388.tar.gz vyos-1x-5b5c09501720932a6ea5d6cbc35605562c057388.zip |
frr: T3217: Fix permissions for saved configs
Diffstat (limited to 'python/vyos/frr.py')
-rw-r--r-- | python/vyos/frr.py | 8 |
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 |