Created
September 21, 2016 06:32
-
-
Save MarkusH/9fb1465f92e7b337b8034491e7865b90 to your computer and use it in GitHub Desktop.
Check if GPG key is expiring soon (next 30 days)
This file contains 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
#!/usr/bin/sh | |
test $(($((`gpg --with-colons --fixed-list-mode --list-keys 0xAFE79D68D41C7E39 | egrep '^(pub|sub):' | cut -d: -f7 | sort | head -n 1` - `date +"%s"`))/86400)) -le 30 && echo "expiring soon" || echo "still good" |
Renew key with:
$ gpg --edit-key 0xAFE79D68D41C7E39
gpg> key 0
gpg> expire
Key is valid for? (0) 1y
Is this correct? (y/N) y
gpg> key 1
gpg> expire
Key is valid for? (0) 1y
Is this correct? (y/N) y
gpg> save
$ gpg --send-keys 0xAFE79D68D41C7E39
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Formatted: