/usr/share/doc/samhain/manual.html/suidchk.html is in samhain 3.1.0-5ubuntu1.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Checking the file system for SUID/SGID binaries</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="UP"
TITLE="Configuring samhain, the host integrity monitor"
HREF="file-monitor.html"><LINK
REL="PREVIOUS"
TITLE="The file signature database"
HREF="databasefile.html"><LINK
REL="NEXT"
TITLE="Detecting Kernel rootkits"
HREF="kerneldef.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="./docbook.css"></HEAD
><BODY
CLASS="SECT1"
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="databasefile.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Configuring <SPAN
CLASS="APPLICATION"
>samhain</SPAN
>, the host integrity monitor</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="kerneldef.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="SUIDCHK"
>5.9. Checking the file system for SUID/SGID binaries</A
></H1
><P
> To compile with support for this option, use the configure option </P
><P
> <B
CLASS="COMMAND"
>./configure --enable-suidcheck</B
></P
><P
> If enabled, this will cause the samhain daemon to check the whole
file system hierarchy for SUID/SGID files at user-defined intervals,
and to report on any
that are not
included in the file database. Upon database initialization, all
SUID/SGID files will automatically be included in the database.
Excluded are nfs, proc, msdos, vfat,
and iso9660 (CD-ROM) file systems, as well as file systems mounted
with the 'nosuid' options (the latter is not supported on all OSes, but
at least on Linux). </P
><P
> On Linux, files that are marked as candidates
for mandatory locking (group-id bit set, group-execute bit cleared)
will be ignored.</P
><P
> You can manually exclude one
directory (see below); this should be used only for obscure problems
(e.g.: /net/localhost on Solaris - the automounter will mirror the
root directory twice, as '/net/localhost' and
'/net/localhost/net/localhost', and any nfs file system in '/' will
be labelled as ufs system in '/net/localhost/net/localhost' …).</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
> The SUID check is very I/O expensive. Using 'nice' may not
help, if the CPU is waiting for I/O all the time anyway.
To limit the load, the following options are provided:
</P
><P
> You can <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>schedule</I
></SPAN
>
execution at fixed times with
<B
CLASS="COMMAND"
>SuidCheckSchedule=<TT
CLASS="REPLACEABLE"
><I
>schedule</I
></TT
></B
>.
</P
><P
> You can <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>limit I/O</I
></SPAN
> with
the <B
CLASS="COMMAND"
>SuidCheckFps=<TT
CLASS="REPLACEABLE"
><I
>fps</I
></TT
></B
>
option (fps: files per second).
</P
><P
> As an alternative to the <B
CLASS="COMMAND"
>SuidCheckFps</B
> option,
you can use <B
CLASS="COMMAND"
>SuidCheckYield=<TT
CLASS="REPLACEABLE"
><I
>yes</I
></TT
></B
>.
This will cause the SuidCheck module to yield its time slice after each
file. If <B
CLASS="COMMAND"
>SuidCheckYield</B
> is used, the
<B
CLASS="COMMAND"
>SuidCheckFps</B
> option will not take effect.
</P
><P
> The schedule should have the same syntax as a crontab entry (see
crontab(5) and example
below), with the following exceptions: (a) lists are not allowed,
and (b) ranges of names are allowed. If a schedule is given,
the <B
CLASS="COMMAND"
>SuidCheckInterval</B
> option will not take effect.
You can specify a list of schedules with successive SuidCheckSchedule=...
directives.
</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="SUIDCHK-QUARANTINE"
>5.9.1. Quarantine SUID/SGID files</A
></H2
><P
> As of version 1.8.4, it is possible to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>quarantine</I
></SPAN
>
new SUID/SGID files detected by <SPAN
CLASS="APPLICATION"
>samhain</SPAN
>.
To use this option, you must first enable it with
<B
CLASS="COMMAND"
>SuidCheckQuarantineFiles=<TT
CLASS="REPLACEABLE"
><I
>yes</I
></TT
></B
>.
This tells the SuidCheck module
to quarantine any SUID/SGID files found after the initialization of the
database using the method selected in
<B
CLASS="COMMAND"
>SuidCheckQuarantineMethod</B
> (see next paragraph). If
this is used, the file will be logged each time it is found and not
added to the memory resident database.</P
><P
> You must also choose a method to be used to quarantine a
SUID/SGID file:
<B
CLASS="COMMAND"
>SuidCheckQuarantineMethod=<TT
CLASS="REPLACEABLE"
><I
>0/1/2</I
></TT
></B
>.
Currently, there are 3 methods implemented:
0 - Delete the file from the system.
1 - Remove the SUID/SGID permissions from the file.
2 - Move the SUID/SGID file to a quarantine directory. The quarantine
directory is <TT
CLASS="FILENAME"
>DEFAULT_DATAROOT/.quarantine</TT
>.
Each file moved there has an
additional file created that contains information about the SUID/SGID
file. For example, if a file <TT
CLASS="FILENAME"
>/foo</TT
> is an
unauthorized SUID/SGID file,
then it will be removed and moved to
<TT
CLASS="FILENAME"
>/var/lib/samhain/.quarantine</TT
> and
another file, <TT
CLASS="FILENAME"
>foo.info</TT
>, will be created in
<TT
CLASS="FILENAME"
>/var/lib/samhain/.quarantine</TT
>
with information about <TT
CLASS="FILENAME"
>/foo</TT
>.</P
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Important remarks</B
></TH
></TR
><TR
><TD
> </TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
> Methods 0 and 2 will by default not remove the original file, but
rather truncate to zero size and remove suid/sgid properties. If you
really want to remove the original file rather than truncate,
you need to set the option
<B
CLASS="COMMAND"
>SuidCheckQuarantineDelete=<TT
CLASS="REPLACEABLE"
><I
>yes</I
></TT
></B
>
</P
><P
> The rationale for this behaviour is that removing a file in an arbitrary
directory is considered to be <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>dangerous</I
></SPAN
>, because the
object that is unlinked may not be the same object anymore that has been
determined to be a suid/sgid file before. You have been warned.
</P
><P
> For additional security, samhain will recursively chdir into the parent
directory of the file to make sure there are no symlinks in the path. Also,
a file will not be truncated if it is a hardlink to another one.
</P
><P
> No quarantining will be done if samhain is run in 'update' mode, since
it is assumed that the current filesystem state is ok, and the database
should be updated to reflect the current state.
</P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="SUIDCHK-CONFIG"
>5.9.2. Configuration</A
></H2
><P
> This facility is configured in the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>SuidCheck</I
></SPAN
>
section of the
configuration file.
</P
><P
> <PRE
CLASS="PROGRAMLISTING"
> [SuidCheck]
# activate (0 for switching off)
SuidCheckActive=1
# interval between checks (in seconds, default 7200)
# SuidCheckInterval=86400
# scheduled check at 01:30 each night
SuidCheckSchedule=30 1 * * *
# this is the severity (see <A
HREF="basic-configuration.html#SEVERITYDEF"
>Section 4.1.1</A
>>)
SeveritySuidCheck=crit
# you may manually exclude one directory
SuidCheckExclude=/net/localhost
#
# limit on files per seconds
SuidCheckFps=250
# alternatively yield time slice after each file
# SuidCheckYield=yes
#
# Quarantine detected SUID/SGID files
# SuidCheckQuarantineFiles=no
#
# Quarantine Method
# 0 - Delete the file from the system.
# 1 - Remove the SUID/SGID permissions from the file.
# 2 - Move the SUID/SGID file to a quarantine directory.
# The quarantine directory is DEFAULT_DATAROOT/.quarantine.
# SuidCheckQuarantineMethod = 1
#
# Really delete if using methods 0 or 2
# SuidCheckQuarantineDelete = no
</PRE
>
</P
></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="databasefile.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="kerneldef.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The file signature database</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="file-monitor.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Detecting Kernel rootkits</TD
></TR
></TABLE
></DIV
><!--#if expr="! ($HTTP_USER_AGENT = /MSIE/)"--><!--#include virtual="/resources/ssi/footer.html"--><!--#endif --></BODY
></HTML
>
|