1 | .TH SAMHAIN 8 "07 August 2004" "" "Samhain manual"
|
---|
2 | .SH NAME
|
---|
3 | samhain \- check file integrity
|
---|
4 | .SH SYNOPSIS
|
---|
5 | .SS "INITIALIZING, UPDATING, AND CHECKING"
|
---|
6 | .PP
|
---|
7 |
|
---|
8 | .B samhain
|
---|
9 | {
|
---|
10 | .I \-t init|\-\-set\-checksum\-test=init
|
---|
11 | } [\-\-init2stdout] [\-r DEPTH|\-\-recursion=DEPTH] [log-options]
|
---|
12 |
|
---|
13 | .B samhain
|
---|
14 | {
|
---|
15 | .I \-t update|\-\-set\-checksum\-test=update
|
---|
16 | } [\-D | \-\-daemon | \-\-foreground] [\-\-forever] [\-r DEPTH|\-\-recursion=DEPTH] [log-options]
|
---|
17 |
|
---|
18 | .B samhain
|
---|
19 | {
|
---|
20 | .I \-t check|\-\-set\-checksum\-test=check
|
---|
21 | } [\-D | \-\-daemon | \-\-foreground] [\-\-forever] [\-r DEPTH,\-\-recursion=DEPTH] [log-options]
|
---|
22 |
|
---|
23 | .SS "LISTING THE DATABASE"
|
---|
24 | .PP
|
---|
25 |
|
---|
26 | .B samhain
|
---|
27 | [\-a | \-\-full\-detail]
|
---|
28 | [\-\-delimited]
|
---|
29 | \-d
|
---|
30 | .IR file |
|
---|
31 | .RI \-\-list\-database= file
|
---|
32 |
|
---|
33 | .SS "VERIFYING AN AUDIT TRAIL"
|
---|
34 | .PP
|
---|
35 |
|
---|
36 | .B samhain
|
---|
37 | [\-j | \-\-just\-list]
|
---|
38 | \-L
|
---|
39 | .IR logfile |
|
---|
40 | .RI \-\-verify\-log= logfile
|
---|
41 |
|
---|
42 | .B samhain
|
---|
43 | \-M
|
---|
44 | .IR mailbox |
|
---|
45 | .RI \-\-verify\-mail= mailbox
|
---|
46 |
|
---|
47 |
|
---|
48 | .SS "MISCELLANEOUS"
|
---|
49 | .PP
|
---|
50 |
|
---|
51 | .B samhain
|
---|
52 | .RI \-\-server\-port= portnumber
|
---|
53 |
|
---|
54 | .B samhain
|
---|
55 | \-H
|
---|
56 | .I string
|
---|
57 | |
|
---|
58 | .RI \-\-hash\-string= string
|
---|
59 |
|
---|
60 | .B samhain
|
---|
61 | \-c | \-\-copyright
|
---|
62 |
|
---|
63 | .B samhain
|
---|
64 | \-v | \-\-version
|
---|
65 |
|
---|
66 | .B samhain
|
---|
67 | \-h | \-\-help
|
---|
68 |
|
---|
69 | .B samhain
|
---|
70 | \-V key@/path/to/executable | \-\-add\-key=key@/path/to/executable
|
---|
71 |
|
---|
72 | .SS "SERVER STARTUP"
|
---|
73 | .PP
|
---|
74 |
|
---|
75 | .B yule
|
---|
76 | [\-q | \-\-qualified]
|
---|
77 | [
|
---|
78 | .RI \-\-chroot= chrootdir ]
|
---|
79 | [\-D | \-\-daemon | \-\-foreground]
|
---|
80 | [log-options]
|
---|
81 |
|
---|
82 | .SS "SERVER MISCELLANEOUS"
|
---|
83 | .PP
|
---|
84 |
|
---|
85 | .B yule
|
---|
86 | [\-P
|
---|
87 | .I password
|
---|
88 | |
|
---|
89 | .RI \-\-password= password ]
|
---|
90 |
|
---|
91 | .B yule
|
---|
92 | [\-G | \-\-gen-password]
|
---|
93 |
|
---|
94 | .SS "LOG OPTIONS"
|
---|
95 | .PP
|
---|
96 |
|
---|
97 | [\-s
|
---|
98 | .I threshold
|
---|
99 | |
|
---|
100 | .RI \-\-set\-syslog\-severity= threshold ]
|
---|
101 | [\-l
|
---|
102 | .I threshold
|
---|
103 | |
|
---|
104 | .RI \-\-set\-log\-severity= threshold ]
|
---|
105 | [\-m
|
---|
106 | .I threshold
|
---|
107 | |
|
---|
108 | .RI \-\-set\-mail\-severity= threshold ]
|
---|
109 | [\-e
|
---|
110 | .I threshold
|
---|
111 | |
|
---|
112 | .RI \-\-set\-export\-severity= threshold ]
|
---|
113 | [\-p
|
---|
114 | .I threshold
|
---|
115 | |
|
---|
116 | .RI \-\-set\-print\-severity= threshold ]
|
---|
117 | [\-x
|
---|
118 | .I threshold
|
---|
119 | |
|
---|
120 | .RI \-\-set\-external\-severity= threshold ]
|
---|
121 | [
|
---|
122 | .RI \-\-set\-prelude\-severity= threshold ]
|
---|
123 | [
|
---|
124 | .RI \-\-set\-database\-severity= threshold ]
|
---|
125 | [
|
---|
126 | .RI \-\-enable\-trace ]
|
---|
127 | [
|
---|
128 | .RI \-\-trace\-logfile= tracefile ]
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 | .SH WARNING
|
---|
133 | .PP
|
---|
134 | The information in this man page is not always up to date.
|
---|
135 | The authoritative documentation is the user manual.
|
---|
136 |
|
---|
137 | .SH DESCRIPTION
|
---|
138 | .PP
|
---|
139 | .B samhain
|
---|
140 | is a file integrity / intrusion detection system both for single hosts
|
---|
141 | and networks.
|
---|
142 | It consists of a monitoring application
|
---|
143 | .RB ( samhain )
|
---|
144 | running on
|
---|
145 | individual hosts, and (optionally) a central log server
|
---|
146 | .RB ( yule ).
|
---|
147 | Currently, samhain can monitor the
|
---|
148 | integrity of files/directories, and (optionally) also
|
---|
149 | check for kernel rootkits
|
---|
150 | (Linux and FreeBSD only), search the disk for SUID/SGID,
|
---|
151 | and watch for login/logout events.
|
---|
152 | .PP
|
---|
153 | .B samhain/yule
|
---|
154 | can log by email, to a tamper-resistant, signed log file,
|
---|
155 | to syslog, to the Prelude IDS, to a MySQL/PostgreSQL/Oracle database,
|
---|
156 | and/or to stdout
|
---|
157 | .RI ( /dev/console
|
---|
158 | if run as daemon).
|
---|
159 | .B samhain/yule
|
---|
160 | can run as a daemon, and can use a time server instead of the host's
|
---|
161 | system clock. Most of the functionality is defined by a
|
---|
162 | configuration file that is read at startup.
|
---|
163 | .PP
|
---|
164 | Most options of these usually would be set in the configuration file.
|
---|
165 | Options given on the command line will override
|
---|
166 | those in the configuration file.
|
---|
167 |
|
---|
168 | .SS "OPTIONS FOR INITIALIZING, UPDATING, AND CHECKING"
|
---|
169 | .PP
|
---|
170 |
|
---|
171 | .B samhain
|
---|
172 | .I "\-t init, \-\-set\-checksum-test=init"
|
---|
173 | .RI [ options ]
|
---|
174 |
|
---|
175 | Initialize the database of file signatures. The path to the
|
---|
176 | database is compiled in, and initializing will
|
---|
177 | .B append
|
---|
178 | to the respective file (or create it, if it does not exist).
|
---|
179 | .B "It is ok to append to e.g. a JPEG image, but it is an error"
|
---|
180 | .B "to append to an already existing file signature database."
|
---|
181 | .PP
|
---|
182 | .TP
|
---|
183 | [\-\-init2stdout]
|
---|
184 | Write the database to stdout.
|
---|
185 | .TP
|
---|
186 | [\-r DEPTH|\-\-recursion=DEPTH]
|
---|
187 | Set the (global) recursion depth.
|
---|
188 |
|
---|
189 | .PP
|
---|
190 | .B samhain
|
---|
191 | .I "\-t update, \-\-set\-checksum-test=update"
|
---|
192 | .RI [ options ]
|
---|
193 |
|
---|
194 | Update the database of file signatures. The path to the
|
---|
195 | database is compiled in, and updating will
|
---|
196 | .B overwrite
|
---|
197 | the database, starting from the start of the database (which may not be
|
---|
198 | identical to the start of the file \- see above).
|
---|
199 | .PP
|
---|
200 | .TP
|
---|
201 | [\-r DEPTH|\-\-recursion=DEPTH]
|
---|
202 | Set the (global) recursion depth.
|
---|
203 | .TP
|
---|
204 | [\-D|\-\-daemon]
|
---|
205 | Run as daemon. File checks are performed as specified by the timing
|
---|
206 | options in the configuration file. Updates are saved after each file check.
|
---|
207 | .TP
|
---|
208 | [\-\-foreground]
|
---|
209 | Run in the foreground. This will cause samhain to exit after the update,
|
---|
210 | unless the option
|
---|
211 | .I "\-\-forever"
|
---|
212 | is used.
|
---|
213 | .TP
|
---|
214 | [\-\-forever]
|
---|
215 | If not running as daemon, do not exit after finishing the update, but
|
---|
216 | loop forever, and perform checks with corresponding database updates
|
---|
217 | according to the timing options in the
|
---|
218 | configuration file.
|
---|
219 |
|
---|
220 | .PP
|
---|
221 | .B samhain
|
---|
222 | .I "\-t check, \-\-set\-checksum-test=check"
|
---|
223 | .RI [ options ]
|
---|
224 |
|
---|
225 | Check the filesystem against the database of file signatures.
|
---|
226 | The path to the database is compiled in.
|
---|
227 | .PP
|
---|
228 | .TP
|
---|
229 | [\-r DEPTH|\-\-recursion=DEPTH]
|
---|
230 | Set the (global) recursion depth.
|
---|
231 | .TP
|
---|
232 | [\-D|\-\-daemon]
|
---|
233 | Run as daemon. File checks are performed as specified by the timing
|
---|
234 | options in the configuration file.
|
---|
235 | .TP
|
---|
236 | [\-\-foreground]
|
---|
237 | Run in the foreground. This will cause samhain to exit after the file check,
|
---|
238 | unless the option
|
---|
239 | .I "\-\-forever"
|
---|
240 | is used.
|
---|
241 | .TP
|
---|
242 | [\-\-forever]
|
---|
243 | If not running as daemon, do not exit after finishing the check, but
|
---|
244 | loop forever, and perform checks according to the timing options in the
|
---|
245 | configuration file.
|
---|
246 |
|
---|
247 | .SS "OPTIONS FOR LISTING THE DATABASE"
|
---|
248 | .PP
|
---|
249 |
|
---|
250 | .B samhain
|
---|
251 | [\-a | \-\-full\-detail]
|
---|
252 | [\-\-delimited]
|
---|
253 | \-d
|
---|
254 | .IR file |
|
---|
255 | .RI \-\-list\-database= file
|
---|
256 |
|
---|
257 | List the entries in the file signature database in a
|
---|
258 | .B ls \-l
|
---|
259 | like format.
|
---|
260 | .PP
|
---|
261 | .TP
|
---|
262 | [\-a | \-\-full\-detail]
|
---|
263 | List all informations for each file, not only those you would get
|
---|
264 | with ls \-l.
|
---|
265 | .TP
|
---|
266 | [\-\-delimited]
|
---|
267 | List all informations for each file, in a comma-separated format.
|
---|
268 |
|
---|
269 | .SS "OPTIONS TO VERIFY AN AUDIT TRAIL"
|
---|
270 | .PP
|
---|
271 |
|
---|
272 | These options will only work, if the executable used for verifying the
|
---|
273 | audit trail is compiled with the same \-\-enable\-base=... option as the
|
---|
274 | executable of the reporting process.
|
---|
275 |
|
---|
276 | .B samhain
|
---|
277 | [\-j | \-\-just\-list]
|
---|
278 | \-L
|
---|
279 | .IR logfile |
|
---|
280 | .RI \-\-verify\-log= logfile
|
---|
281 |
|
---|
282 | Verify the integrity of a signed logfile. The signing key is
|
---|
283 | auto\-generated on startup, and sent by email.
|
---|
284 | .B samhain
|
---|
285 | will ask for the key. Instead of entering the key, you can also enter
|
---|
286 | the path to the mailbox holding the respective email message.
|
---|
287 | .PP
|
---|
288 | .TP
|
---|
289 | [\-j | \-\-just\-list]
|
---|
290 | Just list the logfile, do not verify it. This option must come
|
---|
291 | .BR first .
|
---|
292 | It is mainly intended for listing the content of an obfuscated logfile, if
|
---|
293 | .B samhain
|
---|
294 | is compiled with the
|
---|
295 | .B stealth
|
---|
296 | option.
|
---|
297 |
|
---|
298 | .B samhain
|
---|
299 | \-M
|
---|
300 | .IR mailbox |
|
---|
301 | .RI \-\-verify\-mail= mailbox
|
---|
302 |
|
---|
303 | Verify the integrity of the email reports from samhain. All reports must be
|
---|
304 | in the same file.
|
---|
305 |
|
---|
306 | .SS "MISCELLANEOUS OPTIONS"
|
---|
307 | .PP
|
---|
308 |
|
---|
309 | .B samhain
|
---|
310 | .RI \-\-server\-port= portnumber
|
---|
311 |
|
---|
312 | Choose the port on the server host to which the client will connect.
|
---|
313 |
|
---|
314 | .B samhain
|
---|
315 | \-H
|
---|
316 | .I string
|
---|
317 | |
|
---|
318 | .RI \-\-hash\-string= string
|
---|
319 |
|
---|
320 | Compute the TIGER192 checksum of a string. If the string starts with
|
---|
321 | a '/', it is considered as a pathname, and the checksum of the corresponding
|
---|
322 | file will be computed.
|
---|
323 |
|
---|
324 | .B samhain
|
---|
325 | \-c | \-\-copyright
|
---|
326 |
|
---|
327 | Print the copyright statement.
|
---|
328 |
|
---|
329 | .B samhain
|
---|
330 | \-v | \-\-version
|
---|
331 |
|
---|
332 | Show version and compiled-in options.
|
---|
333 |
|
---|
334 | .B samhain
|
---|
335 | \-h | \-\-help
|
---|
336 |
|
---|
337 | Print supported command line options (depending on compilation options).
|
---|
338 |
|
---|
339 | .B samhain
|
---|
340 | \-V key@/path/to/executable | \-\-add\-key=key@/path/to/executable
|
---|
341 |
|
---|
342 | See the section "SECURITY" below.
|
---|
343 |
|
---|
344 | .SS "SERVER STARTUP OPTIONS"
|
---|
345 | .PP
|
---|
346 |
|
---|
347 | .B yule
|
---|
348 | [\-q | \-\-qualified]
|
---|
349 | [
|
---|
350 | .RI \-\-chroot= chrootdir ]
|
---|
351 | [\-D | \-\-daemon | \-\-foreground]
|
---|
352 | [log-options]
|
---|
353 |
|
---|
354 | Start the server, which is named
|
---|
355 | .B yule
|
---|
356 | by default. If the server is started with superuser privileges,
|
---|
357 | it will drop them after startup.
|
---|
358 | .PP
|
---|
359 | .TP
|
---|
360 | [\-q | \-\-qualified]
|
---|
361 | Log client hostnames with fully qualified path. The default is to
|
---|
362 | log only the leftmost domain label (i.e. the hostname).
|
---|
363 | .TP
|
---|
364 | [
|
---|
365 | .RI \-\-chroot= chrootdir ]
|
---|
366 | Chroot to the listed directory after startup.
|
---|
367 | .TP
|
---|
368 | [\-D | \-\-daemon]
|
---|
369 | Run as daemon.
|
---|
370 | .TP
|
---|
371 | [\-\-foreground]
|
---|
372 | Run in the foreground.
|
---|
373 |
|
---|
374 |
|
---|
375 | .SS "MISCELLANEOUS SERVER OPTIONS"
|
---|
376 | .PP
|
---|
377 |
|
---|
378 | .B yule
|
---|
379 | [\-G | \-\-gen-password]
|
---|
380 |
|
---|
381 | Generate a random 8\-byte password and print it out in hexadecimal notation.
|
---|
382 |
|
---|
383 |
|
---|
384 | .B yule
|
---|
385 | [\-P
|
---|
386 | .I password
|
---|
387 | |
|
---|
388 | .RI \-\-password= password ]
|
---|
389 |
|
---|
390 | Use the given
|
---|
391 | .I password
|
---|
392 | and generate an entry suitable for the [Clients] section of the
|
---|
393 | configuration file.
|
---|
394 |
|
---|
395 | .SS "LOGGING OPTIONS"
|
---|
396 | .PP
|
---|
397 |
|
---|
398 | Depending on the compilation options, some logging facilities may not
|
---|
399 | be available in your executable.
|
---|
400 | .PP
|
---|
401 | .TP
|
---|
402 | .I "\-s threshold, \-\-set\-syslog\-severity=threshold"
|
---|
403 | Set the threshold for logging events via syslogd(8).
|
---|
404 | Possible values are
|
---|
405 | .IR debug ,
|
---|
406 | .IR info ,
|
---|
407 | .IR notice ,
|
---|
408 | .IR warn ,
|
---|
409 | .IR mark ,
|
---|
410 | .IR err ,
|
---|
411 | .IR crit ,
|
---|
412 | .IR alert ,
|
---|
413 | and
|
---|
414 | .IR none .
|
---|
415 | By default, everything equal to and above the threshold will be logged.
|
---|
416 | Time stamps have the priority
|
---|
417 | .IR warn ,
|
---|
418 | system\-level errors have the priority
|
---|
419 | .IR err ,
|
---|
420 | and important start\-up messages the priority
|
---|
421 | .IR alert .
|
---|
422 | The signature key for the log file will never be logged to syslog or the
|
---|
423 | log file itself.
|
---|
424 | .TP
|
---|
425 | .I "\-l threshold, \-\-set\-log\-severity=threshold"
|
---|
426 | Set the threshold for logging events to the log file.
|
---|
427 | .TP
|
---|
428 | .I "\-m threshold, \-\-set\-mail\-severity=threshold"
|
---|
429 | Set the threshold for logging events via e\-mail.
|
---|
430 | .TP
|
---|
431 | .I "\-e threshold, \-\-set\-export\-severity=threshold"
|
---|
432 | Set the threshold for forwarding events via TCP to a log server.
|
---|
433 | .TP
|
---|
434 | .I "\-x threshold, \-\-set\-extern\-severity=threshold"
|
---|
435 | Set the threshold for calling external logging programs/scripts (if any are
|
---|
436 | defined in the configuration file).
|
---|
437 | .TP
|
---|
438 | .I "\-p threshold, \-\-set\-print\-severity=threshold"
|
---|
439 | Set the threshold for logging events to stdout.
|
---|
440 | If
|
---|
441 | .B samhain
|
---|
442 | runs as a daemon, this is redirected to /dev/console.
|
---|
443 | .TP
|
---|
444 | .I "\-\-set\-prelude\-severity=threshold"
|
---|
445 | Set the threshold for logging events to the Prelude IDS.
|
---|
446 | .TP
|
---|
447 | .I "\-\-set\-database\-severity=threshold"
|
---|
448 | Set the threshold for logging events to the MySQL/PostgreSQL/Oracle
|
---|
449 | database.
|
---|
450 |
|
---|
451 |
|
---|
452 |
|
---|
453 | .SH SIGNALS
|
---|
454 | .TP
|
---|
455 | .I SIGUSR1
|
---|
456 | Switch on/off maximum verbosity for console output.
|
---|
457 | .TP
|
---|
458 | .I SIGUSR2
|
---|
459 | Suspend/continue the process, and
|
---|
460 | (on suspend) send a message
|
---|
461 | to the server. This message has the same priority as timestamps.
|
---|
462 | This signal
|
---|
463 | allows to run
|
---|
464 | .I samhain -t init -e none
|
---|
465 | on the client
|
---|
466 | to regenerate the database, with download of the configuration file
|
---|
467 | from the server, while the daemon is suspended (normally you would get
|
---|
468 | errors because of concurrent access to the server by two processes from
|
---|
469 | the
|
---|
470 | .IR "same host" ")."
|
---|
471 | .TP
|
---|
472 | .I SIGHUP
|
---|
473 | Reread the configuration file.
|
---|
474 | .TP
|
---|
475 | .I SIGTERM
|
---|
476 | Terminate.
|
---|
477 | .TP
|
---|
478 | .I SIGQUIT
|
---|
479 | Terminate after processing all pending requests from clients.
|
---|
480 | .TP
|
---|
481 | .I SIGABRT
|
---|
482 | Unlock the log file, pause for three seconds, then proceed,
|
---|
483 | eventually re-locking the log file and starting a fresh audit trail
|
---|
484 | on next access.
|
---|
485 | .TP
|
---|
486 | .I SIGTTOU
|
---|
487 | Force a file check (only client/standalone, and only in daemon mode).
|
---|
488 |
|
---|
489 |
|
---|
490 | .SH DATABASE
|
---|
491 | The database (default name
|
---|
492 | .IR samhain_file )
|
---|
493 | is a binary file, which can be created or updated using the
|
---|
494 | .B \-t
|
---|
495 | .I init
|
---|
496 | or the
|
---|
497 | .B \-t
|
---|
498 | .I update
|
---|
499 | option.
|
---|
500 | If you use
|
---|
501 | .B \-t
|
---|
502 | .IR init ,
|
---|
503 | you need to
|
---|
504 | .I remove
|
---|
505 | the old database first,
|
---|
506 | otherwise the new version will be
|
---|
507 | .I appended
|
---|
508 | to the old one.
|
---|
509 | The file may be (clear text) signed by PGP/GnuPG.
|
---|
510 | .br
|
---|
511 | It is recommended to use GnuPG with the options
|
---|
512 | .B gpg
|
---|
513 | .I -a --clearsign --not-dash-escaped
|
---|
514 | .br
|
---|
515 | .B samhain
|
---|
516 | will check the signature, if compiled with support for that.
|
---|
517 | .PP
|
---|
518 | At startup
|
---|
519 | .B samhain
|
---|
520 | will compute the checksum of the database, and verify it for
|
---|
521 | each further access. This checksum is not stored on disk (i.e. is lost
|
---|
522 | after program termination), as there is no secure way to store it.
|
---|
523 |
|
---|
524 | .SH LOG FILE
|
---|
525 | .PP
|
---|
526 | Each entry in the log file has the format
|
---|
527 | .BR "Severity : [Timestamp] Message" ,
|
---|
528 | where the timestamp may be obtained from a time server rather than from
|
---|
529 | the system clock, if
|
---|
530 | .B samhain
|
---|
531 | has been compiled with support for this.
|
---|
532 | Each entry is followed by a
|
---|
533 | .IR signature ,
|
---|
534 | which is computed as
|
---|
535 | .BR "Hash(Entry Key_N)" ,
|
---|
536 | and
|
---|
537 | .B Key_N
|
---|
538 | is computed as
|
---|
539 | .BR "Hash(Key_N\-1)" ,
|
---|
540 | i.e. only knowledge of the first signature key in this chain allows to
|
---|
541 | verify the integrity of the log file. This first key is autogenerated
|
---|
542 | and e\-mailed to the designated recipient.
|
---|
543 | .PP
|
---|
544 | The default name of the log file is
|
---|
545 | .IR samhain_log .
|
---|
546 | To prevent multiple instances of
|
---|
547 | .B samhain
|
---|
548 | from writing to the same log file, the log file is locked by creating a
|
---|
549 | .IR "lock file" ,
|
---|
550 | which is normally deleted at program termination.
|
---|
551 | The default name of the
|
---|
552 | .I "lock file"
|
---|
553 | is
|
---|
554 | .IR samhain.lock .
|
---|
555 | If
|
---|
556 | .B samhain
|
---|
557 | is terminated abnormally, i.e. with kill \-9,
|
---|
558 | a stale lock file might remain, but usually
|
---|
559 | .B samhain
|
---|
560 | will be able to recognize that and remove the stale lock file
|
---|
561 | on the next startup.
|
---|
562 | .PP
|
---|
563 | .SH EMAIL
|
---|
564 | .PP
|
---|
565 | E\-mails are sent (using built-in SMTP code)
|
---|
566 | to one recipient only.
|
---|
567 | The subject line contains timestamp
|
---|
568 | and hostname, which are repeated in the message body.
|
---|
569 | The body of the mail contains a line with a
|
---|
570 | .I signature
|
---|
571 | similar to that in the log file, computed from the message and a
|
---|
572 | key. The key is iterated by a hash chain, and the initial
|
---|
573 | key is revealed in the first email sent.
|
---|
574 | Obviously, you have to believe that this first e\-mail is
|
---|
575 | authentical ...
|
---|
576 | .PP
|
---|
577 | .SH CLIENT/SERVER USAGE
|
---|
578 | .PP
|
---|
579 | To monitor several machines, and collecting data by a central log server,
|
---|
580 | .B samhain
|
---|
581 | may be compiled as a client/server application. The log server
|
---|
582 | .RB ( yule )
|
---|
583 | will accept connection
|
---|
584 | requests from registered clients only. With each client, the server will first
|
---|
585 | engage in a challenge/response protocol for
|
---|
586 | .I authentication
|
---|
587 | of the client and
|
---|
588 | .I establishing
|
---|
589 | a
|
---|
590 | .IR "session key" .
|
---|
591 | .PP
|
---|
592 | This protocol requires on the client side a
|
---|
593 | .IR "password" ,
|
---|
594 | and on the server side a
|
---|
595 | .IR "verifier"
|
---|
596 | that is computed from the
|
---|
597 | .IR "password" .
|
---|
598 | .PP
|
---|
599 | To
|
---|
600 | .I register
|
---|
601 | a client, simply do the following:
|
---|
602 | .br
|
---|
603 | First, with the included utility program
|
---|
604 | .B samhain_setpwd
|
---|
605 | re\-set the compiled\-in default password of the
|
---|
606 | client executable to your preferred
|
---|
607 | value (with no option, a short usage help is printed).
|
---|
608 | To allow for non-printable chars, the new value
|
---|
609 | must be given as a 16\-digit hexadecimal string
|
---|
610 | (only 0123456789ABCDEF in string), corresponding to an 8-byte password.
|
---|
611 | .br
|
---|
612 | Second, after re\-setting the password in the client executable,
|
---|
613 | you can use the server's convenience function
|
---|
614 | .B yule
|
---|
615 | .B \-P
|
---|
616 | .I password
|
---|
617 | that will take as input the (16\-digit hex) password,
|
---|
618 | compute the corresponding verifier, and outputs a default configuration file
|
---|
619 | entry to register the client.
|
---|
620 | .br
|
---|
621 | Third, in the configuration file for the server, under the [Clients] section,
|
---|
622 | enter
|
---|
623 | the suggested registration entry of the form
|
---|
624 | .IR "Client=hostname@salt@verifier" ,
|
---|
625 | where
|
---|
626 | .I hostname
|
---|
627 | must be the (fully qualified) hostname of the machine on
|
---|
628 | which the client will run.
|
---|
629 | .B "Don't forget to reload the server configuration thereafter."
|
---|
630 | .PP
|
---|
631 | If a connection attempt is made, the server will lookup the entry for
|
---|
632 | the connecting host, and use the corresponding value for the
|
---|
633 | .I verifier
|
---|
634 | to engage in the session key exchange. Failure to verify the client's
|
---|
635 | response(s) will result in aborting the connection.
|
---|
636 | .PP
|
---|
637 | .SH STEALTH
|
---|
638 | .PP
|
---|
639 | .B samhain
|
---|
640 | may be compiled with support for a
|
---|
641 | .I stealth
|
---|
642 | mode of operation, meaning that
|
---|
643 | the program can be run without any obvious trace of its presence
|
---|
644 | on disk. The supplied facilities are simple - they are more
|
---|
645 | sophisticated than just running the program under a different name,
|
---|
646 | and might thwart efforts using 'standard' Unix commands,
|
---|
647 | but they will not resist a search using dedicated utilities.
|
---|
648 | .PP
|
---|
649 | In this mode, the runtime executable will hold no
|
---|
650 | printable strings, and the configuration file is expected to be
|
---|
651 | a postscript file with
|
---|
652 | .I uncompressed
|
---|
653 | image data, wherein
|
---|
654 | the configuration data are hidden by steganography.
|
---|
655 | To create such a file from an existing image, you may use e.g.
|
---|
656 | the program
|
---|
657 | .BR convert (1),
|
---|
658 | which is part of the
|
---|
659 | .BR ImageMagick (1)
|
---|
660 | package, such as:
|
---|
661 | .B "convert +compress"
|
---|
662 | .IR "ima.jpg ima.ps" .
|
---|
663 | .PP
|
---|
664 | To hide/extract the configuration data within/from the postscript file,
|
---|
665 | a utility program
|
---|
666 | .B samhain_stealth
|
---|
667 | is provided.
|
---|
668 | Use it without options to get help.
|
---|
669 | .PP
|
---|
670 | Database and log file may be e.g. existing image files, to which
|
---|
671 | data are appended, xor'ed with some constant to mask them as binary data.
|
---|
672 | .PP
|
---|
673 | The user is responsible by herself for re-naming the compiled
|
---|
674 | executable(s) to unsuspicious names, and choosing (at compile time)
|
---|
675 | likewise unsuspicious names for config file, database, and log (+lock) file.
|
---|
676 | .PP
|
---|
677 | .SH SECURITY
|
---|
678 | .PP
|
---|
679 | For security reasons,
|
---|
680 | .B samhain
|
---|
681 | will not write log or data files in a directory, remove the lock file,
|
---|
682 | or read the configuration file, if any element
|
---|
683 | in the path is owned or writeable by an untrusted user (including
|
---|
684 | group-writeable files with untrusted users in the group, and world-writeable
|
---|
685 | files).
|
---|
686 | .br
|
---|
687 | .I root
|
---|
688 | and the
|
---|
689 | .I effective
|
---|
690 | user are always trusted. You can add more users in the configuration file.
|
---|
691 | .PP
|
---|
692 | Using a
|
---|
693 | .I "numerical host address"
|
---|
694 | in the e\-mail address is more secure than
|
---|
695 | using the hostname (does not require
|
---|
696 | DNS lookup).
|
---|
697 | .PP
|
---|
698 | If you use a
|
---|
699 | .I precompiled
|
---|
700 | .B samhain
|
---|
701 | executable (e.g. from a
|
---|
702 | binary distribution), in principle a prospective intruder could easily
|
---|
703 | obtain a copy of the executable and analyze it in advance. This will
|
---|
704 | enable her/him to generate fake audit trails and/or generate
|
---|
705 | a trojan for this particular binary distribution.
|
---|
706 | .br
|
---|
707 | For this reason, it is possible for the user to add more key material into
|
---|
708 | the binary executable. This is done with the command:
|
---|
709 | .PP
|
---|
710 | .BI "samhain " \-\-add\-key=key@/path/to/executable
|
---|
711 | .PP
|
---|
712 | This will read the file
|
---|
713 | .I /path/to/executable, add the key
|
---|
714 | .I key,
|
---|
715 | which should not contain a '@' (because it has a special meaning, separating
|
---|
716 | key from path), overwrite any key previously set by this command, and
|
---|
717 | write the new binary to the location
|
---|
718 | .I /path/to/executable.out
|
---|
719 | (i.e. with .out appended). You should then copy the new binary to the location
|
---|
720 | of the old one (i.e. overwrite the old one).
|
---|
721 | .PP
|
---|
722 | .B Note that using a precompiled samhain executable from a binary
|
---|
723 | .B package distribution is not recommended unless you add in key material as
|
---|
724 | .B described here.
|
---|
725 |
|
---|
726 | .PP
|
---|
727 | .SH NOTES
|
---|
728 | .PP
|
---|
729 | For initializing the key(s),
|
---|
730 | .I "/dev/random"
|
---|
731 | is used, if available. This is a
|
---|
732 | device supplying cryptographically strong
|
---|
733 | (non-deterministic) random noise. Because it is slow,
|
---|
734 | .B samhain
|
---|
735 | might appear to hang at startup. Doing some random things
|
---|
736 | (performing rain dances, spilling coffee, hunting the mouse) might speed up
|
---|
737 | things. If you do not have
|
---|
738 | .IR "/dev/random" ,
|
---|
739 | lots of statistics from
|
---|
740 | .BR vmstat (8)
|
---|
741 | and the like will be pooled and mixed by a hash function.
|
---|
742 | .PP
|
---|
743 | Some hosts might check whether the sender of the mail is valid.
|
---|
744 | Use only
|
---|
745 | .I "login names"
|
---|
746 | for the sender.
|
---|
747 | .br
|
---|
748 | For sending mails, you may need to set a relay host for the sender domain
|
---|
749 | in the configuration file.
|
---|
750 | .PP
|
---|
751 | .SH BUGS
|
---|
752 | .PP
|
---|
753 | Whoever has the original signature key may change the log file and send fake
|
---|
754 | e\-mails. The signature keys are e\-mailed at program startup
|
---|
755 | with a one\-time pad encryption.
|
---|
756 | This should be safe against an eavesdropper on the network,
|
---|
757 | but not against someone with read access to the binary,
|
---|
758 | .I if
|
---|
759 | she has caught
|
---|
760 | the e\-mail.
|
---|
761 | .PP
|
---|
762 | .SH FILES
|
---|
763 | .PP
|
---|
764 | .I /etc/samhainrc
|
---|
765 | .br
|
---|
766 | .I /usr/local/man/man8/samhain.8
|
---|
767 | .br
|
---|
768 | .I /usr/local/man/man5/samhainrc.5
|
---|
769 | .br
|
---|
770 | .I /var/log/samhain_log
|
---|
771 | .br
|
---|
772 | .I /var/lib/samhain/samhain_file
|
---|
773 | .br
|
---|
774 | .I /var/lib/samhain/samhain.html
|
---|
775 | .br
|
---|
776 | .I /var/run/samhain.pid
|
---|
777 |
|
---|
778 | .SH SEE ALSO
|
---|
779 | .PP
|
---|
780 | .BR samhainrc (5)
|
---|
781 |
|
---|
782 | .SH AUTHOR
|
---|
783 | .PP
|
---|
784 | Rainer Wichmann (http://la\-samhna.de)
|
---|
785 | .SH BUG REPORTS
|
---|
786 | .PP
|
---|
787 | If you find a bug in
|
---|
788 | .BR samhain ,
|
---|
789 | please send electronic mail to
|
---|
790 | .IR support@la\-samhna.de .
|
---|
791 | Please include your operating system and its revision, the version of
|
---|
792 | .BR samhain ,
|
---|
793 | what C compiler you used to compile it, your 'configure' options, and
|
---|
794 | any information that you deem helpful.
|
---|
795 | .PP
|
---|
796 | .SH COPYING PERMISSIONS
|
---|
797 | .PP
|
---|
798 | Copyright (\(co) 1999, 2004 Rainer Wichmann
|
---|
799 | .PP
|
---|
800 | Permission is granted to make and distribute verbatim copies of
|
---|
801 | this manual page provided the copyright notice and this permission
|
---|
802 | notice are preserved on all copies.
|
---|
803 | .ig
|
---|
804 | Permission is granted to process this file through troff and print the
|
---|
805 | results, provided the printed document carries copying permission
|
---|
806 | notice identical to this one except for the removal of this paragraph
|
---|
807 | (this paragraph not being relevant to the printed manual page).
|
---|
808 | ..
|
---|
809 | .PP
|
---|
810 | Permission is granted to copy and distribute modified versions of this
|
---|
811 | manual page under the conditions for verbatim copying, provided that
|
---|
812 | the entire resulting derived work is distributed under the terms of a
|
---|
813 | permission notice identical to this one.
|
---|
814 |
|
---|
815 |
|
---|
816 |
|
---|