Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate remotely SSHFP records
#!/bin/bash
set -e
if [[ "$#" -lt 1 ]]; then
echo "Usage: $0 <hostname or IP address>"
exit
fi
host="$1"
for proto in rsa ecdsa ed25519; do
ssh-keyscan -t $proto "$host" 2>/dev/null |
sed -r 's/^[^ ]+ //' |
ssh-keygen -r "$host" -f /dev/stdin 2>/dev/null |
sed -rn 's/^([^ ]+) IN SSHFP ([1,3-9] [2-9] .*)$/\t\tIN\tSSHFP\t\2/p'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.