Skip to content

Instantly share code, notes, and snippets.

@felipealfonsog
Created March 30, 2024 04:35
Show Gist options
  • Save felipealfonsog/4b941a321d55d94abf9972bcb1e12f97 to your computer and use it in GitHub Desktop.
Save felipealfonsog/4b941a321d55d94abf9972bcb1e12f97 to your computer and use it in GitHub Desktop.
#!/bin/bash
gpg --check-trustdb 2>&1| grep 'not found' | awk '{print $8}' >bad-keys.txt
gpg --export-ownertrust > ownertrust-gpg.txt
mv ~/.gnupg/trustdb.gpg ~/.gnupg/trustdb.gpg-broken
for KEY in `cat bad-keys.txt` ; do sed -i "/$KEY/d" ownertrust-gpg.txt ; done
gpg --import-ownertrust ownertrust-gpg.txt
rm bad-keys.txt ownertrust-gpg.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment