RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 736053 - logrotate has insufficient configuration syntax checking
Summary: logrotate has insufficient configuration syntax checking
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate
Version: 6.3
Hardware: All
OS: All
high
high
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On: 736045
Blocks: 736054
TreeView+ depends on / blocked
 
Reported: 2011-09-06 14:32 UTC by Jan Kaluža
Modified: 2012-06-20 12:40 UTC (History)
5 users (show)

Fixed In Version: logrotate-3.7.8-14.el6
Doc Type: Bug Fix
Doc Text:
Cause: Logrotate did not check for proper matching of brackets in config file. Consequence: This could lead to system files being removed because Logrotate didn't detect the config file error and didn't stop the rotation process for the particular config file. Fix: Logrotate now checks brackets presence and their matching. Result: Config file with bad syntax described above is skipped.
Clone Of: 736045
: 736054 (view as bug list)
Environment:
Last Closed: 2012-06-20 12:40:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0786 0 normal SHIPPED_LIVE logrotate bug fix and enhancement update 2012-06-19 20:34:43 UTC

Description Jan Kaluža 2011-09-06 14:32:53 UTC
+++ This bug was initially created as a clone of Bug #736045 +++

Created attachment 521678 [details]
My email to logrotate-owner

Description of problem:
Logrotate may inadvertently replace essential system files like /dev/null and /bin/kill with zero-length files if a single "{" character is omitted.

Version-Release number of selected component (if applicable):
logrotate-3.7.4 (according to logrotate changelog, still unfixed in logrotate-3.8.0, which is the current upstream version)

How reproducible:
always

Steps to Reproduce:
1. edit standard RHEL 5.6 /etc/logrotate.d/syslog configuration file, removing the "{" from the line that lists /var/log/secure and other syslog logfiles
2. run /etc/cron.daily/logrotate 

  
Actual results:
When "{" is missing, any valid filenames contained in the options block will be replaced with zero-length files, including /bin/kill, /var/run/[r]syslogd.pid, and /dev/null. 
Options that don't match to valid filenames will produce error messages, but logrotate will keep going.
The /var/lib/logrotate.state file will contain lines that indicate the "filenames" logrotate has attempted to rotate. (This will be useful in restoring the system to normal.)

Expected results:
Logrotate should detect an unexpected "}" character while parsing the configuration file, produce an error message about configuration file syntax error (e.g. "unexpected '}' in file %s line %d, possible missing '{' earlier"), and stop without rotating anything. Alternatively, ignoring the current included configuration file and/or all log files specified after the last valid { ... } block would be acceptable too.

Additional info:
I contacted Jan Kaluza (logrotate-owner). Email attached. He agreed this should be fixed.

--- Additional comment from jkaluza on 2011-09-06 10:32:16 EDT ---

Thanks for the report. It's already fixed in logrotate upstream repository and patch ([1] ,[2]) can be backported.

[1] https://fedorahosted.org/logrotate/changeset/344
[2] https://fedorahosted.org/logrotate/changeset/345

Comment 2 RHEL Program Management 2011-09-06 15:18:19 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 6 Jan Kaluža 2012-02-02 07:05:40 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Logrotate did not check for proper matching of brackets in config file.

Consequence: This could lead to system files being removed because Logrotate didn't detect the config file error and didn't stop the rotation process for the particular config file.

Fix: Logrotate now checks brackets presence and their matching.

Result: Config file with bad syntax described above is skipped.

Comment 10 errata-xmlrpc 2012-06-20 12:40:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0786.html


Note You need to log in before you can comment on or make changes to this bug.