-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [3006.3] Ubuntu packages destroy existing logrotate config and break log rotation #65231
Comments
This was a mistake on my part in #64194, I noticed that the logrotate config was being included in the RPM builds but not Debian package builds when updating the logrotate config to set perms on various salt logs to allow the |
@barneysowood As mentioned in Slack https://saltstackcommunity.slack.com/archives/CNZKJMQ1E/p1695073531577479?thread_ts=1694114572.419079&cid=CNZKJMQ1E, not everyone wants user: salt, hence cannot be forcing salt as user and group on log rotation, see #65288 |
@dmurphy18 - I hear what you're saying and understand not everyone wants to run the salt-master as the salt user. However, if we don't set the ownership of the logs to salt, for those users who do run the salt-master as the salt user (the default) will have breakage next time logrotate runs. I think the correct thing to do is:
I think that's a reasonable way to ensure sensible default behaviour, but respect peoples choices to not use the defaults - let me know what you think. |
@barneysowood Totally disagree, that is a pita for the user. Multiple steps to take just because they prefer master to run as user: hotdog. The aim should be to make things as simple for the user and not have them jump through hoops to make things work. That is, make the machine do the work as far as possible. Having to pull multiple levers reminds me of JCL, when the machine should be able to be made to handle it (oh the nirvana of a DEC-20 after having to run on an IBM 360 😄 ) . And just because I say 'make the machine do it', doesn't mean I have figured out how just yet, esp. if they install and have not started the salt-master yet). However, @dwoz has an issue open for all of the various file and directories which need to take a different owner if user is something other than root or salt, #65264 I agree with initially setting to salt, but that can occur differently. The log rotation configuration doesn't have to force salt, the logs rotate with whatever was previously there, hence if it was salt, then rotate with salt, if it was hotdog, then with hotdog, the create 0640 without the id and group is fine. So we have a number of issues addressing a similar issue, however this issue here, is about Debian/Ubuntu and paths. Mine is about the log rotation configuration file forcing salt. The current logrotation configure file is wrong, in that it will force new logs to have salt id and group, that has to change, and yes, upgrades should not over-write. |
I mean, the user is going to have to take multiple steps if they want to run the salt master as "user: hotdog", as well as changing the master config, they'll need to set all the correct permissions on the various directories and files, which isn't currently correctly documented.
Having just re-read the logrotate man page.. I've realised that the mode/user/group to "create" are optional and it'll take those values from the existing logfile if you omit them (don't think that used to be the case, but probably 20 years since I last used that in anger). I'm absolutely fine with just having the "create" with the mode - we currently create the logfile with correct ownership at install time - I'll need to do some testing and obviously factor in only touching/chmoding that if it doesn't already exist (as per #65264), but that should mean we can just include the "create" option and get the desired behaviour for the default config and for anyone wants to use a user named after a dubious meat snack.
Cool, I'll work on a PR to do all of that. |
@barneysowood Working on PR #65290 to do that, the code is easy, writing the packaging test case is taking much much longer :) Leaving the correct directories ownership on install etc. to @dwoz 's PR . And yeah, remember how commands operated in the 70's (UNIX) then 90's (gnu) and they do what now ? 🙄 🤣 |
Yeah, the package tests are where I spent a lot of time on #64194 - running them locally is tricky although I eventually worked out doing it locally in a container.
I mean, things were simpler.. doesn't mean things aren't better now :) |
Opened a draft PR #65318 for this. Will need to add some tests and get some testing done on the built packages before this is ready. |
@terminalmage - you indicate that your system has an existing logrotate config at |
@barneysowood I do! The fact is, we've not used anything besides 3006.2 on Ubuntu 22.04, as we've only recently started using 22.04. And, as I mentioned in the OP, we use a modified version of logrotate-formula to manage our logrotate configurations. With 3006.2, there is no logrotate config in any of the Ubuntu 22.04 salt packages, and the formula we use for managing logrotate configurations gives us control over what the file is called (since it is pillar-driven). In other words, |
@barneysowood @terminalmage With classic packages (3005.1) on Redhat boxes, it is /etc/logrotate.d/salt. With the Debian fork, it was /etc/logrotate.d/salt-common on their 3002.6+dfsg1-4+deb11u1, as for Salt's 3005.1 on Debian 11, it is MIA and I am investigating has to what happened. The new onedir packaging, just copied from what was there and if classic packaging was wrong, then they would be wrong too. Issue is getting attention and checking earlier version of classic to see, where the drop got made |
Well appears to have been an oversight, checked 3002.8 which earliest on the repo for Ubuntu 20.04 and no salt anything in /etc/logrotate.d, will have to defer to the Debian fork for Salt which is /etc/logrotate.d/salt-common |
@terminalmage - there are packages with my fix here. If you're able to test those out, that would be much appreciated. |
@barneysowood Installing the
Other than this the package looks good, and I see that the preinst script has code in there to remove |
|
Closing this since PR #65318 is merged. |
Description
Due to an apparent oversight, the Ubuntu packages for 3006.3 added logrotate configuration files, but messed up the path. Instead of simply adding the source file as
/etc/logrotate.d/salt
, thesalt-common
package contains a directory at the path/etc/logrotate.d/salt
, and the source file appears to have been copied into the directory.Installing Salt will destroy a logrotate config file, if present, at
/etc/logrotate.d/salt
, and replace it with the new path. This also breaks Salt log rotation, as logrotate does not recurse into subdirs of paths included using theinclude
logrotate config option (so the path/etc/logrotate.d/salt/salt-common.logrotate
is never processed by logrotate).Setup
Just install
salt-common
on any Ubuntu 22.04 machine. I reproduced this using anubuntu:22.04
Docker container.Steps to Reproduce the behavior
Additional Notes
To fix this, it will probably be necessary to add code to the
preinst
script for thesalt-common
package, which ensures that there is no directory present at/etc/logrotate.d/salt
. Otherwise, anyone using logrotate-formula will be unable to manage logrotate confiugrations, as the formula will fail if/etc/logrotate.d/salt
is a directory.Additionally, this is something that should not need to wait for 3006.4, a revision should be able to be added to the
Version
metadata for the packages (e.g.3006.3-1
).Finally, other platforms should be checked to see if the same bug affects them. The EL7 RPMs are not affected, but it's possible that the Debian packages are.
The text was updated successfully, but these errors were encountered: