AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 568256
Accepted
Craig Francis
Craig Francis
Asked: 2014-01-19 13:25:33 +0800 CST2014-01-19 13:25:33 +0800 CST 2014-01-19 13:25:33 +0800 CST

在 Debian 机器上审核文件

  • 772

是否可以列出系统上不属于某个包的每个文件?或者他们是否被修改过?

可能需要使用类似的东西:apt-get、apt-files、dpkg-query 等

就上下文而言,假设继承了无法格式化的旧服务器,并且您想检查每个文件是否都应如此...我知道在 Debian 版本之间升级或删除后不会出现这种情况一个没有“--purge”的包,因为它似乎留下了很多(通常是配置)文件。

同样,如果该服务器要更换为新服务器,您要确保所有配置差异(与基本安装相比)已被转移(或如果不再相关则忽略 - 例如添加了胭脂“端口”行到 sshd_config)。

它还有助于确定是否在不使用 apt-get 的情况下安装了任何东西。

ubuntu
  • 4 4 个回答
  • 908 Views

4 个回答

  • Voted
  1. Best Answer
    Zoredache
    2014-01-19T15:16:07+08:002014-01-19T15:16:07+08:00

    通过查看列表可以看到一个包安装的所有文件cat /var/lib/dpkg/info/*.list。大多数软件包都包含文件内容的 md5sums,可以通过查看cat /var/lib/dpkg/info/*.md5sums. 不过,有些套餐不包括这些金额。

    如果您安装软件包 debsums,您可以像debsums -a这样运行该程序将检查所有已安装文件和配置的 md5sum。

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

    同样,如果该服务器要更换为新服务器,您要确保所有配置差异(与基本安装相比)已被转移(或如果不再相关则忽略 - 例如添加了胭脂“端口”行到 sshd_config)。

    我认为你应该在安装系统后首先安装etckeeper包。这个包基本上放入/etc了您选择的版本控制系统(我更喜欢 git)。有了这个,你可以准确地看到什么时候发生了变化。很容易将此存储库克隆到新系统,然后针对新系统进行差异。因此,您可以在单个命令中准确查看源系统和目标系统的不同之处。

    • 5
  2. dfc
    2014-01-20T19:10:08+08:002014-01-20T19:10:08+08:00

    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.
    
    • 2
  3. nodiscc
    2014-01-19T18:17:57+08:002014-01-19T18:17:57+08:00

    除其他外,tiger 和 rkhunter都会报告不属于任何已安装包的文件。

    您可能还想查看自通过包管理器安装以来检查文件是否有修改的debsum 。

    这些程序有很好的手册页,所以在使用前阅读它们应该没问题。

    • 1
  4. Peter Green
    2015-10-19T17:09:46+08:002015-10-19T17:09:46+08:00

    要查看 debian 软件包中的任何非配置文件自软件包以来是否已被修改,您可以使用 debsums。

    查看是否已安装第三方软件包比较棘手,您可能可以将版本号和校验和与 packages.debian.org 中的信息进行比较,但我不确定自动化它会有多困难。

    检查配置文件修改很困难,因为可以通过多种不同方式管理配置文件。如果它们是“conffiles”,那么 dpkg 会知道它们是否被修改,但许多配置文件没有。

    如果服务器保持最新,那么与安装了相同软件包的相同版本的 debian 的全新安装进行交叉比较可能是一个不错的选择。显然,如果您不想更新服务器(我想您可以制作服务器的映像并更新它,但这会打开一罐它自己的蠕虫)。

    • 0

相关问题

  • 无法通过 Ubuntu VPN 访问外部网络

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

  • VirtualBox 上 Ubuntu 的访客优化技巧 [关闭]

  • 外部硬盘上的 virtualbox 虚拟硬盘驱动器(Vista 主机上的 ubuntu 客户机)

  • 如何在 Ubuntu 上挂载 LVM 分区?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve