我遇到了一台 Debian 機器,當嘗試更新軟體包時,拋出了廣泛討論的「GPG 錯誤:http://security.debian.orgwheezy/updates 發布:由於公鑰不可用,無法驗證以下簽章:NO_PUBKEY 8B48AD6246925553」。為了導入目前金鑰,需要安裝 debian-keyring 軟體包。
但由於機器上的金鑰不再有效,我如何確定資料包的內容沒有被竄改?
答案1
如果您排除新增金鑰並使用它,您仍然可以手動驗證 MD5。
Print the md5sum of the Packages file which is listed in the Release file.
sed -n "s,main/binary-i386/Packages$,,p" ftp.us.debian.org_debian_dists_sid_Release
# Print the md5sum of the Packages file itself.
md5sum ftp.us.debian.org_debian_dists_sid_main_binary-i386_Packages
最後,檢查包本身的 MD5 或 SHA 校驗和:
apt-cache show <package_name> | sed -n "s/MD5sum: //p" # Grab the checksum from the APT cache.
md5sum <binary_package_name>.deb # Compare it against the binary package's checksum.