This file is indexed.

/usr/share/doc/samhain/manual.html/calling-external-programs.html is in samhain 3.1.0-7build1.

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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Calling external programs</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="Hooks for External Programs"
HREF="extern.html"><LINK
REL="PREVIOUS"
TITLE="System V message queue"
HREF="system-v-message-queue.html"><LINK
REL="NEXT"
TITLE="Additional Features &#8212; Signed Configuration/Database Files"
HREF="signed-files.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="system-v-message-queue.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 7. Hooks for External Programs</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="signed-files.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="CALLING-EXTERNAL-PROGRAMS"
>7.3. Calling external programs</A
></H1
><P
>  <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> may invoke external programs 
  or scripts in order to implement
  logging capabilities that are not supported by 
  <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> itself (e.g.
  pager support). This section provides an overview of this capability.</P
><P
>  External programs/scripts invoked for logging will receive the
  formatted log message on <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>stdin</I
></SPAN
>. 
  The program should expect
  that <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>stdout</I
></SPAN
> and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>stderr</I
></SPAN
> are 
  closed, and that the
  working directory is the root directory.</P
><P
>	Each external program must be defined in the configuration file,
	in a section starting with the header <B
CLASS="COMMAND"
>[External]</B
>. 
	In addition, <B
CLASS="COMMAND"
>ExternalSeverity</B
> must be set to
	an appropriate threshold in the section <B
CLASS="COMMAND"
>[Log]</B
>.</P
><P
>	Each program definition starts with the line </P
><P
>	<B
CLASS="COMMAND"
>OpenCommand=<TT
CLASS="REPLACEABLE"
><I
>/full/path</I
></TT
></B
></P
><P
>	Options for the program may 
	follow. The definition of an external program 
	is ended (a) when explicitely terminated with the line 
	<B
CLASS="COMMAND"
>CloseCommand</B
>, (b) when the section
	ends, or (c) when another
	<B
CLASS="COMMAND"
>OpenCommand=<TT
CLASS="REPLACEABLE"
><I
>/full/path</I
></TT
></B
>
	line for
	the next command is encountered.</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
>Environment variables</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>   By default, the environment is limited to the TZ (timezone)
   variable. If you need other variables (e.g. LD_LIBRARY_PATH),
   you can set them using the 
   <B
CLASS="COMMAND"
>Setenviron=<TT
CLASS="REPLACEABLE"
><I
>KEY=value</I
></TT
></B
>
   option (see below).
 </P
></TD
></TR
></TABLE
></DIV
><P
><P
></P
><UL
><LI
><P
>	There are
	several places in <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> where 
	external programs may be called.
	Each such place is identified by a <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>type</I
></SPAN
>. 
	Currently, valid types are:
        </P
><P
><P
></P
><UL
><LI
><P
>	  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>log</I
></SPAN
> &mdash; An external logging facility, 
	  which is handled like
	  other logging facilities. The program will receive the
	  logged message on stdin, followed by a newline, followed by
	  the string <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>[EOF]</I
></SPAN
> and another newline.
	  </P
></LI
><LI
><P
>	  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>srv</I
></SPAN
> &mdash; Executed by the server, 
	  whenever the status of a
	  client, as displayed in the HTML status table, has changed.
	  The program will receive the client hostname, the timestamp,
	  and the new status, followed by a newline, followed by
	  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>[EOF]</I
></SPAN
> and another newline. 
	  </P
></LI
></UL
></P
></LI
><LI
><P
>	Any number of external programs may be defined in the
	configuration file. Each external program has a 
	<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>type</I
></SPAN
>, which
	is <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>log</I
></SPAN
> by default. 
	Whenever external programs are called,
	all programs of the appropriate 
	<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>type</I
></SPAN
> are executed.
	The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>type</I
></SPAN
> can be set with 
	<B
CLASS="COMMAND"
>SetType=<TT
CLASS="REPLACEABLE"
><I
>type</I
></TT
></B
>
	</P
></LI
><LI
><P
>	External programs must be on a trusted path 
	(see <A
HREF="layout.html#DEFTRUST"
>Section 2.10.1</A
>&#62;), i.e. must not be 
	writeable by untrusted users.
	</P
></LI
><LI
><P
>	For enhanced security, the (192-bit TIGER) checksum of the
	external program/script may be specified in the configuration
	file:
	<B
CLASS="COMMAND"
>SetChecksum=<TT
CLASS="REPLACEABLE"
><I
>checksum</I
></TT
></B
> 
	(one string, no 
	blanks in checksum)
	</P
></LI
><LI
><P
>	Command line arguments and environment variables for
	each external program are configurable (the default is no
	command line arguments, and a clean environment containing only the TZ (timezone) variable:
	</P
><P
>	<B
CLASS="COMMAND"
>SetCommandline=<TT
CLASS="REPLACEABLE"
><I
>full_command_line</I
></TT
></B
> (full command line starting with
	the name of the program)
	</P
><P
>	<B
CLASS="COMMAND"
>Setenviron=<TT
CLASS="REPLACEABLE"
><I
>KEY=value</I
></TT
></B
>
	</P
></LI
><LI
><P
>	The user whose credentials shall be used, can be specified:
	<B
CLASS="COMMAND"
>SetCredentials=<TT
CLASS="REPLACEABLE"
><I
>username</I
></TT
></B
> 
	</P
></LI
><LI
><P
>	Some filters are available to make the execution of an
	external program dependent on the message content:
	</P
><P
>	<B
CLASS="COMMAND"
>SetFilterNot=<TT
CLASS="REPLACEABLE"
><I
>list</I
></TT
></B
> If any
	regular expression in 'list' matches
	the message, the program is not executed, else
	</P
><P
>	<B
CLASS="COMMAND"
>SetFilterAnd=<TT
CLASS="REPLACEABLE"
><I
>list</I
></TT
></B
> if any
	regular expression in 'list' is
	not matching the message, the program is not executed, else
	</P
><P
>	<B
CLASS="COMMAND"
>SetFilterOr=<TT
CLASS="REPLACEABLE"
><I
>list</I
></TT
></B
> if none
	of the regular expressions in 
	'list' matches the message, the program is not executed.
	</P
><P
>	For all filters, list items can be quoted with single or
	double quotes. It is also possible to use each filter option
	multiple times, although this does not affect the order (not, and, or)
	in which filters are evaluated. A maximum of 32 filter patterns for 
	each of (not, and. or) are supported per defined external program.
	Any filter not defined is not evaluated.
	</P
></LI
><LI
><P
>	It is possible to set a 'deadtime'. Within that 'deadtime', the
	respective external program will be executed only once 
	(if triggered):
	<B
CLASS="COMMAND"
>SetDeadtime=<TT
CLASS="REPLACEABLE"
><I
>seconds</I
></TT
></B
>
	</P
></LI
></UL
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PAGING"
>7.3.1. Example setup for paging</A
></H2
><P
>	The distribution contains two example perl scripts for paging
	and SMS messages (example_pager.pl, example_sms.pl). The paging
	script will page via a web CGI script at www.pagemart.com 
	(obviously will work only for their pagers), the SMS 
	script is for any German 'free SMS' web site that 
	outsources free SMS to
	pitcom (with a suitable query on Google you can find such sites; you
	can then inspect the HTML form to set proper values for the
	required form variables.)</P
><P
>	If you know some Perl, both scripts can be adapted fairly easily to
	other providers. Below is an example setup for calling 
	example_pager.pl as an external logging facility.</P
><PRE
CLASS="PROGRAMLISTING"
>  [External]
  # start definition of first external program
  OpenCommand=/usr/local/bin/example_pager.pl 
    SetType=log 
    # arguments
    SetCommandline=example_pager.pl pager_id 
    # environment 
    SetEnviron=HOME=/home/moses 
    SetEnviron=PATH=/bin:/usr/bin:/usr/local/bin 
    # checksum 
    SetChecksum=FCBD3377B65F92F1701AFEEF3B5E8A80ED4936FD0D172C84 
    # credentials 
    SetCredentials=moses 
    # filter 
    SetFilterOr=POLICY 
    # deadtime 
    SetDeadtime=3600
  #Optional
  CloseCommand </PRE
></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="system-v-message-queue.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="signed-files.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>System V message queue</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="extern.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Additional Features &mdash; Signed Configuration/Database Files</TD
></TR
></TABLE
></DIV
><!--#if expr="! ($HTTP_USER_AGENT = /MSIE/)"--><!--#include virtual="/resources/ssi/footer.html"--><!--#endif --></BODY
></HTML
>