auditallow
auditallow sysadm_mail_t var_run_t:dir search;
I put the above rule in my policy, but then see the following in my dmesg output:
Apr 14 18:16:21 caesar kernel: avc: denied { search } for pid=8716 exe=/usr/sbin/sendmail path=/run dev=09:03 ino=2593 scontext=root:sysadm_r:sysadm_mail_t tcontext=system_u:object_r:var_run_t tclass=dir
Surely it should be reporting "granted" not "denied".
The machine in question is running with the kernel patch from the January release of SE Linux. But I have reproduced the same situation on a machine running the latest release.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Russell Coker
Apr 14 18:16:21 caesar kernel: avc: denied { search } for pid=8716exe=/usr/sbin/sendmail path=/run dev=09:03 ino=2593 scontext=root:sysadm_r:sysadm_mail_t tcontext=system_u:object_r:var_run_t tclass=dir
Surely it should be reporting "granted" not "denied".
Are you sure it really is granted, and not denied?
The code in security/selinux/include/linux/flask/avc.h:avc_has_perm_ref_audit(...) and and security/selinux/avc.c:avc_audit(...) looks pretty
clear to me, at least on this point.
Inside avc_has_perm_ref_audit if avc_audit is called with AVC_AUDITDENY==1, it prints denied. After avc_audit returns if enforcing mode is enabled, then the operation is immediately denied.
Assuming I have correctly understood the code, of course.
Signature · 6 lines
Brian May <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 9 lines · Brian May
Quoted 6 lines · Russell Coker
Apr 14 18:16:21 caesar kernel: avc: denied { search } for pid=8716exe=/usr/sbin/sendmail path=/run dev=09:03 ino=2593 scontext=root:sysadm_r:sysadm_mail_t tcontext=system_u:object_r:var_run_t tclass=dir
Surely it should be reporting "granted" not "denied".
Are you sure it really is granted, and not denied?
I think that it is denied, my message was not clear enough.
The result should be printing "granted" and actually allowing the operation, neither of which appears to happen.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · Russell Coker
auditallow
sysadm_mail_tvar_run_t:dir search;I put the above rule in my policy, but then see the following in my dmesg output:
Apr 14 18:16:21 caesar kernel: avc: denied { search } for pid=8716exe=/usr/sbin/sendmail path=/run dev=09:03 ino=2593 scontext=root:sysadm_r:sysadm_mail_t tcontext=system_u:object_r:var_run_t tclass=dir
Quoted 5 lines
Surely it should be reporting "granted" not "denied".
The machine in question is running with the kernel patch from the January release of SE Linux. But I have reproduced the same situation on a machine running the latest release.
auditallow does not imply allow. There are three kinds of access vectors:
1) allow - specifies the set of permissions that are granted, defaults to none (deny everything unless explicitly allowed by an allow rule),
2) auditallow - specifies the set of permissions that should be audited when granted, defaults to none (audit no grantings unless explicitly enabled by an auditallow rule),
3) auditdeny - specifies the set of permissions that should be audited when denied, defaults to all (audit all denials unless explicitly disabled by a dontaudit rule, formerly handled by the auditdeny rules with the complement).
The policy compiler could automatically generate an allow vector for each auditallow rule, but I'd rather not. Add a separate allow rule to the configuration.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 12 lines · Stephen Smalley
auditallow does not imply allow. There are three kinds of access vectors:
1) allow - specifies the set of permissions that are granted, defaults to none (deny everything unless explicitly allowed by an allow rule),
2) auditallow - specifies the set of permissions that should be audited when granted, defaults to none (audit no grantings unless explicitly enabled by an auditallow rule),
3) auditdeny - specifies the set of permissions that should be audited when denied, defaults to all (audit all denials unless explicitly disabled by a dontaudit rule, formerly handled by the auditdeny rules with the complement).
Quoted 3 lines
The policy compiler could automatically generate an allow vector for each auditallow rule, but I'd rather not. Add a separate allow rule to the configuration.
Thanks for the explanation. However I believe that the policy compiler is not behaving correctly in this regard.
I think that as a policy with auditallow rules and no matching allow rules makes no sense the policy compiler should flag a warning about this at least. Also an optional warning about auditdeny rules where there are matching allow rules would be good.
This could be an optional feature, a "-v" option or something similar.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 9 lines · Russell Coker
Thanks for the explanation. However I believe that the policy compiler is not behaving correctly in this regard.
I think that as a policy with auditallow rules and no matching allow rules makes no sense the policy compiler should flag a warning about this at least. Also an optional warning about auditdeny rules where there are matching allow rules would be good.
This could be an optional feature, a "-v" option or something similar.
Along the same lines, you likely want warnings when there is a type_transition rule that has no corresponding allow rules granting the necessary permissions. I'm not adverse to adding such warnings, but it isn't a high priority for us at the moment. If someone else wants to write a patch for it, feel free.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.