This file is indexed.

/usr/share/doc/samhain/manual.html/signed-files.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
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
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Additional Features &#8212; Signed Configuration/Database Files</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="Calling external programs"
HREF="calling-external-programs.html"><LINK
REL="NEXT"
TITLE="Additional Features &#8212; Stealth"
HREF="stealthmode.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="./docbook.css"></HEAD
><BODY
CLASS="CHAPTER"
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="calling-external-programs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="stealthmode.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="SIGNED-FILES"
></A
>Chapter 8. Additional Features &mdash; Signed Configuration/Database Files</H1
><P
>  Both the configuration file (see <A
HREF="the-configuration-file.html#CONFIGFILE"
>Section C.1</A
>&#62;) and
  the database of file signatures (<A
HREF="databasefile.html"
>Section 5.8</A
>&#62;) 
  may always be cleartext signed
  by GnuGP (<B
CLASS="COMMAND"
>gpg</B
>).
  The <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>recommended</I
></SPAN
> options are:</P
><P
>  <B
CLASS="COMMAND"
>gpg -a --clearsign --not-dash-escaped <TT
CLASS="REPLACEABLE"
><I
>FILE</I
></TT
></B
></P
><P
>  If compiled with support for signatures, 
  <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> will 
  invoke <B
CLASS="COMMAND"
>gpg</B
>
  to verify the signature. To compile with 
  <B
CLASS="COMMAND"
>gpg</B
> support, use the
  option:</P
><P
>  <B
CLASS="COMMAND"
>./configure --with-gpg=/full/path/to/gpg [--with-keyid=0x&lt;hex KeyID&gt;]</B
></P
><P
><P
></P
><UL
><LI
><P
>      The optional argument <B
CLASS="COMMAND"
>--with-keyid=0x&lt;hex KeyID&gt;</B
>
      allows to specify a key ID, if there is more than one key in your keyring.
      This is only used for the installation routine, and for configuring the
      <B
CLASS="COMMAND"
>samhainadmin.pl</B
> convenience script (see below).
    </P
><P
>      The installation routine (&quot;[sudo] make install&quot;) will use
      the keyring of the user running it (in <TT
CLASS="FILENAME"
>~/.gnupg</TT
>)
      for signing. At runtime, <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> will
      use the keyring of the runtime user (usually root) for verification.
    </P
></LI
><LI
><P
>      samhain will check
      that the path to the <B
CLASS="COMMAND"
>gpg</B
> executable is writeable 
      <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>only by trusted users</I
></SPAN
>
      (see <A
HREF="layout.html#DEFTRUST"
>Section 2.10.1</A
>&#62;).
    </P
></LI
><LI
><P
>      The <B
CLASS="COMMAND"
>gpg</B
> program will be called without using the shell,
      with its full path (as compiled in), and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>with an environment 
	that is limited to the HOME variable</I
></SPAN
>.
    </P
></LI
><LI
><P
>      The public key must be in in the subdirectory 
      <TT
CLASS="FILENAME"
>HOME/.gnupg</TT
>, where HOME is the
      home directory of the effective user (usually <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>root</I
></SPAN
>).
    </P
></LI
><LI
><P
>      From the command line, the signature must verify correctly with
      <B
CLASS="COMMAND"
>/path/to/gpg --status-fd 1 --verify <TT
CLASS="REPLACEABLE"
><I
>FILE</I
></TT
></B
>
      when invoked by the effective user of samhain 
      (usually <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>root</I
></SPAN
>).
    </P
></LI
></UL
></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
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>   There is a Perl script <B
CLASS="COMMAND"
>samhainadmin.pl</B
> to 
   facilitate some
   tasks related to the administration of signed configuration and
   database files (see <A
HREF="signed-files.html#SAMHAINADMIN"
>Section 8.1</A
>&#62;).
 </P
></TD
></TR
></TABLE
></DIV
><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
>Caveats</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>   When signing, the option <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>--not-dash-escaped</I
></SPAN
> is
   recommended, because otherwise the database might get corrupted. 
   However, this implies that after a database update, 
   you <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>must</I
></SPAN
> remove the old signature first, before
   re-signing the database. Without 'dash escaping', 
   <SPAN
CLASS="APPLICATION"
>gpg</SPAN
> will not properly handle the old signature.
   See the tip just above.
 </P
><P
>   The environment is limited to the HOME
   variable, since gpg may need it to find the the subdirectory 
   <TT
CLASS="FILENAME"
>HOME/.gnupg</TT
>. 
   If you need LD_LIBRARY_PATH, because your gpg executable relies
   on libraries that are not in the search path of the loader, you
   can either (i) use a wrapper script to set the environment and exec
   gpg (take care not to mess with file descriptors), (ii) update 
   the system loader configuration file, or (iii)
   recompile with loader paths (-Wl,-r&lt;path&gt; or -Wl,-R&lt;path&gt;).
 </P
></TD
></TR
></TABLE
></DIV
><P
>  As signatures on files are only useful as long as you can trust the
  <B
CLASS="COMMAND"
>gpg</B
> executable, the <B
CLASS="COMMAND"
>configure</B
> 
  script will determine the
  TIGER192 <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>checksum</I
></SPAN
> of the <B
CLASS="COMMAND"
>gpg</B
> 
  executable, which will be compiled 
  into <SPAN
CLASS="APPLICATION"
>samhain</SPAN
>. In case of an error, 
  you can specify the checksum by
  hand with:</P
><P
>  <B
CLASS="COMMAND"
>--with-checksum="<TT
CLASS="REPLACEABLE"
><I
>CHECKSUM</I
></TT
>"</B
>
  &mdash; or &mdash;  
  <B
CLASS="COMMAND"
>--without-checksum</B
></P
><P
>  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>CHECKSUM</I
></SPAN
> should be the checksum as printed by</P
><P
>  <B
CLASS="COMMAND"
>gpg --load-extension tiger --print-md TIGER192 <TT
CLASS="REPLACEABLE"
><I
>/path/to/gpg</I
></TT
></B
>
  &mdash; or &mdash;
  <B
CLASS="COMMAND"
>samhain -H <TT
CLASS="REPLACEABLE"
><I
>/path/to/gpg</I
></TT
></B
>
  (the full line of output, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>with spaces</I
></SPAN
>).</P
><P
>  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Example:</I
></SPAN
>
  <B
CLASS="COMMAND"
>--with-checksum="/usr/bin/gpg: 1C739B6A F768C949 FABEF313  5F0B37F5 22ED4A27 60D59664"</B
></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
>WARNING</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>   Compiling in the GnuPG checksum will tie the samhain executable to
   the gpg executable. If you upgrade GnuPG, you will need to re-compile
   samhain. If you don't like this, use 
   <B
CLASS="COMMAND"
>'--with-checksum=no'</B
> 
   (or <B
CLASS="COMMAND"
>'--without-checksum'</B
>, which is equivalent).
 </P
></TD
></TR
></TABLE
></DIV
><P
>  Likewise, it is highly recommended to compile in the 
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>key fingerprint</I
></SPAN
> 
  of the signature key, which then will be verified after checking the 
  signature itself:</P
><P
>  <B
CLASS="COMMAND"
>--with-fp=FINGERPRINT</B
></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
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
><B
CLASS="COMMAND"
>gpg --fingerprint</B
> will only list the fingerprint of
primary keys. If you are signing with a secondary key, you need to repeat
the '--fingerprint' option (i.e. run gpg 
<B
CLASS="COMMAND"
>gpg --fingerprint --fingerprint</B
>) in order to obtain the
fingerprint for the signing (secondary) key. (If you don't know what a 
secondary
key is, then this note is probably irrelevant for you.)</P
></TD
></TR
></TABLE
></DIV
><P
>  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>Example</I
></SPAN
> (spaces in FINGERPRINT do not matter):
  <B
CLASS="COMMAND"
>--with-fp="EF6C EF54 701A 0AFD B86A F4C3 1AAD 26C8 0F57 1F6C"</B
></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
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
><B
CLASS="COMMAND"
>make install</B
> will gpg sign the configuration file
before installation.</P
></TD
></TR
></TABLE
></DIV
><PRE
CLASS="SCREEN"
><SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>./configure --with-gpg=/usr/bin/gpg --with-fp=EF6CEF54701A0AFDB86AF4C31AAD26C80F571F6C</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>make</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>su</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>make install</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>samhain -t init</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>gpg -a --clearsign /var/lib/samhain/samhain_file</KBD
>
<SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>mv /var/lib/samhain/samhain_file.asc /var/lib/samhain/samhain_file</KBD
></PRE
><P
>  <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> will report the 
  signature key owner and the key fingerprint
  as obtained from <B
CLASS="COMMAND"
>gpg</B
>. 
  If both files are present and checked
  (i.e. when checking files against the database), both must be signed with
  the same key. If the verification is successful, 
  <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> will only 
  report the signature on the configuration file. If the verification fails,
  or the key for the configuration file is different from that of the
  database file, an error message will result.</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="SAMHAINADMIN"
>8.1. The samhainadmin script</A
></H1
><P
>   In the subdirectory <TT
CLASS="FILENAME"
>scripts/</TT
> 
   of the source directory you will find
   a Perl script <B
CLASS="COMMAND"
>samhainadmin.pl</B
> to facilitate some
   tasks related to the administration of signed configuration and
   database files (e.g. examine/create/remove signatures). By default,
   this script is <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not installed</I
></SPAN
>.
   </P
><PRE
CLASS="SCREEN"
><SAMP
CLASS="PROMPT"
>bash$</SAMP
> <KBD
CLASS="USERINPUT"
>samhainadmin.pl --help</KBD
>
  samhainadmin.pl { -m F | --create-cfgfile }      [options] [in.cfgfile]
    Sign the configuration file. If in.cfgfile is given, sign it
    and install it as configuration file.

  samhainadmin.pl { -m f | --print-cfgfile }     [options] 
    Print the configuration file to stdout. Signatures are removed.

  samhainadmin.pl { -m D | --create-datafile }     [options] [in.datafile]
    Sign the database file. If in.datafile is given, sign it
    and install it as database file.

  samhainadmin.pl { -m d | --print-datafile }    [options] 
    Print the database file to stdout. Signatures are removed. Use
    option --list to list files in database rather than printing the raw file.

  samhainadmin.pl { -m R | --remove-signature }  [options] file1 [file2 ...]
    Remove cleartext signature from input file(s). The file
    is replaced by the non-signed file.

  samhainadmin.pl { -m E | --sign }              [options] file1 [file2 ...]
    Sign file(s) with a cleartext signature. The file
    is replaced by the signed file.

  samhainadmin.pl { -m e | --examine }           [options] file1 [file2 ...]
    Report signature status of file(s).

  samhainadmin.pl { -m G | --generate-keys }     [options] 
    Generate a PGP keypair to use for signing.

Options:
  -c cfgfile    --cfgfile cfgfile
    Select an alternate configuration file.

  -d datafile   --datafile datafile
    Select an alternate database file.

  -p passphrase --passphrase passphrase
    Set the passphrase for gpg. By default, gpg will ask.

  -p secretkeyring --secretkeyring secretkeyring
    Select an alternate secret keyring for gpg.
    Will use '$ENV{'HOME'}/.gnupg/secring.gpg' by default.

  -l            --list
    List the files in database rather than printing the raw file.

  -v            --verbose
    Verbose output.</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="calling-external-programs.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="stealthmode.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Calling external programs</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Additional Features &mdash; Stealth</TD
></TR
></TABLE
></DIV
><!--#if expr="! ($HTTP_USER_AGENT = /MSIE/)"--><!--#include virtual="/resources/ssi/footer.html"--><!--#endif --></BODY
></HTML
>