Skip to content

RFC: forbid rotating hardlinks as root#397

Closed
cgzones wants to merge 6 commits intologrotate:masterfrom
cgzones:hardlinks
Closed

RFC: forbid rotating hardlinks as root#397
cgzones wants to merge 6 commits intologrotate:masterfrom
cgzones:hardlinks

Conversation

@cgzones
Copy link
Member

@cgzones cgzones commented Jun 7, 2021

Related: #237

To avoid any kind of attack scenarios with malicious hard-links to privileged file (like /etc/shadow) do not rotate hard-links as root (we already do not rotate symbolic-links).

cgzones added 4 commits June 7, 2021 16:00
Do not continue in a possible root owned directory
Use O_CREAT inside of `createOutputFile()` instead of specifying it by
every caller.
cgzones added 2 commits June 7, 2021 16:56
We do check a priori if a log file is a link and skip such files.
An attacker could potentially setup a regular file for this check and
replace it afterwards with a link.
Error out if an actual opened log files is a link.
If build with SELinux support but SELinux is disabled, do not
unnecessarily open a file in `setSecCtxByName()`, as `setSecCtx()` will
be a no-op.
@kdudka
Copy link
Member

kdudka commented Jun 7, 2021

Thanks for the proposal! Could you please send me privately the attack scenario that this change would prevent?

@kdudka
Copy link
Member

kdudka commented Jul 1, 2021

I believe the proposed changes are now covered by #407, #400, #398, #399, and #401. Could we please close this pull request?

@cgzones cgzones closed this Jul 5, 2021
@cgzones cgzones deleted the hardlinks branch July 5, 2021 17:35
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.

2 participants