Description of problem:
Semanage is sending the wrong kind of audit events. When a user is assigned a new role, an AUDIT_ROLE_ASSIGN event should be sent. When a user has a role removed, an AUDIT_ROLE_REMOVE event should be sent. When a user's process changes roles, like during login, its supposed to issue an AUDIT_USER_ROLE_CHANGE event.
Semanage is only sending AUDIT_USER_ROLE_CHANGE - which is the wrong kind of event.
Steps to Reproduce:
1. semanage user --add -R staff_r test
2. ausearch -m ROLE_ASSIGN --start recent
Actually on further review, AUDIT_USER_ROLE_CHANGE is being sent by newrole, which is good. I guess semanage is simply missing assign/delete of roles to user accounts.
semanage login -a -s guest_u pwalsh
Wrote this record to the audit log.
time->Tue Jan 24 10:37:44 2012
type=USER_ROLE_CHANGE msg=audit(1327419464.300:60279): pid=0 uid=0 auid=3267 ses=7 subj=staff_u:unconfined_r:semanage_t:s0-s0:c0.c1023 msg='op=add SELinux user mapping acct="pwalsh" old-seuser=? old-role=? old-range=? new-seuser=guest_u new-role=? new-range=? exe=/usr/sbin/semanage hostname=? addr=? terminal=pts/0 res=success'
That is the wrong kind of event. It should be AUDIT_ROLE_ASSIGN because you are adding something to the user's security attributes. Also, on delete I am not seeing the old role in the event:
type=USER_ROLE_CHANGE msg=audit(1327347475.071:2739): user pid=11644 uid=0 auid=4325 ses=1 subj=unconfined_u:unconfined_r:semanage_t:s0 msg='op=delete SELinux user record acct="test" old-seuser=? old-role=? old-range=? new-seuser=? new-role=? new-range=? exe=/usr/sbin/semanage hostname=? addr=? terminal=pts/0 res=success'
Not to mention I deleted a role and its telling me I deleted the user.
Correct me if I'm wrong:
ROLE_ASSIGN event should be returned when I run "semanage user --add -R staff_r test".
ROLE_REMOVE event should be returned when I run "semanage user --delete -R staff_r test".
What kind of event should be returned when I run "semanage user --modify -R user_r test" ?
That is correct. For the time being, the modify should produce a ROLE_ASSIGN event. Someday in the future, we can make a ROLE_MODIFY event. But not right now.
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.
(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)
More information and reason for this action is here:
This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.