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