How to generate an MD5sums file of packages

Start by querying the Red Hat package manager

rpm -ql coreutils | grep bin > files1

This gets a listing of all the executables in that rpm, dumping them into a file called files1.

Next, copy the file to a file called “file2”, open up file 2, and go through it, deleting every line that contained a file rkhunter had told you about (there were several executables in coreutils that didn’t get updated as a result of this bugfix).  At this point you have a file with all the files in the package, and a file with the all the files in the package that DIDN’T change. Next, run the following command:

diff file1file2 | grep \< | cut -d \< -f 2 > changedfiles

This command takes all the lines in file1 that aren’t in file2 and dumps them into a file called “changedfiles”.  Unfortunately, it results in a leading whitespace in each line, which can be manually removed since there probably aren’t that many lines.  The number of lines should be equal to the number of files that rkhunter warned you about.

Using this file, run the following bourne shell script to get a checksum of all the files into the file called “md5sums”:

#!/bin/sh

FILELIST=`cat changedfiles`;
for FILE in $FILELIST
do
md5sum $FILE » md5sums
done

Finally, compare the checksums and md5sums against RHN, made sure they were all good.

md5sum -c md5sums | grep -v OK

No news is good news at this point, it means that all the files matched, so go ahead and update rkhunter’s database with the current hash values.

How to generate an MD5sums file of packages

Start by querying the Red Hat package manager

rpm -ql coreutils | grep bin > files1

This gets a listing of all the executables in that rpm, dumping them into a file called files1.

Next, copy the file to a file called “file2”, open up file 2, and go through it, deleting every line that contained a file rkhunter had told you about (there were several executables in coreutils that didn’t get updated as a result of this bugfix).  At this point you have a file with all the files in the package, and a file with the all the files in the package that DIDN’T change. Next, run the following command:

diff file1file2 | grep \< | cut -d \< -f 2 > changedfiles

This command takes all the lines in file1 that aren’t in file2 and dumps them into a file called “changedfiles”.  Unfortunately, it results in a leading whitespace in each line, which can be manually removed since there probably aren’t that many lines.  The number of lines should be equal to the number of files that rkhunter warned you about.

Using this file, run the following bourne shell script to get a checksum of all the files into the file called “md5sums”:

#!/bin/sh

FILELIST=`cat changedfiles`;
for FILE in $FILELIST
do
md5sum $FILE » md5sums
done

Finally, compare the checksums and md5sums against RHN, made sure they were all good.

md5sum -c md5sums | grep -v OK

No news is good news at this point, it means that all the files matched, so go ahead and update rkhunter’s database with the current hash values.

How to generate an MD5sums file of packages

About:

Feralo is the creative portfolio of Noah Spahn. Spahn is a painter with degree in Studio Arts from Biola University, a deep interest in several marked periods of Art History, and Artists ranging from Caravaggio to Immendorf.

His work is typically a veiled glimpse into some facet of his current musings. The mediums used vary as much as their application, whilst the human form is generally the vehicle. Themes may include transcendental aesthetics or the rejection of visceral urges amidst the complexities of commonplace social environs. He has also been known to produce the occasional 'automatic painting', the interpretation of which probably lies in the realm of his unconscious.

During his 25 year career as an Artist, Spahn has worked as a commissioned limner, 3D modeler, architectural draftsman, aerosol muralist, portraitist, graphic designer, creative consultant and advertising director.