File: st_snapshot.pod

package info (click to toggle)
systraq 20201231-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,176 kB
  • sloc: sh: 821; makefile: 130
file content (124 lines) | stat: -rw-r--r-- 4,059 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
=pod

=head1 NAME

st_snapshot - calculate checksum and stat ownership and permissions of files

=head1 SYNOPSIS

I<ST_SUM=sha256sum> B<st_snapshot> I<patterns> I<homepatterns>

=head1 DESCRIPTION

st_snapshot calculates checksums and stats ownership and permissions of critical
system files.

This script is typically run in either root-mode or public-mode.  Running this
script in root-mode requires root priviliges.  One is adviced to set up a
dedicated user account for running this script in public mode.

In root-mode, the files snapshot_root.list and snapshot_root.homelist are
typically passed as arguments.  These pattern files are read by the script and
contain names of files and directories; listing a directory in such a pattern
file is equivalent to listing all files which live in the directorytree with
this directory as root.

snapshot_root.list could e.g. read

 # snapshot_root.list - files and directories we wanna get
 # monitored: we wanna get a note once these files, or any file
 # under these directories, gets created, gets rm-ed, gets
 # permissions or contents changed.  these notices will not
 # include the possibly secret contents of these files
 #
 # this file gets read by st_systraq
 /etc/group
 /etc/gshadow
 /etc/hosts.allow
 /etc/hosts.deny
 /etc/hosts.equiv
 /etc/lilo.conf
 /etc/passwd
 /etc/postfix/server.pem
 /etc/shadow
 /etc/skel
 /etc/ssh

Equivalent files snapshot_pub.list and snapshot_pub.homelist should be on the
system.  These files should contain all worldreadable to be monitored files.
This allows for running this script as root I<only> in those cases where it's
needed: when reading files, readable for root only.

The homelist files contain files and directories which should get
monitored for every homedirectory on the system.  snapshot_pub.homelist could
e.g. contain:

 .profile
 .cshrc
 .tcshrc
 .login
 .logout
 .bash_profile
 .bashrc
 .exrc
 .nexrc

As a special case, when the environment variable ST_OPHOMES is set to a
non-empty string (typically when running in public mode), we stat the
permissions on all homedirectories themselves.

The produced snapshot is printed to stdout.  The output when running in
public mode could look like:

 # ownership and permissions of homedirs
 drwxr-xr-x root root /bin
 drwxr-xr-x root root /dev
 drwxr-sr-x root staff /home
 drwxr-sr-x joostvb joostvb /home/joostvb
 drwxr-xr-x root root /usr/sbin
 drwxr-xr-x root root /var
 # sha256sum of critical pub files
 4d3cd13d6dbc10e2e3ccb9477cbc9eb9b76302454c276d5771ae0b10a5fbb4d2  /home/joostvb/.ssh/id_rsa.pub
 eb8d83e0246f761a21bdfb13a03fac634ed7c3b7dde4c2efddd7b2838d32596f  /var/qmail/alias/.bashrc
 4e371f9a11f5a2464d3d5c952e58e24f73b377d33767ed93b2082fcb59a647fe  /etc/zlogin
 # ownership and permissions of critical pub files
 -rw-rw-r-- joostvb joostvb /home/joostvb/.ssh/id_rsa.pub
 -rw-r--r-- joostvb joostvb /home/joostvb/.ssh/authorized_keys

=head1 ENVIRONMENT

ST_OPHOMES - non-empty in case permissions on all homedirectories should
be printed

ST_SUM - command for calculating file checksums.  E.g. sha256sum,
sha512sum, sha384sum, sha224sum or sha1sum.

=head1 SEE ALSO

The systraq manual.

=head1 COPYRIGHT

Copyright (C) 2001, 2002, 2003, 2004, 2008 Joost van Baal
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.

=head1 AUTHOR

Joost van Baal-Ilić <joostvb-systraq-20201231@mdcc.cx>

=cut