error with logrotate that it has insecure permissions

  • 7005219
  • 26-Apr-2012
  • 28-Apr-2014

Environment

SUSE Linux Enterprise Server 11 Service Pack 1
SUSE Linux Enterprise Server 11 Service Pack 2
SUSE Linux Enterprise Server 10 Service Pack 4
Novell Open Enterprise Server 2 (OES 2) Linux Support Pack 3

Situation

When mailman has been installed, the following message in /var/log/messages:
error: "/var/lib/mailman/logs" has insecure permissions. It must be owned and be writable by root only to avoid security problems. Set the "su" directive in the config file to tell logrotate which user/group should be used for rotation.

When mysql has been installed, the following message in /var/log/messages:
error: "/var/lib/mysql" has insecure permissions. It must be owned and be writable by root only to avoid security problems. Set the "su" directive in the config file to tell logrotate which user/group should be used for rotation.

When tomcat5 has been installed, the following message in /var/log/messages:
error: "/var/log/tomcat/base" has insecure permissions. It must be owned and be writable by root only to avoid security problems. Set the "su" directive in the config file to tell logrotate which user/group should be used for rotation.
error: "/var/log/tomcat/base" has insecure permissions. It must be owned and be writable by root only to avoid security problems. Set the "su" directive in the config file to tell logrotate which user/group should be used for rotation.

These errors can also occur with other packages.

Resolution

When checking the files/directories that logrotate should rotate, the rights are not root.root but something else -- e.g. for the /var/lib/mailman the user/group is mailman.mailman.
To solve the cause of the messages, add "su pkg_user pkg_group" in every section of the /etc/logrotate.d/<package> file.

As an example, there are 2 sections in /etc/logrotate.d/tomcat5.  Therefore, the "su tomcat tomcat" would need to be added to both section -- viz:
/var/log/tomcat5/base/*.txt {
    su tomcat tomcat
    notifempty
    copytruncate
    weekly
    rotate 52
    compress
    missingok
}

/var/log/tomcat5/base/catalina.out {
    su tomcat tomcat
    notifempty
    copytruncate
    weekly
    rotate 52
    compress
    missingok
}


For mailman, update each section in /etc/logrotate.d/mailman with the following:
su mailman mailman

The same for mysql.  Add the following to every section in /etc/logrotate.d/mysql :
su mysql mysql

If the messages occur for other packages, add the user/group owner of the directory or file to the appropriate file in /etc/logrotate.d/

Additional Information

Due to security issues, changes had to be made to logrotate. These changes are causing the seen behavior. The maintainer of the package is responsible for making the required changes in the logrotate configuration that belongs to his package. 

Also be aware that manual made changes to the logrotate configuration, can be lost with a next update of the package..