Created
March 22, 2017 18:48
-
-
Save mpontillo/5ee50871760526ad439193074ed7648b to your computer and use it in GitHub Desktop.
Check the signature on each downloaded apt Release file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Import apt keys into GPG keyring for ease of use. | |
apt-key list | grep ^/ | xargs -n1 gpg --import > /dev/null 2>&1 | |
bad=0 | |
# Check the signature on each apt list. | |
for file in /var/lib/apt/lists/{*_Release,*_InRelease}; do | |
gpg --verify $file > /dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
let bad=$bad+1 | |
if [ $bad -eq 1 ]; then | |
echo "Could not validate signature on apt list(s):" | |
fi | |
echo " $file" | |
fi | |
if [ $bad -eq 0 ]; then | |
echo "All apt lists validated successfully." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment