summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-08-06 20:21:12 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-08-07 08:28:56 -0500
commit6543f444c42ff45e8115366256643186bf1dd567 (patch)
tree791485a1f37a90649bcd2446f2973d83945f17c7
parent7a546896cb971ede7e1003bd7d0ce1f0485cbd72 (diff)
downloadvyos-1x-6543f444c42ff45e8115366256643186bf1dd567.tar.gz
vyos-1x-6543f444c42ff45e8115366256643186bf1dd567.zip
configd: T6640: enforce in_session returns False under configd
The CStore in_session check is a false positive outside of a config session if a specific environment variable is set with an existing referent in unionfs. To allow extensions when running under configd and avoid confusion, enforce in_session returns False.
-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()