# 檢查 RPM 軟體管理系統所安裝的檔案內容一致性 確保服務器未遭受到第三方竄改 [TOC] <https://hackmd.io/@ops-notes-tw/check-rpm-file-consistency> ## 常用操作 ### 檢查所有安裝在系統的軟體包的安裝文件一致性 ``` $ rpm --verify -a S.5....T. c /etc/bashrc S.5....T. c /etc/profile S.5....T. c /etc/sysconfig/rsyncd S.5....T. c /etc/ssh/sshd_config S.5....T. c /etc/sysconfig/authconfig .....U... /var/lib/postfix .....U... /var/spool/postfix/active (以下略) ``` 輸出格式參閱 [rpm --verify 命令輸出說明](#rpm---verify-%E5%91%BD%E4%BB%A4%E8%BC%B8%E5%87%BA%E8%AA%AA%E6%98%8E) 章節的說明 ## `rpm --verify` 命令輸出說明 | 旗標 | 含意 | | :-: | :-- | | 5 | MD5 校驗碼不一致(檔案內容被修改) | | c | 該檔案為一軟體配置檔 | | M | 檔案權限不一致 | | S | 檔案大小不一致 | | T | 檔案修改時間不一致 | ## 參考資料 * [Using RPM to Verify Installed Packages](http://ftp.rpm.org/max-rpm/ch-rpm-verify.html) * [RPM Verification Output Flags[Description]](https://www.distributednetworks.com/redhat-system-admin/module2/rpm-verification-rpm-output-flags.php) 包含 `rpm --verfiy` 命令輸出的說明 --- 本作品為[《維運猿的共同筆記》](https://hackmd.io/@ops-notes-tw/home)的一部分 頁面連結:<https://hackmd.io/@ops-notes-tw/rpm-file-consistency> 授權條款:<https://hackmd.io/@ops-notes-tw/licensing> 參與協作視同將您的貢獻內容以相同的授權條款釋出