Skip to content

Instantly share code, notes, and snippets.

@webernetz webernetz/grabsshfp.sh forked from oskar456/grabsshfp.sh
Last active Jan 17, 2019

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"
TMPFILE="$(mktemp /var/tmp/sshfp.XXXXXX)"
trap 'rm -f ${TMPFILE}' INT TERM EXIT
for proto in rsa dsa ecdsa ed25519; do
ssh-keyscan -t $proto "$host" > ${TMPFILE} 2>/dev/null
[[ ! -s "${TMPFILE}" ]] && continue
sed -ri 's/^[^ ]+ //' ${TMPFILE}
ssh-keygen -r "$host" -f ${TMPFILE}
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.