1AUDIT2ALLOW(1)                        NSA                       AUDIT2ALLOW(1)
2
3
4

NAME

6       audit2allow  -  generate SELinux policy allow/dontaudit rules from logs
7       of denied operations
8
9       audit2why - translates SELinux audit messages into a description of why
10       the access was denied (audit2allow -w)
11
12

SYNOPSIS

14       audit2allow [options]
15

OPTIONS

17       -a | --all
18              Read input from audit and message log, conflicts with -i
19
20       -b | --boot
21              Read  input  from audit messages since last boot, conflicts with
22              -i
23
24       -d | --dmesg
25              Read input from output of /bin/dmesg.  Note that all audit  mes‐
26              sages  are  not  available via dmesg when auditd is running; use
27              "ausearch -m avc | audit2allow"  or "-a" instead.
28
29       -D | --dontaudit
30              Generate dontaudit rules (Default: allow)
31
32       -e | --explain
33              Fully explain generated output
34
35       -h | --help
36              Print a short usage message
37
38       -i  <inputfile> | --input <inputfile>
39              Read input from <inputfile>
40
41       --interface-info=<interface_info_file>
42              Read interface information from <interface_info_file>
43
44       -l | --lastreload
45              Read input only after last policy reload
46
47       -m <modulename> | --module <modulename>
48              Generate module/require output <modulename>
49
50       -M <modulename>
51              Generate loadable module package, conflicts with -o
52
53       -p <policyfile> | --policy <policyfile>
54              Policy file to use for analysis
55
56       --perm-map <perm_map_file>
57              Read permission map from <perm_map_file>
58
59       -o <outputfile> | --output <outputfile>
60              Append output to <outputfile>
61
62       -r | --requires
63              Generate require output syntax for loadable modules.
64
65       -N | --noreference
66              Do not generate reference policy, traditional style allow rules.
67              This is the default behavior.
68
69       -R | --reference
70              Generate reference policy using installed macros.  This attempts
71              to match denials against interfaces and may be inaccurate.
72
73       -t <type_regex> | --type=<type_regex>
74              Only process messages with a type that matches this regex
75
76       -x | --xperms
77              Generate extended permission access vector rules
78
79       -w | --why
80              Translates SELinux audit messages into a description of why  the
81              access was denied
82
83
84       -v | --verbose
85              Turn on verbose output
86
87

DESCRIPTION

89       This  utility scans the logs for messages logged when the system denied
90       permission for operations, and generates  a  snippet  of  policy  rules
91       which,  if  loaded  into policy, might have allowed those operations to
92       succeed. However, this utility only generates Type Enforcement (TE) al‐
93       low  rules.  Certain permission denials may require other kinds of pol‐
94       icy changes, e.g. adding an attribute to a type declaration to  satisfy
95       an  existing  constraint, adding a role allow rule, or modifying a con‐
96       straint.  The audit2why(8) utility may be used to diagnose  the  reason
97       when it is unclear.
98
99       Care  must  be  exercised while acting on the output of this utility to
100       ensure that the operations being  permitted  do  not  pose  a  security
101       threat.  Often it is better to define new domains and/or types, or make
102       other structural changes to narrowly allow an optimal set of operations
103       to  succeed,  as  opposed  to  blindly implementing the sometimes broad
104       changes recommended by this utility.   Certain permission  denials  are
105       not  fatal  to  the  application, in which case it may be preferable to
106       simply suppress logging of the denial via  a  'dontaudit'  rule  rather
107       than an 'allow' rule.
108

EXAMPLE

110       NOTE: These examples are for systems using the audit package. If you do
111       not use the audit package, the AVC messages will be in /var/log/messages.
112       Please substitute /var/log/messages for /var/log/audit/audit.log in the
113       examples.
114
115       Using audit2allow to generate module policy
116
117       $ cat /var/log/audit/audit.log | audit2allow -m local > local.te
118       $ cat local.te
119       module local 1.0;
120
121       require {
122               class file {  getattr open read };
123
124
125               type myapp_t;
126               type etc_t;
127        };
128
129
130       allow myapp_t etc_t:file { getattr open read };
131       <review local.te and customize as desired>
132
133       Using audit2allow to generate module policy using reference policy
134
135       $ cat /var/log/audit/audit.log | audit2allow -R -m local > local.te
136       $ cat local.te
137       policy_module(local, 1.0)
138
139       gen_require(`
140               type myapp_t;
141               type etc_t;
142       ')
143
144       files_read_etc_files(myapp_t)
145       <review local.te and customize as desired>
146
147       Building module policy using Makefile
148
149       # SELinux provides a policy devel environment under
150       # /usr/share/selinux/devel including all of the shipped
151       # interface files.
152       # You can create a te file and compile it by executing
153
154       $ make -f /usr/share/selinux/devel/Makefile local.pp
155
156
157       # This make command will compile a local.te file in the current
158       # directory. If you did not specify a "pp" file, the make file
159       # will compile all "te" files in the current directory.  After
160       # you compile your te file into a "pp" file, you need to install
161       # it using the semodule command.
162
163       $ semodule -i local.pp
164
165       Building module policy manually
166
167       # Compile the module
168       $ checkmodule -M -m -o local.mod local.te
169
170       # Create the package
171       $ semodule_package -o local.pp -m local.mod
172
173       # Load the module into the kernel
174       $ semodule -i local.pp
175
176       Using audit2allow to generate and build module policy
177
178       $ cat /var/log/audit/audit.log | audit2allow -M local
179       Generating type enforcement file: local.te
180
181       Compiling policy: checkmodule -M -m -o local.mod local.te
182       Building package: semodule_package -o local.pp -m local.mod
183
184       ******************** IMPORTANT ***********************
185
186       In order to load this newly created policy package into the kernel,
187       you are required to execute
188
189       semodule -i local.pp
190
191       Using audit2allow to generate monolithic (non-module) policy
192
193       $ cd /etc/selinux/$SELINUXTYPE/src/policy
194       $ cat /var/log/audit/audit.log | audit2allow >> domains/misc/local.te
195       $ cat domains/misc/local.te
196       allow cupsd_config_t unconfined_t:fifo_file { getattr ioctl };
197       <review domains/misc/local.te and customize as desired>
198       $ make load
199
200

AUTHOR

202       This manual page was written by Manoj Srivastava <srivasta@debian.org>,
203       for  the  Debian  GNU/Linux  system.  It  was  updated  by  Dan   Walsh
204       <dwalsh@redhat.com>
205
206       The  audit2allow utility has contributions from several people, includ‐
207       ing Justin R. Smith and Yuichi Nakamura.  and Dan Walsh
208
209
210
211Security Enhanced Linux          October 2010                   AUDIT2ALLOW(1)
Impressum