irrdnet / irrd

IRRd version 4
http://irrd.readthedocs.io/en/stable/
Other
154 stars 50 forks source link

IRRd won't start if the log file doesn't already exist #937

Closed tangledhelix closed 6 months ago

tangledhelix commented 6 months ago

Describe the bug On a fresh installation, IRRd will not start if the configured logfile_path does not exist. The error emitted is similar to:

2024-04-24 17:42:36,047 irrd[7]: [root#CRITICAL] Unable to start: logfile /var/log/irrd/irrd.log not writable by UID 1000 / GID 1000

In this case, /var/log/irrd/ exists, owner:group is irrd:irrd, uid 1000, gid 1000 - but the logfile itself is missing.

This is counter to the documentation, which reads (emphasis mine):

Running as a non-privileged user
log.logfile_path, which should either exist with write permissions for the irrd user, or the irrd user should have write access to the directory. Note that if you use log rotation, you must ensure a new file with proper permissions is created before IRRd writes to it, or give write access to the directory.

To Reproduce Start up with the logfile not existing already on disk.

Expected behaviour Expected normal startup.

IRRd version you are running 4.4.3

Additional context I believe this is a regression bug introduced in 4.3, probably by #666.

if staged_logfile_path and not os.access(staged_logfile_path, os.W_OK, effective_ids=True):

os.access() can only return true here if the log file exists - write access to the enclosing directory isn't sufficient to satisfy this test.

mxsasha commented 6 months ago

Sounds like a plausible cause, yes.