This action is performed by the vps-files-md5-check.pl script. It compares info of the package installed files with that of the package metadata stored in the rpm database. Parameters compared are size, MD5 sum, permissions, type, owner, and group of each file.
The --verify option of the RPM Package Manager is used. For reference, please turn to the rpm manual.
Example of usage: Say, the file info has been changed as a result of the box hacking. The script checks the file inside VPS for changes and proposes to copy this file from the host system.
WARNING: We strongly recommend not to overwrite non-binary files, e.g. configs. This may cause the system malfunction.
Before copying, find out which files have been changed by running the script with the listing options.
For help info, run:
# vps-files-md5-check.pl --help
vps-files-md5-check.pl # Check installed files information for changes.
Usage:
vps-files-md5-check.pl --vps=<vps_name>|--root=<directory> [--list|--list-all [--detailed]] [--copy-all]
--vps # <vps_name> - VPS name to check.
--root # <directory> - new root directory to check (packages must be installed with the --root option).
--list # List changed files.
--list-all # List all changed files (config, license, readme, doc, ghost file, etc.).
--detailed # Show file changes.
--copy-all # Do not ask to copy modified file from the host.
--help #Print this help information.
Example:
# ./vps-files-md5-check.pl --vps=vps4.psoft --list-all --detailed
S.5....T c /etc/pam.d/system-auth
%config configuration file.
file Size differs
MD5 sum differs
mTime differs
.......T c /etc/inittab
%config configuration file.
mTime differs
.......T c /etc/mail/sendmail.cf
%config configuration file.
mTime differs
.......T c /etc/krb5.conf
%config configuration file.
mTime differs
S.5....T c /etc/sysconfig/rhn/up2date-uuid
%config configuration file.
file Size differs
MD5 sum differs
mTime differs
In the above example, there are no files to overwrite because all of them are %config configuration files.
In the next example we are changing /bin/true binary:
# ./vps-files-md5-check.pl --vps=vps4.psoft --list-all --detailed
<...>
..5....T /bin/true
MD5 sum differs
mTime differs
<...>
The script shows that MD5 sum for rpm database differs from that of the binary file. To copy the file from the host, run:
# ./vps-files-md5-check.pl --vps=vps4.psoft
Would you like to copy /bin/true from the host [y/n]? y