Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 474332 - app-admin/logrotate - chcon: failed to change context of ‘test.log’ to ‘staff_u:object_r:httpd_sys_content_t’: Invalid argument
Summary: app-admin/logrotate - chcon: failed to change context of ‘test.log’ to ‘staff...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chema Alonso Josa (RETIRED)
URL: https://fedorahosted.org/logrotate/ti...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-22 17:06 UTC by Sean Santos
Modified: 2015-11-26 12:06 UTC (History)
1 user (show)

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


Attachments
emerge --info logrotate (file_474332.txt,6.45 KB, text/plain)
2013-06-22 17:06 UTC, Sean Santos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Santos 2013-06-22 17:06:07 UTC
Created attachment 351656 [details]
emerge --info logrotate

The SELinux test for logrotate is giving me this (from the build.log):

Running test 6
chcon: failed to change context of ‘test.log’ to ‘staff_u:object_r:httpd_sys_content_t’: Invalid argument
test.log.0 should have selinux context httpd_sys_content_t.

It's a simple problem; logrotate uses this command to test whether it can use chcon:

> chcon --type=httpd_sys_content_t test.log

But this box isn't using that type (e.g. it doesn't have Apache).
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2013-06-22 19:05:42 UTC
Not sure if running chcon is the best way to see if it can use chcon, but if that's the case, it would be better to use a type specific to logrotate or related to logs. Perhaps var_log_t would make more sense.

Still, if it wants to see if SELinux is enabled, there are many other ways to deal with that (like checking if /sys/fs/selinux/status exists).
Comment 2 Chema Alonso Josa (RETIRED) gentoo-dev 2013-06-25 20:08:32 UTC
Sorry I don't have any SELINUX enabled box at this moment, so I can't reproduce this.

Which version of logrotate are you using?

Should we file a bug upstream to use another context?

Thanks.
Comment 3 Sean Santos 2013-06-27 05:02:44 UTC
This is in logrotate 3.8.4, but the problem seems to be in the latest version:

http://svn.fedorahosted.org/svn/logrotate/trunk/test/test

I'm not sure I understand the purpose of the test still, so I'm not sure what to do.
Comment 4 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-23 18:33:59 UTC
Personally, I would suggest upstream to use "logrotate_tmp_t" (or any other type related to logrotate) as it is more likely to exist than httpd_sys_content_t (which is Apache-related).
Comment 5 Chema Alonso Josa (RETIRED) gentoo-dev 2013-09-27 07:54:52 UTC
Upstream ticket created. Thanks.

https://fedorahosted.org/logrotate/ticket/35
Comment 6 Chema Alonso Josa (RETIRED) gentoo-dev 2015-11-26 12:06:17 UTC
Upstream ticket fixed. Closing.