Little tool to search reference policy to match audit2allow rule Reads stdin and attempts to find matches in reference policy for allow rules. audit2allow -i /var/log/audit/audit.log | python audit2ref Problem right now is it comes up with two many matches, sometimes misses altogether. Useful experiment with Awk and regular expressions. echo "allow abx_t httpd_log_t:file read;" | python audit2ref # Replace next allow rule with one of the following # allow abx_t httpd_log_t:file read gen_require(`apache', ` apache_read_log(abx_t) ') echo "allow abx_t var_log_t:file read;" | python audit2ref # Replace next allow rule with one of the following # allow abx_t var_log_t:file read gen_require(`logging', ` logging_read_generic_logs(abx_t) logging_write_generic_logs(abx_t) logging_rw_generic_logs(abx_t) logging_manage_generic_logs(abx_t) ') echo "allow abx_t avahi_exec_t:file execute;" | python audit2ref allow abx_t avahi_exec_t:file execute