/usr/share/doc/samhain/manual.html/the-configuration-file.html is in samhain 3.1.0-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Configuration file syntax and options</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="The Samhain Host Integrity Monitoring System"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="yule"
HREF="command-line-yule.html"><LINK
REL="NEXT"
TITLE="Files to check"
HREF="files-to-check.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="./docbook.css"></HEAD
><BODY
CLASS="APPENDIX"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><!--#if expr="! ($HTTP_USER_AGENT = /MSIE/)"--><!--#include virtual="/resources/ssi/header.html"--><!--#endif --><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Samhain Host Integrity Monitoring System</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="command-line-yule.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="files-to-check.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="APPENDIX"
><H1
><A
NAME="THE-CONFIGURATION-FILE"
></A
>Appendix C. Configuration file syntax and options</H1
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="CONFIGFILE"
>C.1. General</A
></H1
><P
> The configuration file for
<SPAN
CLASS="APPLICATION"
>samhain</SPAN
> is named <TT
CLASS="FILENAME"
>samhainrc</TT
>
by default. Also by default, it is placed in
<TT
CLASS="FILENAME"
>/etc</TT
>.
(Name and location is configurable at compile time).
The distribution package comes with a commented sample
configuration file.</P
><P
> This section introduces the general structure of the configuration file.
Details on individual entries in the configuration files are
discussed in <A
HREF="filedef.html"
>Section 5.4</A
>> (which files to monitor),
<A
HREF="basic-configuration.html#LOGDEF"
>Section 4.1</A
>> (what should be logged, which logging facilities
should be used, and how these facilities are properly configured), and
<A
HREF="mondef.html"
>Section 5.11</A
>> (monitoring login/logout events).</P
><P
> The configuration file contains several <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>sections</I
></SPAN
>,
indicated by <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>headings</I
></SPAN
> in
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>square brackets</I
></SPAN
> (e.g. <B
CLASS="COMMAND"
>[Database]</B
>).
Sections exist to group related directives and avoid eventual name clashes
among options. Any particular section may occur multiple times.</P
><P
> Each section may hold zero or more
<B
CLASS="COMMAND"
>key=<TT
CLASS="REPLACEABLE"
><I
>value</I
></TT
></B
> pairs.
Keys are not case sensitive, and
space around the '=' is allowed, as well as before the key and after the
value. More specifically: the line is processed by splitting into key and
value at the first '=', trimming whitespace from the beginning and end of
both key and value, and converting the key to lowercase.</P
><P
> Blank lines and lines starting with '#'
are comments. Everything before the first section and
after an <B
CLASS="COMMAND"
>[EOF]</B
> is ignored.
The <B
CLASS="COMMAND"
>[EOF]</B
> end-of-file marker is
optional.
The file thus looks like:</P
><PRE
CLASS="PROGRAMLISTING"
> # this is a comment
[Section heading]
key1=value
key2=value
[Another section]
key3=value
key4=value </PRE
><P
>For boolean values the following are equivalent (case-insensitive):
True, Yes, or 1.
Likewise, the following are equivalent (case-insensitive): False, No, or 0.</P
><P
>In lists, values can be separated by space, tabs, or commas. </P
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Tip</B
></TH
></TR
><TR
><TD
> </TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Each section may occur multiple times.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Note</B
></TH
></TR
><TR
><TD
> </TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>You can explicitely end the configuration file with an
<B
CLASS="COMMAND"
>[EOF]</B
> (on a separate line), but this
is not required, unless there is some junk beyond that may
confuse the parser. A PGP signature does <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not</I
></SPAN
>
qualify as 'junk' if <SPAN
CLASS="APPLICATION"
>samhain</SPAN
>
is compiled to verify the signature.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="EXPANSION"
>C.1.1. Shell expansion</A
></H2
><P
> As of version 2.5.3, it is possible to use shell expansion to define
the value of an option. For any configuration file option written as
<B
CLASS="COMMAND"
>Key = $( <TT
CLASS="REPLACEABLE"
><I
>shell_command</I
></TT
> )</B
>,
the string contained within the $() will be passed
literally to the shell (by invoking
<B
CLASS="COMMAND"
>/bin/sh -c <TT
CLASS="REPLACEABLE"
><I
>shell_command</I
></TT
></B
>),
and the
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>first</I
></SPAN
> line returned by the shell - after stripping the
newline char - will replace the $(..). If there is no output
within 120 seconds, <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> will ignore the
configuration option (and report an error).</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Note</B
></TH
></TR
><TR
><TD
> </TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>You cannot define just <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>part</I
></SPAN
> of an option value this way.
You need to write the shell expression such that it covers the
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>whole</I
></SPAN
> option value (e.g. by including an 'echo -n foobar').</P
></TD
></TR
></TABLE
></DIV
><P
> The PATH environment variable
will be set to "/sbin:/bin:/usr/sbin:/usr/bin:/usr/ucb",
the SHELL variable to "/bin/sh", the IFS variable
to " \t\n", and the TZ variable will be copied from the
startup environment.
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>No other environment variables will be set</I
></SPAN
>.</P
><P
> In case you are unsure about the need for escaping: yes, the whole string
will be passed as a single argument to the shell, like calling
<B
CLASS="COMMAND"
>/bin/sh -c '<TT
CLASS="REPLACEABLE"
><I
>shell_command</I
></TT
>'</B
>
from the shell, BUT since this is done from within a C program rather than
from a shell, there are no single quotes surrounding the whole string.</P
><P
> In the following example, we parse the output of
<B
CLASS="COMMAND"
>ifconfig</B
> to supply a list of all interfaces to the
"PortCheckInterface" option.</P
><PRE
CLASS="PROGRAMLISTING"
>#
# Lines broken for display purposes. Must be ONE line in config file!!!
# Linux/Solaris, FreeBSD, OpenBSD
$Linux:.*:.*
PortCheckInterface=$( /sbin/ifconfig | grep 'inet addr:' |
sed 's/.*r:\([0-9.]*\).*/\1 /' | tr -d '\n'; echo )
$end
# Solaris, FreeBSD, OpenBSD
$(SunOS|FreeBSD|OpenBSD):.*:.*
PortCheckInterface = $( /sbin/ifconfig -a| grep 'inet ' |
sed 's/.*t \([0-9.]*\) .*/\1 /' | tr -d '\n';echo )
$end</PRE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CONDITIONALS"
>C.1.2. Conditionals</A
></H2
><P
> Conditional inclusion of entries for some host(s) is supported
via any number of @if.. / @else / @fi directives.
@if.., @else, and @fi must each be on separate lines. Configuration
options in the @if.. (or the optional @else) branch will be read or
ignored depending on the result of the test.</P
><P
> Supported tests are as follows:</P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>hostname_matches</DT
><DD
><P
> <B
CLASS="COMMAND"
>@if hostname_matches <TT
CLASS="REPLACEABLE"
><I
>regex</I
></TT
></B
>
will succeed if the hostname matches the regular expression given.
</P
></DD
><DT
>system_matches</DT
><DD
><P
> <B
CLASS="COMMAND"
>@if system_matches <TT
CLASS="REPLACEABLE"
><I
>regex</I
></TT
></B
>
will succeed if the string sysname:release:machine — i.e.
$(uname -s):$(uname -r):$uname - m) — matches the
regular expression given.
</P
></DD
><DT
>file_exists</DT
><DD
><P
> <B
CLASS="COMMAND"
>@if file_exists <TT
CLASS="REPLACEABLE"
><I
>path</I
></TT
></B
>
will succeed if a file with the given absolute path exists.
Wildcards/regular expression are not supported.
</P
></DD
><DT
>interface_exists</DT
><DD
><P
> <B
CLASS="COMMAND"
>@if interface_exists <TT
CLASS="REPLACEABLE"
><I
>address</I
></TT
></B
>
will succeed if a network interface with the given address exists.
</P
></DD
><DT
>command_succeeds</DT
><DD
><P
> <B
CLASS="COMMAND"
>@if command_succeeds <TT
CLASS="REPLACEABLE"
><I
>command</I
></TT
></B
>
will execute <B
CLASS="COMMAND"
>/bin/sh -c <TT
CLASS="REPLACEABLE"
><I
>command</I
></TT
></B
>
and succeed if the exit status is zero. The PATH environment variable
will be set to "/sbin:/bin:/usr/sbin:/usr/bin:/usr/ucb",
the SHELL variable to "/bin/sh", the IFS variable
to " \t\n", and the TZ variable will be copied from the
startup environment.
<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>No other environment variables will be set</I
></SPAN
>.
</P
></DD
></DL
></DIV
><P
> You can negate a test by saying '@if not ..'. The 'not' may be replaced
by a '!'. The following are all valid: '@if not file_exists /etc/motd',
'@if !file_exists /etc/motd', and '@if ! file_exists /etc/motd'.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Note on backward compatibility</B
></TH
></TR
><TR
><TD
> </TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
> For backward compatibility, instead of
<B
CLASS="COMMAND"
>@if hostname_matches <TT
CLASS="REPLACEABLE"
><I
>hostname</I
></TT
></B
>
you can also say <B
CLASS="COMMAND"
>@<TT
CLASS="REPLACEABLE"
><I
>hostname</I
></TT
></B
>.
</P
><P
> Likewise, instead of
<B
CLASS="COMMAND"
>@if system_matches <TT
CLASS="REPLACEABLE"
><I
>sysname:release:machine</I
></TT
></B
>
you can also say <B
CLASS="COMMAND"
>$<TT
CLASS="REPLACEABLE"
><I
>sysname:release:machine</I
></TT
></B
>.
</P
><P
> Also, the old method of negating by prepending a '!' to
the '@' ('$') is still
supported, as well as the use of '@end' ('$end') instead of '@fi'.
</P
></TD
></TR
></TABLE
></DIV
><PRE
CLASS="PROGRAMLISTING"
> @if hostname_matches foobar
# only read if hostname is 'foobar'
@else
# read if hostname is NOT 'foobar'
@fi
@if not hostname_matches foobar
# not read if hostname is 'foobar'
@fi
@if system_matches Linux:2.6.24-21-generic:i686
# only read if $(uname -s):$(uname -r):$(uname -m)
# matches Linux:2.6.24-21-generic:i686
@fi
@if !system_matches Linux:2.6.24-21-generic:i686
# not read if $(uname -s):$(uname -r):$(uname -m)
# matches Linux:2.6.24-21-generic:i686
@fi </PRE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="command-line-yule.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="files-to-check.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="APPLICATION"
>yule</SPAN
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
> </TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Files to check</TD
></TR
></TABLE
></DIV
><!--#if expr="! ($HTTP_USER_AGENT = /MSIE/)"--><!--#include virtual="/resources/ssi/footer.html"--><!--#endif --></BODY
></HTML
>
|