summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-12 22:18:13 +0200
committerGitHub <noreply@github.com>2024-08-12 22:18:13 +0200
commitc50c55b93027d9000fa4fd966197402c1422ed3f (patch)
tree00617ce16080a12b13eb8d4f80affbba32dc4ddb
parent33273bcc224e82b42fa3db06e9fe2168abdc6205 (diff)
parent3c556eda35a49d7088d4b5b1ff281854cad94bef (diff)
downloadvyos-1x-c50c55b93027d9000fa4fd966197402c1422ed3f.tar.gz
vyos-1x-c50c55b93027d9000fa4fd966197402c1422ed3f.zip
Merge pull request #3959 from vyos/mergify/bp/circinus/pr-3955
configd: T6640: enforce in_session returns False under configd (backport #3955)
-rw-r--r--python/vyos/configsource.py2
-rwxr-xr-xsrc/services/vyos-configd2
2 files changed, 4 insertions, 0 deletions
diff --git a/python/vyos/configsource.py b/python/vyos/configsource.py
index f582bdfab..59e5ac8a1 100644
--- a/python/vyos/configsource.py
+++ b/python/vyos/configsource.py
@@ -204,6 +204,8 @@ class ConfigSourceSession(ConfigSource):
Returns:
True if called from a configuration session, False otherwise.
"""
+ if os.getenv('VYOS_CONFIGD', ''):
+ return False
try:
self._run(self._make_command('inSession', ''))
return True
diff --git a/src/services/vyos-configd b/src/services/vyos-configd
index a4b839a7f..69ee15bf1 100755
--- a/src/services/vyos-configd
+++ b/src/services/vyos-configd
@@ -267,6 +267,8 @@ if __name__ == '__main__':
cfg_group = grp.getgrnam(CFG_GROUP)
os.setgid(cfg_group.gr_gid)
+ os.environ['VYOS_CONFIGD'] = 't'
+
def sig_handler(signum, frame):
shutdown()