Skip to content

Lambda user#372

Closed
rmanfredi wants to merge 4 commits intologrotate:masterfrom
rmanfredi:lambda-user
Closed

Lambda user#372
rmanfredi wants to merge 4 commits intologrotate:masterfrom
rmanfredi:lambda-user

Conversation

@rmanfredi
Copy link
Contributor

Small changes required to allow a normal user to run logrotate on files that do not belong to user.

This is useful when a container writes logs to a mapped directory, belonging to the user, but whose files have "foreign ids" (those of the container environment). The ability to rotate the logs and have the logs compressed is important but requires that logs be opened read-only when compressing them, and that no attempt be made to "chown" them to the same uid/gid as the original log file.

It is not required to be able to open the logfile in read-write mode
when we are compressing the file.  A read-only open is sufficient.

This is useful when trying to run logrotate as non-root, to handle
rotation of files created by a container for instance.  As long as we
have write permission in the directory holding the logfile, there is no
reason to prevent the operation (since that user could manually rename()
the file with write permissions in the directory and then compress it).
There is no need to attempt to change the user/group of files if we are
not running as root.  We can leave the permissions to what the user
running logrotate would get if doing the same operation manually by
copying the file!
Copy link
Member

@kdudka kdudka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! Looks good to me.

@kdudka
Copy link
Member

kdudka commented Feb 2, 2021

Merging, thanks!

@kdudka kdudka closed this in a111ef2 Feb 2, 2021
kdudka pushed a commit that referenced this pull request Feb 2, 2021
There is no need to attempt to change the user/group of files if we are
not running as root.  We can leave the permissions to what the user
running logrotate would get if doing the same operation manually by
copying the file!

Closes: #372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants