Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 155453 - app-admin/logrotate-3.7.1-r2 - logrotate-3.7.1-no-tmpdir.patch breaks functionality
Summary: app-admin/logrotate-3.7.1-r2 - logrotate-3.7.1-no-tmpdir.patch breaks functio...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Lowest minor (vote)
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-16 23:04 UTC by Benjamin Charron
Modified: 2009-03-10 02:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Charron 2006-11-16 23:04:47 UTC
The patch "logrotate-3.7.1-no-tmpdir.patch", which is part of the ebuild for app-admin/logrotate-3.7.1-r2, gets rid of a subtle mkstemp() security risk by sending the script to execute directly to "/bin/sh -c", therefore completely bypassing the temp file.

However, it also breaks an undocumented feature that allows the user to pass the name of the log being rotated to prerotate / postrotate scripts. This is very useful if you have a config like this one:

/var/log/http/*/access.log {
     daily
     compress
     rotate 15
     prerotate
           /usr/local/sbin/analyze-apache-log "$1"
     endscript
}

The workaround is having a separate config for each log file, but it's more painful to maintain :-(

The easiest patch I can think of at this time would be adding this line right before execl("/bin/bash"), in runScript() (logrotate.c:102 with all patches applied):

setenv("LOGROTATE_FILE", logfn, 1);

(Though the overwrite flag might be better set to 0 in order to prevent breaking things in the remote chance of someone already using that variable!)

The patch is evil too because it creates a gentoo-centric feature (unless it's sent upstream too), but at least it preserves the (IMHO) useful functionality.
Comment 1 Benjamin Charron 2006-11-16 23:07:14 UTC
Changed priority to uber-low
Comment 2 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-03-10 02:25:29 UTC
Does this work on 3.7.8?