Skip to content

Commit

Permalink
configd: T6640: enforce in_session returns False under configd
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jestabro committed Aug 7, 2024
1 parent 7a54689 commit 6543f44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/vyos/configsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def in_session(self):
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
Expand Down
2 changes: 2 additions & 0 deletions src/services/vyos-configd
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 6543f44

Please sign in to comment.