Repository navigation
Conversation
The documented way to write to syslog, "log_file: file:///dev/log", breaks in some circumstances when running as non-root (for example, when "log_level: info" is set). Files in /dev/ are unlikely to be normal files, so the simplest solution is to just exclude them from the check.
|
Hi @mcnewton, I guess I'm a little confused. From looking at the code, it looks like it should fall back to the current user's home directory via Also, would you mind porting this to a PR into the master branch? We no longer use develop. |
|
@mcnewton any updates here? |
|
Hi @MKLeb - I've been travelling a lot in August and September. Hope to take a look in the next couple of weeks or so. |
No worries, enjoy your travelling! |
|
@mcnewton Have you been able to circle back to this one yet? |
|
Going to close this for now. Feel free to open up another PR onto the master branch. |
|
Sorry, working on other things for the moment and it fell off my to-do list. Will revisit when I get back to the original thing I was looking at again! |
What does this PR do?
The documented way to write to syslog is to use the config:
log_file: file:///dev/log.This breaks in some circumstances when running as non-root, for example, when
log_level: infois set. In that case,/dev/logis not "writeable", so the code falls back to writing to/root/.salt/master.log, which is definitely not writeable by the non-root user salt is configured to run as.Files in
/dev/are unlikely to be normal files. There are other solutions that might, for example, try and test to see if the file is a socket, but these will be a lot more complicated - they will need to recognise and remove thefile://prefix, parse the line (the documented format permits e.g. a/<log-facility>suffix), and may not be cross-platform compatible. This seems the simplest solution and will fix the issue in the vast majority of cases.What issues does this PR fix or reference?
Likely also fixes: #61286
The test to see if the file is writeable was added in #7875
Previous Behavior
Salt will try and write logs to
/root/.salt/master.log, which is inaccessible when running as non-root, which means salt-master crashes out with a permissions error.New Behavior
There is no check to see if
/dev/logis writeable or not, so salt-master starts correctly.Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.