Last active
August 18, 2019 05:03
-
-
Save edef1c/eab037000a171b0e94b29fa587f4a844 to your computer and use it in GitHub Desktop.
convert PGP authentication subkeys to OpenSSH authorized_keys format, discarding expiry information
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/env bash | |
set -ue | |
if [ $# -ne 1 ]; then | |
echo "usage: $0 [exact PGP user ID]" | |
exit 255 | |
fi | |
gpg --with-colons -k "=$1" |\ | |
awk -F: '$1 == "sub" && $2 ~ /^[fu]$/ && $12 ~ /a/ { getline; print $10"!" }' |\ | |
xargs -rL1 gpg --export-ssh-key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment