1CONFIGSNAP(1) User Commands CONFIGSNAP(1)
2
3
4
6 configsnap - manual page for configsnap 0.20.1
7
9 configsnap [options]
10
12 Record useful system state information, and compare to previous state
13 if run with PHASE containing "post" or "rollback". An optional file,
14 /etc/configsnap/additional.conf, can be provided for extra files, di‐
15 rectories or commands to register during configsnap execution.
16
18 -h, --help
19 show this help message and exit
20
21 -w, --overwrite
22 if phase files already exist in tag dir, remove previously col‐
23 lected data with that tag
24
25 -a, --archive
26 pack output files into a tar archive
27
28 -v, --verbose
29 print debug info
30
31 -V, --version
32 print version
33
34 -s, --silent
35 no output to stdout
36
37 --force-compare
38 Force a comparison after collecting data
39
40 -t TAG, --tag=TAG
41 tag identifer (e.g. a ticket number)
42
43 -d BASEDIR, --basedir=BASEDIR
44 base directory to store output
45
46 -p PHASE, --phase=PHASE
47 phase this is being used for. Can be any string. Phases con‐
48 taining post or rollback will perform diffs
49
50 -C, --compare-only
51 Compare existing files with tags specified with --pre and
52 --phase
53
54 --pre=PRE_SUFFIX
55 suffix for files captured at previous state, for comparison
56
57 -c CONFIG, --config=CONFIG
58 additional config file to use. Setting this will overwrite de‐
59 fault.
60
62 /etc/configsnap/additional.conf
63 Optional configuration file to define additional command output and
64 files to collect.
65
66
67 Commands are all run as root, so the custom collection configuration
68 file must be owned by root and not read or writable by other users. The
69 file format is:
70
71
72 All custom file collections in the additional.conf file must begin with
73 a "[section]" which contains the following options.
74
75
76 Type=
77 Can take values Command, File, or Directory depending on the action
78 that needs to be performed.
79
80 If Type=Command then the output from the specified command will
81 be save to a file named after the section. The command must be
82 specified using the full path to the executable. e.g. /bin/ss
83 -tanp. Command supports several additional configuration op‐
84 tions.
85
86 If Type=File then the specified file will be save to the backup
87 directory with suffix matching the stage. The full path to the
88 file must be used. Type=File supports the same FailOk and Com‐
89 pare options as Command.
90
91 If Type=Directory then the contents of the directory will be a
92 subfolder of the same name within the backup directory. The
93 path to the directory should include a trailing '/'. Directory
94 supports the FailOk, Compare (see Type=Command), and the fol‐
95 lowing.
96
97 Sort=
98 Whether to sort the output of the command, (default: False)
99
100 FailOk=
101 Report errors when configsnap runs this section, (default: False)
102
103 Compare=
104 Produce a diff between the pre/post files when running configsnap,
105 (default: False)
106
107 File_Pattern=
108 Rather than saving every file in a directory, backup only ones
109 matching the Python regex pattern, (default: .*). See Examples be‐
110 low.
111
112 Examples
113
114 # Recording the output of a command into a "psspecial.<phase>" file
115 containing the output.
116 [psspecial]
117 Type: command
118 Command: /bin/ps -aux
119 Compare: True
120
121 # Recording an additional file, stored as "debconf.<phase>"
122 [debconf.conf]
123 Type: file
124 File: /etc/debconf.conf
125 Failok: True
126
127 # Recursively Recording all files from /etc/ssh/ directory, with
128 sub-files appended with ".<phase>".
129 [ssh]
130 Type: directory
131 Directory: /etc/ssh/
132
133 # Recording all files from /etc/fail2ban/ directory matching
134 '.*\.local$', with sub-files appended with ".<phase>"
135 [fail2ban]
136 Type: directory
137 Directory: /etc/fail2ban
138 File_Pattern: .*\.local$
139
140
141
142configsnap 0.20.1 July 2023 CONFIGSNAP(1)