在Debian框中审核文件

是否有可能列出系统中不属于包的每个文件? 或者如果他们被修改?

可能需要使用类似于:apt-get,apt-files,dpkg-query等

对于上下文来说,想象一下inheritance一个无法格式化的旧服务器,并且想要检查每个文件是否应该是这样的…我知道在Debian版本之间升级或者在删除之后不会这样一个没有“–purge”的软件包,因为它似乎将(典型的configuration)文件分配在后面。

同样,如果该服务器将被replace为新的服务器,则要确保所有的configuration差异(与基本安装相比)已经被转移(或者如果不再相关,则被忽略 – 例如添加了“胭脂”“端口”到sshd_config)。

如果没有使用apt-get,也可以确定是否安装了任何东西。

所有由软件包安装文件可以通过查看列表cat /var/lib/dpkg/info/*.list来看到。 大多数软件包都包含文件内容的md5sums,可以通过查看cat /var/lib/dpkg/info/*.md5sums来看到。 有些软件包虽然没有包含这些数字。

如果你安装debsums软件包,你可以像debsums -a一样运行程序debsums -a这将检查所有安装的文件和configuration的md5sum。

请注意,某些软件包不会安assembly置文件或内容。 相反,这些文件是在安装时由这些软件包创build的。 这些文件将不在与软件包或md5sums列表关联的文件列表中。 就包系统而言,这些是它不拥有的数据文件。

同样,如果该服务器将被replace为新的服务器,则要确保所有的configuration差异(与基本安装相比)已经被转移(或者如果不再相关,则被忽略 – 例如添加了“胭脂”“端口”到sshd_config)。

我想你应该在安装系统后首先安装etckeeper软件包。 这个软件包基本上把/etc放入你select的版本控制系统(我更喜欢git)。 有了这个,你可以看到什么时候改变。 把这个仓库克隆到一个新的系统很容易,然后对新系统进行区分。 所以你可以在一个命令中看到源和目标系统究竟有什么不同。

cruft / etckeeper / debsums

 Package: cruft Description-en: program that finds any cruft built up on your system cruft is a program to look over your system for anything that shouldn't be there, but is; or for anything that should be there, but isn't.. It bases most of its results on dpkg's database, as well as a list of `extra files' that can appear during the lifetime of various packages. cruft is still in pre-release; your assistance in improving its accuracy and performance is appreciated. Package: debsums Description-en: tool for verification of installed package files against MD5 checksums debsums can verify the integrity of installed package files against MD5 checksums installed by the package, or generated from a .deb archive. Package: etckeeper Description-en: store /etc in git, mercurial, bzr or darcs The etckeeper program is a tool to let /etc be stored in a git, mercurial, bzr or darcs repository. It hooks into APT to automatically commit changes made to /etc during package upgrades. It tracks file metadata that version control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It's quite modular and configurable, while also being simple to use if you understand the basics of working with version control. 

tiger和rkhunter都会报告不属于任何已安装软件包的文件。

你可能也想看看debsums ,它们通过包pipe理器检查修改后的文件。

这些程序有相当不错的手册页,所以在使用前阅读它们,你应该没问题。

为了查看debian软件包中的任何非configuration文件是否已经被修改,可以使用debsums。

看看是否安装了第三方软件包是比较棘手的,你可能会比较一些来自packages.debian.org的信息的数字和校验和,但是我不确定自动化是多么的困难。

检查configuration文件的修改是很困难的,因为configuration文件可以以多种不同的方式进行pipe理。 如果它们是“conffiles”,那么dpkg会知道它们是否被修改,但许多configuration文件不是。

如果服务器保持最新状态,那么与安装相同软件包的相同版本的debian进行交叉比较可能是一个不错的select。 显然,如果你不想更新服务器,那么效果并不好(我想你可以把服务器映射成一个映像,然后更新它,但是这样会打开一大堆蠕虫)。