Skip to content

Commit

Permalink
Fix #937 - Fix incorrect log access check in setuid startup
Browse files Browse the repository at this point in the history
Introduced in #666
  • Loading branch information
mxsasha committed Apr 25, 2024
1 parent 9be7430 commit 2f4ca06
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions irrd/daemon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ def main():
if uid and gid:
os.setegid(gid)
os.seteuid(uid)
if staged_logfile_path and not os.access(staged_logfile_path, os.W_OK, effective_ids=True):
logging.critical(
f"Unable to start: logfile {staged_logfile_path} not writable by UID {uid} / GID {gid}"
)
return
if staged_logfile_path:
staged_logfile_dir = Path(staged_logfile_path).parent
if not os.access(staged_logfile_dir, os.W_OK, effective_ids=True):
logging.critical(
f"Unable to start: logfile {staged_logfile_path} not writable by UID {uid} / GID {gid}"
)
return

with daemon.DaemonContext(**daemon_kwargs):
config_init(args.config_file_path)
Expand Down

0 comments on commit 2f4ca06

Please sign in to comment.