File: manual.html

package info (click to toggle)
systraq 20160803-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,176 kB
  • ctags: 23
  • sloc: sh: 813; makefile: 130
file content (1512 lines) | stat: -rw-r--r-- 29,269 bytes parent folder | download | duplicates (2)
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
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>The systraq Manual</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
><BODY
CLASS="article"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="ARTICLE"
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
><A
NAME="AEN2"
>The systraq Manual</A
></H1
><H2
CLASS="subtitle"
>Kanama 2016</H2
><H3
CLASS="author"
><A
NAME="AEN5"
>Joost van Baal</A
></H3
><P
CLASS="copyright"
>Copyright &copy; 2001, 2002, 2003, 2004, 2005, 2016 Joost van Baal</P
><DIV
CLASS="revhistory"
><TABLE
WIDTH="100%"
BORDER="0"
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
COLSPAN="3"
><B
>Revision History</B
></TH
></TR
><TR
><TD
ALIGN="LEFT"
>Revision 20160803</TD
><TD
ALIGN="LEFT"
>Kan  3 2016</TD
><TD
ALIGN="LEFT"
></TD
></TR
><TR
><TD
ALIGN="LEFT"
COLSPAN="3"
></TD
></TR
></TABLE
></DIV
><HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>1. <A
HREF="#AEN23"
>Introduction</A
></DT
><DT
>2. <A
HREF="#AEN43"
>Installation</A
></DT
><DT
>3. <A
HREF="#AEN177"
>Daily Maintenance</A
></DT
><DT
>4. <A
HREF="#AEN193"
>Internals</A
></DT
><DT
>5. <A
HREF="#AEN253"
>Hacking on systraq</A
></DT
><DT
>6. <A
HREF="#AEN297"
>Contact, other tools</A
></DT
></DL
></DIV
><DIV
CLASS="section"
><H2
CLASS="section"
><A
NAME="AEN23"
>1. Introduction</A
></H2
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="AEN25"
>1.1. What is it?</A
></H3
><P
>&#13;
systraq Is a small set of simple scripts monitoring your system, and warning
you when system files change.

      </P
><P
>&#13;
systraq Daily sends you an email listing the state of your system.
Furthermore, if critical files have changed, you'll get an email within a
shorter notice.  It consists of few very small shell scripts.  It's written for
Debian GNU/Linux, but very likely runs on any Unix like operating system.
(Examples and default configuration will likely be somewhat Debian centered,
'though.)

      </P
><P
>&#13;
It can help you keeping your system secure.  However, in case you're planning
to use systraq on a multi user system, make sure you really want to do the
monitoring this script offers: it might not comply with your site's privacy
policy.  Getting informed when users' config file change might be too
intrusive.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN30"
>1.2. Why?</A
></H3
><P
>&#13;
In the early 2000s, I had some *BSD boxes, which regularly mail stuff like:

        <PRE
CLASS="screen"
>&#13;
 checking setuid files and devices:

 checking for uids of 0:
 root 0
 toor 0

 checking for passwordless accounts:

 hille.mdcc.cx login failures:
 Oct 11 11:31:52 hille login: 1 LOGIN FAILURE ON ttyv0
 Oct 11 11:31:52 hille login: 1 LOGIN FAILURE ON ttyv0, .^[^[^[[MS

 hille.mdcc.cx refused connections:

 Disk status:
 Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
 /dev/ad0s1a     39647    27927     8549    77%    /
 /dev/ad0s1f   1016303   857921    77078    92%    /usr
 /dev/ad0s1g   7026508  6219148   245240    96%    /usr/home
 /dev/ad0s1e     19815     6712    11518    37%    /var
 procfs              4        4        0   100%    /proc

 Network interface status:
 Name  Mtu   Network       Address            Ipkts Ierrs    Opkts Oerrs  Coll
 lp0*  1500  &#60;Link#1&#62;                             0     0        0     0     0
 ed0   1500  &#60;Link#2&#62;    00:00:e8:6b:a9:3b   651828  1177  4029190     4 36522

 ======
 /etc/sshd_config diffs (OLD &#60; &#62; NEW)
 ======
 1c1,11
 &#60; #     $OpenBSD: mailer.conf,v 1.3 2000/04/06 18:24:19 millert Exp $
 ---
 &#62; # This is ssh server systemwide configuration file.
 &#62;
 &#62; Port 22
 &#62; #Protocol 2,1

        </PRE
>

On OpenBSD boxes, the shellscripts /etc/daily, /etc/weekly and /etc/monthly
kick off the process to generate these status mails.  The shellscript
/etc/security is called, as well as the <A
HREF="http://www.tac.eu.org/cgi-bin/man-cgi?mtree+8+NetBSD-1.5.1"
TARGET="_top"
>mtree(8)</A
>
command.
    </P
><P
>&#13;
I very much like this system, taking care of the automatic monitoring of my
system.  I run GNU/Linux also, these boxes lacked such a system (tripwire is too
heavyweigth for my demands.)  This system seemed not very portable to
GNU/Linux, unfortunately.  (Which is another way of stating: I'm too lazy to
port the complete system.)

    </P
><P
>&#13;
<A
HREF="http://xidus.xidus.net/"
TARGET="_top"
>Jeremy Weatherford</A
> wrote <A
HREF="http://filetraq.xidus.net/"
TARGET="_top"
>FileTraq</A
> for his Red Hat Linux box.
This small tool could be regarded as a first estimate to what I wanted.  Jeremy
runs it as root, I believe.  I want to avoid that as much as possible.  I do
want to monitor files like /etc/shadow, but I do not want to get the diff
emailed when these change.  I <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>do</I
></SPAN
> want to get a notice if
such a file changes.  <A
HREF="http://lameter.com/"
TARGET="_top"
>Christoph
Lameter</A
>'s <A
HREF="http://packages.debian.org/stable/admin/debsums.html"
TARGET="_top"
>debsums</A
> is a
tool, for monitoring files installed from Debian packages, which has
functionality like this.  On Debian systems, there's checksecurity(8) in
the cron package, which monitors permissions on device files.

    </P
><P
>&#13;
So, I mixed ideas of the BSD 'daily run output' style emails with FileTraq and
some other tools.  That's how systraq came to be.

      </P
></DIV
></DIV
><DIV
CLASS="section"
><HR><H2
CLASS="section"
><A
NAME="AEN43"
>2. Installation</A
></H2
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="AEN45"
>2.1. Requirements</A
></H3
><P
>&#13;
You might need the GNU version of utilities like <B
CLASS="command"
>cut</B
> and
<B
CLASS="command"
>ls</B
>: I've only tested sytraq on a GNU/Linux system.  The
systraq tool works nice with the Debian debsums package; however, systraq is
useful too on systems lacking this package.

      </P
><P
>&#13;
You need <A
HREF="http://xidus.xidus.net/"
TARGET="_top"
>Jeremy Weatherford's</A
>
<A
HREF="http://filetraq.xidus.net/"
TARGET="_top"
>FileTraq</A
>.  However,
beware!  Jeremy no longer seems to maintain FileTraq.  You'll need an up to
date version; the Debian package filetraq &#62;= 0.2-10 by Sergio Talens-Oliag is
fine.

If you are on a Debian system,
you know how to get this.  If you are on another system, you can get <A
HREF="ftp://ftp.debian.org/debian/pool/main/f/filetraq/"
TARGET="_top"
> the Debian filetraq
version from the master ftp site</A
> or from <A
HREF="http://www.debian.org/mirror/list"
TARGET="_top"
>any other mirror</A
>.  Be sure to
at least get the files <TT
CLASS="filename"
>filetraq_0.2.orig.tar.gz</TT
> and
<TT
CLASS="filename"
>filetraq_0.2-10.diff.gz</TT
> (or a later version).  You can
apply the diff with any <B
CLASS="command"
>patch</B
>.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN58"
>2.2. Configure the package (and optionally rebuild documentation)</A
></H3
><P
>&#13;
Run
        <PRE
CLASS="screen"
>&#13; $ ./configure
 $ make
        </PRE
>

This will configure the package (you might want to pass some arguments to
<B
CLASS="command"
>./configure</B
>, see the <TT
CLASS="filename"
>INSTALL</TT
> file).
You won't need typesetting tools: the typesetted documentation is shipped with
the tarball.  If you want to hack on the documentation, you'll need to have the
documentation build tools installed.  After editing documentation sources, just
running <B
CLASS="command"
>./configure</B
> and <B
CLASS="command"
>make</B
> will be
enough to get typesetting from the DocBook XML sources done.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN66"
>2.3. Install scripts and documentation</A
></H3
><P
>&#13;
(If you're upgrading from an old systraq installation, back up your
configuration files in <TT
CLASS="filename"
>/etc/systraq</TT
> and run

        <PRE
CLASS="screen"
>&#13; # make uninstall
        </PRE
>

from within your old unpacked tarball.)

Run

        <PRE
CLASS="screen"
>&#13; # make install
        </PRE
>

This will install <TT
CLASS="filename"
>st_snapshot</TT
>,
<TT
CLASS="filename"
>st_snapshot.hourly</TT
> and <TT
CLASS="filename"
>systraq</TT
> in
<TT
CLASS="filename"
>/usr/sbin</TT
>.  Furthermore, it will install documentation in <TT
CLASS="filename"
>/usr/share/doc/systraq</TT
>.  (Sample)
configuration files will get installed in <TT
CLASS="filename"
>/etc/systraq</TT
> and <TT
CLASS="filename"
>/usr/share/doc/systraq/examples</TT
>.  Helper
scripts will be installed in <TT
CLASS="filename"
>/usr/share/systraq</TT
>.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN80"
>2.4. User account</A
></H3
><P
>&#13;Create a dedicated systraq user account. E.g.
        <PRE
CLASS="screen"
>&#13;# adduser --system --home <TT
CLASS="filename"
>/var/lib/systraq</TT
> --disabled-password --force-badname _systraq
        </PRE
>

This user will read worldreadable files, and write files under <TT
CLASS="filename"
>/var/lib/systraq</TT
>.
Cronjobs will get run as this user, you might want to create a
<TT
CLASS="filename"
>~_systraq/.forward</TT
> (or whatever your MTA uses), to get
these job's output in your mailbox.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN87"
>2.5. Set up configuration files</A
></H3
><DIV
CLASS="section"
><H4
CLASS="section"
><A
NAME="AEN89"
>2.5.1. Introduction</A
></H4
><P
>&#13;
Example configuration files are distributed with this manual.  (On Debian
systems, the examples could be used as reasonable defaults, except for the
filetraq.conf file, which needs to be generated for your particular system.)
All configuration files are line oriented, lines with a leading # are
ignored.  We give some descriptions here.

        </P
></DIV
><DIV
CLASS="section"
><HR><H4
CLASS="section"
><A
NAME="AEN92"
>2.5.2. filetraq.conf</A
></H4
><P
>&#13;
The files listed in <TT
CLASS="filename"
>/etc/systraq/filetraq.conf</TT
> will be
checked by <B
CLASS="command"
>filetraq</B
> for changes in content every half hour.
Diff's will be emailed to the administrator.  The files
<TT
CLASS="filename"
>snapshot_pub.stat</TT
> and
<TT
CLASS="filename"
>snapshot_root.stat</TT
> should be listed here, as well as
<TT
CLASS="filename"
>systraq.sums</TT
> (all these files reside in <TT
CLASS="filename"
>/var/lib/systraq</TT
>).
It is advisable to also list every worldreadable file under <TT
CLASS="filename"
>/etc/</TT
> (and possibly <TT
CLASS="filename"
>/usr/local/etc/</TT
>) here.  You also might like to
list each user's <TT
CLASS="filename"
>~/.ssh/authorized_keys</TT
> here.

        </P
><P
>&#13;
All files listed in <TT
CLASS="filename"
>filetraq.conf</TT
> should exist on your
system, and should be worldreadable.  (You can monitor non-world readable files
in <TT
CLASS="filename"
>/etc/</TT
> by adding them to
<TT
CLASS="filename"
>snapshot_root.list</TT
>).

        </P
><P
>&#13;
You could create <TT
CLASS="filename"
>filetraq.conf</TT
> using this Makefile:

        <PRE
CLASS="screen"
>&#13;filetraq.main.conf:
        echo '# $@: automatically generated' &#62; $@
        find /etc /home/*/.ssh/authorized_keys* -perm -a+r -type f | \
          sort &#62;&#62; $@

filetraq.conf: filetraq.main.conf filetraq.tail.conf
        echo '# $@: generated from $^' | \
          cat - filetraq.main.conf filetraq.tail.conf &#62; $@

.PHONY: filetraq.main.conf
        </PRE
>

where filetraq.tail.conf is
        <PRE
CLASS="screen"
>&#13;#
/etc/systraq/snapshot_pub.list
/etc/systraq/snapshot_pub.homelist
/etc/systraq/snapshot_root.list
/etc/systraq/snapshot_root.homelist
/etc/systraq/filetraq.conf
#
/var/lib/systraq/snapshot_pub.stat
/var/lib/systraq/snapshot_root.stat
/var/lib/systraq/systraq.sums
#
          </PRE
>

; that might get something useful, as a starter.  Be sure to inspect
<TT
CLASS="filename"
>/usr/share/doc/systraq/examples/filetraq.conf</TT
> too.

        </P
><P
>&#13;
You could install the <TT
CLASS="filename"
>Makefile</TT
> in <TT
CLASS="filename"
>/etc/systraq</TT
>.  




        </P
><P
>&#13;
If you don't like filetraq's default diff style, but, like me, prefer unified
diff, do

          <PRE
CLASS="screen"
>&#13;# rm -f /etc/default/filetraq
# ln -s /etc/systraq/filetraq.default /etc/default/filetraq
          </PRE
>

        </P
></DIV
><DIV
CLASS="section"
><HR><H4
CLASS="section"
><A
NAME="AEN118"
>2.5.3. st_snapshots's file lists</A
></H4
><P
>&#13;
Daily, <B
CLASS="command"
>st_snapshot</B
> will check all files as listed in its
configuration files, aka listfiles.  These listfiles are
<TT
CLASS="filename"
>/etc/systraq/snapshot_{pub,root}.list</TT
> and
<TT
CLASS="filename"
>/etc/systraq/snapshot_{pub,root}.homelist</TT
>.  Example
versions of these files are installed in <TT
CLASS="filename"
>/usr/share/doc/systraq/examples</TT
> when running
<B
CLASS="command"
>make install</B
>.  The names of these files are given as the two
arguments of <B
CLASS="command"
>st_snapshot</B
>.

        </P
><P
>&#13;
<TT
CLASS="filename"
>snapshot_pub.list</TT
> Should contain all world readable files
for which we want to monitor existence, ownership, permissions and changes in
content.  It should contain
<TT
CLASS="filename"
>/var/lib/systraq/systraq.sums</TT
> too.
<TT
CLASS="filename"
>snapshot_root.list</TT
> should contain all files which are not
world readable, we want to monitor.
<TT
CLASS="filename"
>snapshot_{pub,root}.homelist</TT
> should contain files we
expect to find in homedirectories of users.  All users homedirectories are
scanned for files listed in these two listfiles.  Think of files like shell
startup scripts and stuff in <TT
CLASS="filename"
>~/.ssh/</TT
> and
<TT
CLASS="filename"
>~/.rhosts</TT
>.  You might want to add
<TT
CLASS="filename"
>.gnupg/revoke.asc</TT
> and
<TT
CLASS="filename"
>.gnupg/secring.gpg</TT
> too.

        </P
><P
>&#13;
If a file listed in a listfile is a directory, all files residing in this
directory, or any subdirectory thereof, gets counted in.  Shell wildcards
are allowed in the listfiles.

        </P
><P
>&#13;
Now create the files <TT
CLASS="filename"
>/etc/systraq/snapshot_{pub,root}.list</TT
>
and <TT
CLASS="filename"
>/etc/systraq/snapshot_{pub,root}.homelist</TT
>, using the
example files.  Once you're happy with the files, follow the instructions in
the next section.

        </P
></DIV
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN140"
>2.6. Inspecting current state of your system, making the first snapshot</A
></H3
><P
>&#13;
Inspect all files listed in the listfiles, and decide wether their content is
OK for your securitypolicy.  Especially, the
<TT
CLASS="filename"
>authorized_keys</TT
> files need inspection.  Once you're happy
with their contents, create the <TT
CLASS="filename"
>/var/lib/systraq</TT
> directory, and make sure the
_systraq user can write to it.  NB: if your copy of the systraq package uses
another useraccount (the Debian package uses account "debian-systraq", e.g.)
<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>that</I
></SPAN
> user should have write-access instead, of course.
Then, run <B
CLASS="command"
>st_snapshot</B
> manually:

        <PRE
CLASS="screen"
>&#13;# su -s /bin/sh _systraq
$ ST_OPHOMES=yes st_snapshot /etc/systraq/snapshot_pub.list \
   /etc/systraq/snapshot_pub.homelist &#62; /var/lib/systraq/snapshot_pub.stat
        </PRE
>

Of course, if your copy of the systraq package uses another useraccount you
should su to that user instead.  And now, run as root:

        <PRE
CLASS="screen"
>&#13;# st_snapshot /etc/systraq/snapshot_root.list \
   /etc/systraq/snapshot_root.homelist &#62; /var/lib/systraq/snapshot_root.stat
        </PRE
>

Inspect the permissions as listed in the output files, and decide wether you're
happy with them.  Check if all files listed should really be on your system.
(One could argue about wether one should have <TT
CLASS="filename"
>~/.netrc</TT
>,
<TT
CLASS="filename"
>~/.rhosts</TT
>, <TT
CLASS="filename"
>~/.ssh/identity</TT
>,
<TT
CLASS="filename"
>~/.shosts</TT
>, <TT
CLASS="filename"
>/etc/exports</TT
>,
<TT
CLASS="filename"
>/etc/*hosts.equiv</TT
> .  Of course, this depends on your
planned use of the system.)  If you're not happy, fix the permissions and
ownerships.  You might like to take a look at <A
HREF="http://www.openbsd.org/cgi-bin/cvsweb/src/etc/security?rev=1.49&#38;content-type=text/x-cvsweb-markup"
TARGET="_top"
>the
OpenBSD <TT
CLASS="filename"
>/etc/security</TT
> script</A
> to get inspiration.

      </P
><P
>&#13;
Make sure you trust all binary files, which are not in vendor-supplied packages
(e.g. stuff in <TT
CLASS="filename"
>/usr/local/bin/</TT
> on
Debian systems), as they are on your system now.  (You could e.g. reinstall
them from trusted sources.)  Once your system is considered safe, generate a file containing
checksums of these files.  You can generate this by running e.g., as user
_systraq,

        <PRE
CLASS="screen"
>&#13;$ find /usr/local/sbin /usr/local/bin /usr/local/lib \
   /usr/local/share -type f -exec sha256sum {} + | \
   sort -k 2 &#62;/var/lib/systraq/systraq.sums
        </PRE
>

      </P
><P
>&#13;
Make sure you trust all files in your <TT
CLASS="filename"
>filetraq.conf</TT
> file,
and create the directory <TT
CLASS="filename"
>/var/lib/systraq/filetraq/</TT
>.  Then run, as user
_systraq,

        <PRE
CLASS="screen"
>&#13;$ filetraq /etc/systraq/filetraq.conf \
    /var/lib/systraq/filetraq
        </PRE
>
to create the first filetraq backup.
      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN164"
>2.7. Setting up cronjob</A
></H3
><P
>&#13;
The <TT
CLASS="filename"
>systraq-<TT
CLASS="replaceable"
><I
>version</I
></TT
>/etc/systraq</TT
>
file is installed as <TT
CLASS="filename"
>/etc/cron.d/systraq</TT
>.  (If your cron
doesn't look in this directory (but <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>has</I
></SPAN
> support for
<TT
CLASS="filename"
>cron.d</TT
> style directories), then activate
it by doing

        <PRE
CLASS="screen"
>&#13;# ln -s /etc/cron.d/systraq /etc/cron.d/systraq
        </PRE
>

.) This makes sure <B
CLASS="command"
>filetraq</B
> gets run every half hour,
<B
CLASS="command"
>systraq</B
> gets run daily, and the systraq status files get
updated by running <B
CLASS="command"
>st_snapshot</B
>, using the
<B
CLASS="command"
>st_snapshot.hourly</B
> wrapper, each hour.

      </P
></DIV
></DIV
><DIV
CLASS="section"
><HR><H2
CLASS="section"
><A
NAME="AEN177"
>3. Daily Maintenance</A
></H2
><P
>&#13;
When a user is added to the system: update <TT
CLASS="filename"
>filetraq.conf</TT
>
with this user's <TT
CLASS="filename"
>authorized_keys</TT
>.

    </P
><P
>&#13;
<TT
CLASS="filename"
>filetraq.conf</TT
> needs maintenance also once files listed
there have been removed by system upgrades, or once files have been added to
e.g. <TT
CLASS="filename"
>/etc/</TT
>.

    </P
><P
>&#13;
In case Debian packages are installed with missing
<TT
CLASS="filename"
>/var/lib/dpkg/info/*.md5sums</TT
> file, things break.  Consult
the examples section in the debsums manpage, for a hint on how to deal with
these broken packages.  Alternatively, one can do:

      <PRE
CLASS="screen"
>&#13;debsums -s &#62; /tmp/sums 2&#62;&#38;1
grep 'no md5sums for' /tmp/sums | awk '{print $5}' &#62; /tmp/pkgs
      </PRE
>

check the contents of <TT
CLASS="filename"
>/tmp/pkgs</TT
>.

      <PRE
CLASS="screen"
>&#13;apt-get update
apt-get --reinstall install `cat /tmp/pkgs`
debsums --silent --generate=missing,keep `cat /tmp/pkgs`
apt-get clean
      </PRE
>
    </P
><P
>&#13;
When installing or upgrade stuff in <TT
CLASS="filename"
>/usr/local</TT
>, be sure to
update <TT
CLASS="filename"
>/var/lib/systraq/systraq.sums</TT
> with
the correct checksums.

    </P
></DIV
><DIV
CLASS="section"
><HR><H2
CLASS="section"
><A
NAME="AEN193"
>4. Internals</A
></H2
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="AEN195"
>4.1. Files used</A
></H3
><P
>&#13;
We list all files used by the systraq system, along with a short description
of their role.

        <P
></P
><DIV
CLASS="variablelist"
><P
><B
>Files used</B
></P
><DL
><DT
><TT
CLASS="filename"
>/var/lib/systraq</TT
></DT
><DD
><P
>homedir of _systraq user.</P
></DD
><DT
><TT
CLASS="filename"
>/var/lib/systraq</TT
></DT
><DD
><P
>&#13;stores systraq status files, should be writable by _systraq user.
            </P
></DD
><DT
><TT
CLASS="filename"
>&#13;                /var/lib/systraq/snapshot_pub.stat
            </TT
>, <TT
CLASS="filename"
>&#13;                /var/lib/systraq/snapshot_root.stat
            </TT
></DT
><DD
><P
>&#13;
stdout of <B
CLASS="command"
>st_snapshot</B
>, listing permissions, ownership and
checksums of some files, both publicly readable, as well as non-world readable.

            </P
></DD
><DT
><TT
CLASS="filename"
>&#13;                /etc/systraq/filetraq.conf
            </TT
></DT
><DD
><P
>&#13;
configuration file for <B
CLASS="command"
>filetraq</B
>, listing files to get
monitored.

            </P
></DD
><DT
><TT
CLASS="filename"
>/etc/systraq/snapshot_pub.list</TT
>, <TT
CLASS="filename"
>/etc/systraq/snapshot_root.list</TT
>, <TT
CLASS="filename"
>/etc/systraq/snapshot_pub.homelist</TT
>, <TT
CLASS="filename"
>/etc/systraq/snapshot_root.homelist</TT
></DT
><DD
><P
>&#13;
configutation files for <B
CLASS="command"
>st_snapshot</B
>, listing both publicly
readable, as well as non-world readable files to get monitored, as well as
files to be found in homedirectories.  Script
<B
CLASS="command"
>st_snapshot.hourly</B
> passes these to
<B
CLASS="command"
>st_snapshot</B
> in its two arguments.

            </P
></DD
><DT
><TT
CLASS="filename"
>/var/lib/systraq/systraq.sums</TT
></DT
><DD
><P
>&#13;
checksums of binary files not in Debian packages, verified by running
<B
CLASS="command"
>systraq</B
>.

            </P
></DD
></DL
></DIV
>
      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN244"
>4.2. Dependencies</A
></H3
><P
>&#13;
FIXME: diagram listing dependencies: what calls what, what reads and writes
what.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN247"
>4.3. The systraq scripts</A
></H3
><P
>&#13;
The <B
CLASS="command"
>systraq</B
>, <B
CLASS="command"
>st_snapshot</B
> and
<B
CLASS="command"
>st_snapshot.hourly</B
> scripts come with their own manpages,
distributed with this manual.

      </P
></DIV
></DIV
><DIV
CLASS="section"
><HR><H2
CLASS="section"
><A
NAME="AEN253"
>5. Hacking on systraq</A
></H2
><P
>&#13;
Some hints for those who'd like to hack the systaq software.  This section is only
interesting for software developers.

    </P
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN256"
>5.1. Version Control</A
></H3
><P
>&#13;
Systraq is maintained using git on Debian's Alioth, in the <A
HREF="https://wiki.debian.org/Alioth/PackagingProject"
TARGET="_top"
>collab-maint</A
>
project.  If you have access, you should be able to do:

<PRE
CLASS="screen"
>&#13; $ git clone ssh+git://git.debian.org/git/collab-maint/systraq.git
</PRE
>

If you don't have git write access, you can check <A
HREF="http://anonscm.debian.org/gitweb/?p=collab-maint/systraq.git"
TARGET="_top"
>http://anonscm.debian.org/gitweb/?p=collab-maint/systraq.git</A
>
for readonly Web access; or do

<PRE
CLASS="screen"
>&#13; $ git clone git://anonscm.debian.org/collab-maint/systraq.git
</PRE
>

for access using your git client.  Commit messages get sent to a Debian <A
HREF="https://packages.qa.debian.org/"
TARGET="_top"
>Package Tracking System</A
> mailing
list.  See <A
HREF="https://www.debian.org/doc/manuals/developers-reference/resources.html#pkg-tracking-system"
TARGET="_top"
>https://www.debian.org/doc/manuals/developers-reference/resources.html#pkg-tracking-system</A
>
for more information.

    </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN265"
>5.2. Generating .tar.gz from version control</A
></H3
><P
>&#13;
If you'd like rebuild documentation, e.g. for creating a new .tar.gz release,
you'll need the tools listed below.

      </P
><P
>&#13;
You need the SGML Declaration for XML 1.0 for building.  On Debian systems,
this is installed as <TT
CLASS="filename"
>/usr/share/sgml/declaration/xml.dcl</TT
>.
<B
CLASS="command"
>./configure</B
> will give you hints on what to do if it fails
to find this file.

      </P
><P
>&#13;
You need the <A
HREF="http://docbook.sourceforge.net/projects/xsl/"
TARGET="_top"
>DocBook
XSL stylesheet</A
> for manpages for building.  On Debian systems, this is
installed as
<TT
CLASS="filename"
>/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl</TT
>.
<B
CLASS="command"
>./configure</B
> will give you hints on what to do if it fails to
find this file.

      </P
><P
>&#13;
You need an XSLT engine for building.  By default, systraq tries to find <A
HREF="http://xmlsoft.org/XSLT/"
TARGET="_top"
>xsltproc</A
> from Daniel Veillard.  This
package is shipped with many GNU/Linux and BSD distributions.  Alternatively,
<A
HREF="http://saxon.sourceforge.net/"
TARGET="_top"
>Saxon</A
>, written in Java, from
Michael Kay or <A
HREF="http://xmlxslt.sourceforge.net/"
TARGET="_top"
>XML::XSLT</A
>,
written in Perl, from Geert Josten, Egon Willighagen e.a. might work for you.
However, you'd have to hack systraq's <TT
CLASS="filename"
>man/Makefile.am</TT
> to
use these.

      </P
><P
>&#13;
You need <A
HREF="http://openjade.sourceforge.net/"
TARGET="_top"
>OpenJade</A
>, as
maintained by Castle, Clasen, Ibach, Martin, Nilsson e.a. to typeset this
manual.  OpenJade is shipped with many GNU/Linux and BSD distributions.
Alternatively, you can use <A
HREF="http://jclark.com/"
TARGET="_top"
>James
Clark</A
>'s <A
HREF="http://jclark.com/jade/"
TARGET="_top"
>Jade</A
> from <A
HREF="ftp://ftp.jclark.com/pub/jade/"
TARGET="_top"
>ftp://ftp.jclark.com/pub/jade/</A
>.
Beware: there hasn't been a Jade release between October 1998 (1.2.1) and
October 2004.  You might need Debian patches: The Debian package has had
patches applied on 8 Jun 2004 and maybe later.  So you're likely better off
using OpenJade: upstream for this extension of Jade was alive at 2004-09.  The
<B
CLASS="command"
>./configure</B
> script will pick whatever is available on your
system.
      </P
><P
>&#13;
Furthermore, you need <B
CLASS="command"
>jadetex</B
> and
<B
CLASS="command"
>pdfjadetex</B
> as shipped with <A
HREF="http://jadetex.sourceforge.net/"
TARGET="_top"
>JadeTex</A
> (and with many GNU/Linux
and BSD distributions) to generate PostScript and PDF from this document.

      </P
><P
>&#13;
You need TeX's <B
CLASS="command"
>dvips</B
> to generate PostScript from JadeTex's
DVI.  If it's not included with your system, get it from the
<A
HREF="http://www.tug.org/texlive/"
TARGET="_top"
>TeX Live distribution</A
>.

      </P
><P
>&#13;
Finally, you need <A
HREF="http://w3m.sourceforge.net/"
TARGET="_top"
>w3m</A
> to
convert HTML output to plain ascii.  If <B
CLASS="command"
>./configure</B
> doesn't
find w3m on your system, it'll use <A
HREF="http://lynx.isc.org/release/"
TARGET="_top"
>Lynx</A
>.  Both text-browsers are
shipped with many GNU/Linux and BSD distributions.

      </P
></DIV
></DIV
><DIV
CLASS="section"
><HR><H2
CLASS="section"
><A
NAME="AEN297"
>6. Contact, other tools</A
></H2
><DIV
CLASS="section"
><H3
CLASS="section"
><A
NAME="AEN299"
>6.1. Contact information, reporting bugs</A
></H3
><P
>&#13;If you have any questions or
remarks about systraq, you can mail the author at <CODE
CLASS="email"
>&#60;<A
HREF="mailto:joostvb-systraq-20151105@mdcc.cx"
>joostvb-systraq-20151105@mdcc.cx</A
>&#62;</CODE
>.
You can also use this address for reporting bugs (reading  the <A
HREF="http://www.catb.org/~esr/faqs/smart-questions.html"
TARGET="_top"
>How To Ask Questions
The Smart Way</A
> document before reporting might be useful) .  However, if
the bug you've found is present in the systraq Debian package too, please use
the <A
HREF="http://www.debian.org/Bugs/Reporting"
TARGET="_top"
>Debian Bug Tracking
System</A
> for reporting.

      </P
></DIV
><DIV
CLASS="section"
><HR><H3
CLASS="section"
><A
NAME="AEN305"
>6.2. Similar tools</A
></H3
><P
>&#13;
        I believe <A
HREF="http://packages.debian.org/unstable/admin/diffmon.html"
TARGET="_top"
>diffmon</A
>
does about the same as this tool.

    </P
><P
>&#13;
<A
HREF="http://oss.sgi.com/projects/fam/"
TARGET="_top"
>FAM</A
> (File Alteration
Monitor) could be used by systraq (instead of cron): it is for a particular
process to "subscribe" to changes to a file / directory. FAM then implements
the system-dependent best way to do that (e.g. dnotify on modern Linux) and, if
more than one process is interested in the same file, centralises the polling
(if polling is necessary), so that less resources are taken in total.

    </P
><P
>&#13;
<A
HREF="http://aide.sf.net/"
TARGET="_top"
>Aide</A
> and <A
HREF="http://osiris.shmoo.com/"
TARGET="_top"
>Osiris</A
> are big packages for use in sites
where demands are high.

      </P
></DIV
></DIV
></DIV
></BODY
></HTML
>