Bug 728405 - Can't rotate audit logs with logrotate
Summary: Can't rotate audit logs with logrotate
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-05 02:12 UTC by Robin Powell
Modified: 2011-12-04 02:33 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.9.16-48.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-04 02:33:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Robin Powell 2011-08-05 02:12:18 UTC
I really prefer my logs to be rotated by time rather than size, so I disabled auditd's rotation and put it into logrotate.  This is with unconfined off.  It didn't work.  Simplest way I found to make it work:

logging_manage_audit_log(logrotate_t)

-Robin

Comment 1 Miroslav Grepl 2011-08-05 07:01:53 UTC
Not sure if we want allow this  by default for logrotate.

Comment 2 Daniel Walsh 2011-08-05 15:00:12 UTC
That is fine, but it is not something we want to add to policy.

Comment 3 Robin Powell 2011-08-05 15:44:09 UTC
I figured there was a chance of that, but that you might want to make it optional somehow (a boolean?).  If not, I'll bug the auditd people, because I find the current state pretty lame.

-Robin

Comment 4 Daniel Walsh 2011-08-05 17:33:57 UTC
Reassigning to audit.  We could allow this but there is problems in that the audit log is covered by Government standards about how it can be handled.  

I will let them say whether or not they want to allow this.

Comment 5 Robin Powell 2011-08-05 17:43:02 UTC
Let me clarify, then: there are two options here; one is to do the logrotate thing, but the other is to have auditd itself rotate in a time-based fashion rather than a size-based one.  I assume the latter would be within the scope of the standards?, but more work.

And all of this is just me whining :), because having the log files I'm watching go away at random times is really confusing; if it doesn't work for y'all, I'll certainly drop it.  It's a nice-to-have for me, is all.

-Robin

Comment 6 Steve Grubb 2011-08-06 02:08:06 UTC
If you are using logrotate, you must have it issue "service auditd rotate". Then you are free to grab and move logs. I think several people have this working on the linux-audit mail list.

Comment 7 Robin Powell 2011-08-07 06:39:26 UTC
*Ooooooh*.

That's a very different way entirely.  I just added this to cron for testing:

* * * * * /sbin/service auditd rotate

And it works, but reports an irrelevant error about not being able to open /dev/stderr, which can be fixed like this:

allow initrc_t crond_t:fifo_file open;

That's entirely workable; thank you very much.  Passing this back to selinux-policy, as I believe that selinux change to be a tiny tweak and not contentious.

-Robin

Comment 8 Daniel Walsh 2011-08-10 17:17:03 UTC
Why would initrc_t be opening a fifo_file from crond_t?

Comment 9 Robin Powell 2011-08-10 18:14:54 UTC
You and your perfectly reasonable questions!  :)

Here's two emails, with and without the change; I think they completely answer the question, except for the "why is service trying to open /dev/stderr?" part, to which I do not know the answer.


Date: Wed, 10 Aug 2011 04:04:02 -0700
From: Cron Daemon <root.org>
To: postmaster
Subject: Cron <root@morji> /sbin/service auditd rotate

Rotating logs: [  OK  ]


Date: Wed, 10 Aug 2011 04:04:02 -0700
From: Cron Daemon <root.org>
To: postmaster
Subject: Cron <root@vrici> /sbin/service auditd rotate

/etc/init.d/functions: line 58: /dev/stderr: Permission denied
Rotating logs: ^[[60G[  OK  ]


Note that everything works fine in both cases.

-Robin

Comment 10 Daniel Walsh 2011-08-11 20:17:57 UTC
if [ -z "${CONSOLETYPE:-}" ]; then
  if [ -r "/dev/stderr" ]; then
    CONSOLETYPE="$(/sbin/consoletype < /dev/stderr 2>/dev/null)"
  else
    CONSOLETYPE="$(/sbin/consoletype 2>/dev/null)"
  fi
fi


Any idea what is going on here?  I would figure you would redirect /dev/null?

 CONSOLETYPE="$(/sbin/consoletype < /dev/null 2>/dev/null)"

Comment 11 Bill Nottingham 2011-08-15 19:51:39 UTC
consoletype reads its stdin to determine what sort of console is attached.

However, this code controls what sort of things we *output* to the terminal, so it reads from /dev/stderr to determine what console type that is.

Comment 12 Daniel Walsh 2011-08-16 12:00:33 UTC
Miroslav lets add

optional_policy(`
	cron_read_pipes(initrc_t)
')

Comment 13 Miroslav Grepl 2011-08-22 07:39:05 UTC
(In reply to comment #12)
> Miroslav lets add
> 
> optional_policy(`
>  cron_read_pipes(initrc_t)
> ')

Fixed in F15 policy.

Comment 14 Robin Powell 2011-09-05 18:00:46 UTC
I'm not seeing this fix as of 3.9.16-37.fc15 ; should I be?

-Robin

Comment 15 Miroslav Grepl 2011-09-06 06:30:14 UTC
Fixed in selinux-policy-3.9.16-39.fc15

Comment 16 Fedora Update System 2011-09-08 08:11:28 UTC
selinux-policy-3.9.16-39.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-39.fc15

Comment 17 Fedora Update System 2011-09-09 05:27:46 UTC
Package selinux-policy-3.9.16-39.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.9.16-39.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-39.fc15
then log in and leave karma (feedback).

Comment 18 Robin Powell 2011-09-11 20:52:52 UTC
This is still broken in the same way as https://bugzilla.redhat.com/show_bug.cgi?id=736225 : it works until I disable or remove unconfined.

-Robin

Comment 19 Fedora Update System 2011-10-06 00:01:50 UTC
selinux-policy-3.9.16-39.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Robin Powell 2011-10-07 21:51:30 UTC
As I said just above, this isn't fixed in 39.  It *does* appear to be fixed in version 41, however.

-Robin

Comment 21 Fedora Update System 2011-11-16 16:15:53 UTC
selinux-policy-3.9.16-48.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-48.fc15

Comment 22 Fedora Update System 2011-11-17 23:34:20 UTC
Package selinux-policy-3.9.16-48.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.9.16-48.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16023/selinux-policy-3.9.16-48.fc15
then log in and leave karma (feedback).

Comment 23 Fedora Update System 2011-12-04 02:33:55 UTC
selinux-policy-3.9.16-48.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.


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