Debian Codegraph @

debian/aide-common.README.Debian

raw
1 AIDE for Debian
2 ---------------
3
4 Debian's aide packages add some value and functionality to AIDE. Most
5 of this functionality is delivered by scripts and is configured via
6 the Debian configuration file in /etc/default/aide. That file is
7 extensively commented.
8
9 In normal use, aide runs unattended as a daily job. In its default
10 setup, it sends out daily reports.
11
12
13 Installation
14 ^^^^^^^^^^^^
15 On installation, debconf questions are asked at medium priority to
16 query the user whether to initialize the AIDE database and whether to
17 automatically place the new database at a place where aide can pick it
18 up as a reference. aideinit, the script used to initialize the
19 database, has a man page, and can be invoked at the users' discretion
20 at a later time.
21
22
23 Configuring AIDE the Debian way
24 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 AIDE's Debian default configuration takes a very paranoid stance and
26 is likely to report more changes than you will need to focus your
27 attention on.
28
29 The AIDE configuration used by the Debian scripts is maintained in
30 /etc/aide/aide.conf and makes use of the @@x_include feature to pull
31 in snippets from /etc/aide/aide.conf.d. The databases are kept in
32 /var/lib/aide by default.
33
34 After changing your aide configuration, you might want to re-build
35 your database either by using the aideinit script, or aide itself via
36 aide --init or aide --update. Otherwise, you will on the next run get
37 a spurious comparison between a newly generated database and the old
38 reference database. Doing this update with aide --update is generally
39 recommended since this gives you a chance to spot changes in the file
40 system that were done between the last aide run and re-building of the
41 database.
42
43
44 Writing rules
45 ^^^^^^^^^^^^^
46 We try to write high quality rules. If you write your own rules, and
47 they're sufficiently general to be of use for other uses of a package,
48 please consider submitting them to us via a wishlist bug or, probably
49 better, to the package in question. We are also open for improvements
50 for the rules we deliver with the package.
51
52 aide rules should be delivered in /etc/aide/aide.conf.d. aide is
53 configured to read only files named according to the Debian cron
54 script namespace restrictions (see run-parts(8)).
55
56 All rules should be restricted to a certain file type. A rule
57 delivered with this package that does not have a restriction is a bug.
58 Please report it. Please write all new rules with this suggestion in
59 mind. If a rule is deliberately unrestricted, aide (starting with
60 version 0.18) offers the explicit "non-restriction" 0. Please use it.
61
62 If you define variables, keep the name space clean and prefix your
63 variables with the name of the package the rule is for. Consider using
64 @@undef to undefine the variable after use.
65
66 We're currently changing the style so that regular rules are prefixed
67 with a space, so that regular rules align nicely with negative and
68 equals rules, and that the first column is reserved for the rule
69 selector. We're slowly going to change the rules that we touch anyway.
70
71 Rules with the x-bit set are not included verbatim, but are executed
72 instead and their output is taken as configuration. To prevent
73 privilege escalation, aide will not execute files that do not belong
74 to either root or the user running aide and that are group or world
75 writeable. Have a close look at your directory permissions to be
76 secure!
77
78 For the package, we try to only include scripts that are written in a
79 robust way and pass shellcheck(1) cleanly. If you find scripts that
80 are not shellcheck clean, that's a bug, please report it (and send a
81 patch if you feel like it).
82
83
84 Common configuration issues
85 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
86 By default, aide checks the entire file system, including /home. This
87 may be undesirable for a system with actively used shell accounts.
88 You might want to exclude the home directories of your active shell
89 users explicitly, which ma cut down aide run time severely if your
90 home directories are big.
91
92 Aide's default configuration includes rule files for the most common
93 packages. For a more comprehensive set of rules, users of other
94 packages are encouraged to submit their rules for inclusion in the
95 aide distribution. Aide rules can both be included with aide, or with
96 the respective package. From a security point of view, it is desirable
97 to have the aide rules come with the respective package, since this
98 makes sure that the only files excluded from the aide check are those
99 that are actually in use on the system. This approach minimizes the
100 amount of unneeded aide rules being in place in normal system
101 operation, but needs the cooperation of the other maintainers.
102
103 Aide rules that come with other packages should be placed as
104 /etc/aide/aide.conf.d/nn_foo_rulename, with foo being the name of the
105 package that contains them, to minimize the potential of conflict and
106 to easy migration from a rule that comes with aide to a rule that
107 comes with the respectiv package. Fellow Debian maintainers, if you
108 include aide rules in your package, please file a bug against aide, so
109 that the respective rules can be removed from the aide package. Users,
110 if you detect a conflict between a rule in the aide package and a rule
111 from another package, please file a bug against aide so that the issue
112 can be cleared up. Of course, the local admin of a system can locally
113 resolve the rule conflict by editing the files - they are
114 dpkg-conffiles.
115
116 Administrators who would like to have full control about their rules
117 can - for example - modify the @@x_include statement at the bottom of
118 /etc/aide.conf to read from a different directory such as
119 /etc/aide/aide.conf.local.d populated with the rules that they really want.
120 Symlinks are accepted, so it is possible to take advantage of future
121 rule updates by symlinking from /etc/aide/aide.conf.d.
122
123
124 aide as non-root
125 ^^^^^^^^^^^^^^^^
126 Starting with aide 0.18, the Debian packages do create a system user
127 _aide on installation and try hard to run aide as that user. This
128 needs either the system having systemd as pid 1 or capsh(1) from the
129 libcap2-bin package installed. If neither is the case, aide runs as
130 root. A non-root aide is augmented with the cap_dac_read_search
131 capability which allows the non-root user to read anywhere.
132
133 The daily aide cron job running as non-root on a systemd system cannot
134 send out mail via the traditional /usr/lib/sendmail interface since
135 the capability-related systemd unit also disabled suid which is needed
136 for the MTA to function. This affects both mailx and bsd-mailx.
137 Non-root aide on systemd systems can only send out mail if s-nail is
138 installed, which in turn relies on a local MTA to listen for s-nail's
139 SMTP connections.
140
141 This affects both new installations and upgraded installations.
142 See below for details.
143
144 A significant part of the shell scripts that surround the aide calls
145 in Debian will still run as root. Patches accepted.
146
147 The non-systemd code paths are badly tested. Please expect breakage
148 and send patches. We appreciate your help here.
149
150
151 the daily AIDE check
152 ^^^^^^^^^^^^^^^^^^^^
153 Main work of the aide package happens in a daily job. On a system
154 using systemd, it's a system timer running between 0200 and 0400. On a
155 system that is not using systemd, the same job is invoked via
156 cron.daily.
157
158 Logging
159 -------
160 The daily job invokes aide, instructs aide to write the report to a
161 temporary file. Standard error is captured to a temporary file as
162 well. The actual command which is invoked is controlled by the COMMAND
163 variable in /etc/default/aide, and additional parameters can be passed
164 in via AIDEARGS in /etc/default/aide. Standard output eventually ends
165 up in /var/log/aide/aide.log, and standard error in
166 /var/log/aide/error.log. Both files are rotated, so that older
167 reports stay available.
168
169 Copying (activating) the new database
170 -------------------------------------
171 After running aide, the newly generated database which was created
172 with COMMAND="update" is optionally copied over the old reference
173 database. The setting of COPYNEWDB in /etc/default/aide controls this.
174 This is a tradeoff between not being bothered by "unnecessary" reports
175 and getting all changes summarized in a single report.
176
177 COPYNEWDB="no" (the default) will never copy the newly created
178 database. Therefore, all changes that are in today's log wil be
179 reported again tomorrow since tomorrow's run will be based on the same
180 input database like today's run. If you want to accept the reported
181 changes and start from an empty report again, you need to copy the new
182 database over the old one manually. The ever increasing logs need
183 almost daily attention and will probably be a nuisance to all users.
184 It's still the safest, sane default though.
185
186 COPYNEWDB="ifnochange" only copies the new database over the old one
187 if aide has not detected any changes. In this case, you need to
188 manually copy over the databases after the first report showing
189 changes, or your ANF+ARF rules and log handling rules are going to
190 stop working until you rebuild and manually copy the database.
191
192 COPYNEWDB="yes" unconditionally accepts all changes after each run of
193 the daily aide check. The archived logs are the only place where a
194 change is reported, and each change reported once will not be reported
195 again. You will need to inspect every single log for unwanted changes.
196 If you use COPYNEWDB="yes" and do not manually increase the log level
197 by setting (for example) AIDEARGS="--log-level info", you lose the
198 possibility of inspecting the changes more closely.
199
200 Reporting
201 ---------
202 The daily aide check generates a report which is saved to
203 /var/log/aide/aide.log. On systems that allow aide's mail sending
204 mechanism to work, the report is postprocessed as explained below
205 and sent to the address configured as MAILTO if either
206 - reportable changes have been found or
207 - no reportable changes have been found and QUIETREPORTS is not
208 set to "yes".
209
210 That means, that if QUIETREPORTS="yes", no message with contents "no
211 changes detected, everything is fine" will be sent.
212
213 Error and standard output are truncated to the first LINES lines each
214 in the message. If the output was truncated, this is prominently
215 visible in the message. Also, if aide returned a non-zero exit value,
216 this is mentioned in the message.
217
218 Mail is sent to the address given in the MAILTO setting, root by
219 default. MAILTO is run through one stage of shell evaluation, so it
220 is possible to have the message sent to recipients depending on
221 variable values, such as the host name.
222
223 If NOISE is set to a regular expression, matching lines do not appear
224 in the report message. This is commonly used in environments where
225 some changes are not important enough to be part of the report that is
226 read by humans, but should be in the log nevertheless for future
227 reference. A second, not de-noised copy of the output is included as
228 well.
229
230 Sending the report per mail
231 ---------------------------
232 The sending of mail reports by the daily aide check is controlled by
233 settings in /etc/default/aide.
234
235 To send out mail reports, the daily aide check either uses s-nail or
236 mail(1) (such as the executable provided by bsd-mailx). If neither is
237 installed, a warning is given on stderr (this ends up in the Journal
238 if systemd is used or is sent via e-mail by the cron daemon). Set
239 SILENTREPORTS=yes to confirm that you really want the daily aide check
240 to be silent. Logs are written in either case.
241
242 S-nail is the tool preferred by the script to send out the message via
243 SMTP to localhost. A working MTA is expected on localhost. An
244 unqualified recipient address is qualified with the contents of
245 /etc/mailname to make it acceptable over SMTP.
246
247 If s-nail is not installed, and the daily cron job is running as
248 non-root under systemd, it will log a message to the journal and the
249 log file and not send mail. On a non-systemd system, it will use
250 mail(1) to send the message. This is done this way because most
251 implementations of mail(1) use /usr/lib/sendmail to deliver the
252 outgoing message. /usr/lib/sendmail is suid root with some MTAs, and
253 this way of privilege escalation is not available when the daily aide
254 job is invoked a non-root user by systemd.
255
256 The daily aide check will automatically select the method of sending
257 mail according to the rules documented above. The variable MAILCMD in
258 /etc/default/aide can be used to override these rules. If you know
259 that your mail(1) works in a scenario where the automatism refuses to
260 use mail(1), setting MAILCMD to the path to mail(1) manually will force
261 the script to use mail(1). If you need more flexibility and/or would
262 prefer to have additional methods of delivering the report supported
263 by the package, please file a wishlist bug.
264
265 The following additional settings are available in /etc/default/aide
266 to control the sending of the message.
267
268 The variable MAILTO controls where the reports are sent to. An
269 unqualified setting such as "root" is used verbatim if mail(1) is
270 used, relying on the local MTA and its settings (typically
271 /etc/aliases) to yield a qualified recipient. If s-nail is used, an
272 unqualified recipient is augmented with the contents of /etc/mailname
273 to form a fully qualified mail address that is useable in SMTP. The
274 variable is expanded before it is used, so you can use variables here.
275 For example, [email protected] will send the report to
276 [email protected] is the local FQDN is
277 host.name.example. MAILTO defaults to "root".
278
279 The variable MAILSUBJ is used as the subject for the e-mail reports.
280 If your mail client only threads by subject, you might want to add
281 some variable content here (for example $(date +%Y-%m-%d)). The
282 variable is expanded before use, so other variables can be used here.
283 If defaults to "Daily AIDE report for $FQDN"
284
285 The variable FQDN is used as the host name to be used in the AIDE
286 reports. It can be set to arbitrary values, and defaults to the output
287 of $(hostname --fqdn).
288
289 RFC 5322 (2.1.1) limits the maximum line length in e-mail messages to
290 998. aide limits its mail messages to 990 in default and wraps longer
291 lines. If your mail system can handle messages with longer lines and
292 you have very long paths on your system, set this to a very high
293 value.
294
295 Setting QUIETREPORTS to yes suppresses the mails completely when no
296 changes have been detected during the AIDE run and no error output was
297 given. This setting defaults to no.
298
299 Setting SILENTREPORTS=yes does never send out mail. It default so no
300 and setting it to yes, this of course implies QUIETREPORTS=yes.
301
302 The result of the daily aide check is given with figlet(6) if figlet
303 is installed. This makes it easier to skim through a list of check
304 results. If you don't want this, set FIGLET=no. The setting defaults
305 to yes.
306
307 If you need other functionality, please file a bug against the aide
308 package.
309
310
311 Using aide for your own ideas
312 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
313 If you intend to use AIDE for your own use, please note that aide is
314 compiled without setting a default configuration file, so you _always_
315 need to give a --config option with the path to a configuration file.
316 This is to prevent an accidental invocation of aide from messing with
317 the Debian database.
318
319 The scripts and programs that are invoking aide and come with the Debian package
320 do explicitly use --config /etc/aide/aide.conf.
321
322
323 no longer statically linked
324 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
325 Aide used to be statically linked by default. The reasoning behind
326 that was the possibility of an attacker modifying libc or other
327 libraries, wrapping system calls and compromising the integrity of
328 aide's reports even if the binary and database are sitting on
329 physically write-protected media. However, it has not been possible to
330 have a fully static binary on Linux for years; the NSS libs are always
331 dynamically linked. This in turn leads to aide segfaulting as soon as
332 a glibc is updated and aide not (#993876).
333
334 Additionally, this kind of attack is actually possible at the kernel
335 level as well, which further reduces the security gained by static
336 linking.
337
338 Furthermore, a statically linked aide needs updating whenever one of
339 the statically linked libraries gets a security update. Recent
340 versions of aide have grown quite a number of dependencies with their
341 features, and Debian does not have (yet) a mechanism to automatically
342 rebuild packages with statically linked binaries when one of their
343 dependencies is updated. It has proven unpractical to do this
344 manually.
345
346 Hence, we have decided to stop shipping a statically linked binary
347 since it is not feasible to keep this updated in time. Using dynamic
348 linking will ensure that security updates get rolled out easily and
349 quickly. This opens the attack vector of trojaned libraries, but we
350 are convinced that this change is still a net gain.
351
352 While we're still paranoid in maintaining a security tool, practical
353 needs need to take precedence. If you want to build a statically
354 linked package locally, take a look at the tag debian/0.17.3-4.9 in
355 git. This is the last tag that still supports building a
356 aide-static.deb. Note that aide 0.18 changed the upstream configure
357 default to dynamic linking, so there is now an --enable-static flag
358 instead of the --disable-static of 0.17 and earlier.
359
360
361 Low Memory Systems
362 ^^^^^^^^^^^^^^^^^^
363 AIDE keeps its database and some additional information in memory at
364 run-time. Please make sure that an adequate amount of physical memory
365 and swap is available when aide runs. If adding more memory and/or
366 swap is not possible, it might be helpful to exclude bigger parts of
367 the file system using a "!" directive. Please note that this
368 sacrifices some security as parts of the file system remain unchecked.
369
370
371 Authors
372 ^^^^^^^
373 This file is maintained by Marc Haber, starting from the README.Debian
374 by Mike Markley <[email protected]>, last changed on Fri, 19 Dec 2003
375 02:47:49 -0800.
376
377 See /usr/share/doc/aide/changelog.Debian.gz for an actual changelog
378 and current timestamps for package and docs.
379
380 # vim: textwidth=70
381