Record useful system state information, and compare to previous state if run with PHASE containing "post" or "rollback". An optional file, /etc/configsnap/additional.conf, can be provided for extra files, directories or commands to register during configsnap execution.
- -h, --help
show this help message and exit
- -w, --overwrite
if phase files already exist in tag dir, remove previously collected data with that tag
- -a, --archive
pack output files into a tar archive
- -v, --verbose
print debug info
- -V, --version
- -s, --silent
no output to stdout
Force a comparison after collecting data
- -t TAG, --tag=TAG
tag identifer (e.g. a ticket number)
- -d BASEDIR, --basedir=BASEDIR
base directory to store output
- -p PHASE, --phase=PHASE
phase this is being used for. Can be any string. Phases containing post or rollback will perform diffs
- -C, --compare-only
Compare existing files with tags specified with --pre and --phase
suffix for files captured at previous state, for comparison
- -c CONFIG, --config=CONFIG
additional config file to use. Setting this will overwrite default.
Optional configuration file to define additional command output and files to collect.
Commands are all run as root, so the custom collection configuration file must be owned by root and not read or writable by other users. The file format is:
All custom file collections in the additional.conf file must begin with a "[section]" which contains the following options.
Can take values Command, File, or Directory depending on the action that needs to be performed.
If Type=Command then the output from the specified command will be save to a file named after the section. The command must be specified using the full path to the executable. e.g. /bin/ss -tanp. Command supports several additional configuration options.
If Type=File then the specified file will be save to the backup directory with suffix matching the stage. The full path to the file must be used. Type=File supports the same FailOk and Compare options as Command.
If Type=Directory then the contents of the directory will be a subfolder of the same name within the backup directory. The path to the directory should include a trailing '/'. Directory supports the FailOk, Compare (see Type=Command), and the following.
Whether to sort the output of the command, (default: False)
Report errors when configsnap runs this section, (default: False)
Produce a diff between the pre/post files when running configsnap, (default: False)
Rather than saving every file in a directory, backup only ones matching the Python regex pattern, (default: .*). See Examples below.
# Recording the output of a command into a "psspecial.<phase>" file containing the output.
Command: /bin/ps -aux
# Recording an additional file, stored as "debconf.<phase>"
# Recursively Recording all files from /etc/ssh/ directory, with sub-files appended with ".<phase>".
# Recording all files from /etc/fail2ban/ directory matching '.*\.local$', with sub-files appended with ".<phase>"