获取 rpm -V 检测到的文件更改的差异

获取 rpm -V 检测到的文件更改的差异

我的安装已被篡改,我想找出到底发生了哪些改变。

我可以跑

rpm -V MY_PACKAGES

它给出了修改文件的列表。现在我正在寻找一种方便的方法来查看与原始 rpm(我拥有)的差异(假设所有文件都有文本内容)。

假设我要处理 ~20 个软件包和 ~200 个已更改的文件,最简单的方法是什么?有没有类似“rpm diff”的东西?

答案1

#
# Install yumdownloader 
#
yum install yum-utils

#
# search modified files (in this case: from pam_ldap)
#
rpm -V pam_ldap
S.5....T.  c /etc/pam_ldap.conf

#
# make tmp-dir and download rpm
#
mkdir Temp
cd Temp
yumdownloader pam_ldap

#
# extract rpm to current folder
#
rpm2cpio pam_ldap-185-11.el6.x86_64.rpm  | cpio -idmv

#
# check diff
#
diff etc/pam_ldap.conf /etc/pam_ldap.conf


rpm -V explained: 

    c %config configuration file.
    d %doc documentation file.
    g %ghost file (i.e. the file contents are not
    included in the package payload).
    l %license license file.
    r %readme readme file.

    S file Size differs
    M Mode differs (includes permissions and file type)
    5 MD5 sum differs
    D Device major/minor number mismatch
    L readLink(2) path mismatch
    U User ownership differs
    G Group ownership differs
    T mTime differs

相关内容