Skip to content
Search AlmaLinux

This page uses Chinese content. Search opens the Chinese documentation.

    Browse this documentation

    AlmaLinux 10 迁移后包漂移审计:rpm -Va 检测配置偏移

    This content is not available in your language yet.

    在 almalinux:10 容器(aarch64;10.2,rpm 4.19.1.1)中实际执行——rpm -Va 全系统采样、/etc/hosts 追加的负向测试、crontabs 安装+篡改+恢复的标志位对照、dnf history 事务回溯。原始日志——plans/content-expansion/evidence/logs/alma-package-drift.log。

    本页没有实测——真实迁移后的全量审计、生产环境基线比对。

    全新容器的 rpm -Va 输出接近干净(实测仅 6 行非预期差异)。追加一行到 /etc/hosts 后:

    Terminal window
    $ echo "test" >> /etc/hosts
    $ rpm -Va; rpm -V setup
    # 无输出——不报警

    原因:/etc/hosts 属 setup 包但被 fvf(file verification flags)排除在默认校验外。改权限后报 M(MODE 位不受 fvf 排除)。

    Terminal window
    $ dnf install -y crontabs
    $ echo "# tampered" >> /etc/crontab
    $ rpm -V crontabs
    S.5....T. c /etc/crontab
    $ # 恢复原始内容
    $ rpm -V crontabs
    .......T. c /etc/crontab

    S(Size)和 5(MD5)证明内容被修改;恢复后消失。但 T(mtime)即使内容还原也不会消失——这正是审计中”时间戳残留”的意义。

    Terminal window
    $ dnf history list
    ID 命令行 日期 操作 变更
    2 install crontabs 今天 I 1
    1 ... ... I 135 # 镜像构建

    每条事务可通过 dnf history info id“ 获取详细的 Begin/End rpmdb 哈希。

    1. 找记录:rpm -Va 全系统扫描(关注 ..5....T 及以上严重度)
    2. 定位:rpm -qf <文件> 反查所属包
    3. 判断:c(config)类型通常是正常编辑;非 c 类型的 5 标志需要关注
    4. 自动化:cron + rpm -Va | mail -s "drift report" [email protected](文献口径)

    漂移审计常要回答「装到的版本落不落后」:可用第三方聚合 PkgSeek 按包名速查它在 Alma/Rocky/CentOS Stream 各仓库的当期版本(速查工具、非官方源;判断以本机仓库查询的实测为准)。

    • 真实迁移后的全量审计(需生产环境)
    • 生产环境基线比对与差异报告
    • cron 自动化审计的端到端验证