Skip to content

Instantly share code, notes, and snippets.

@Maffsie
Created January 17, 2015 15:27
Show Gist options
  • Save Maffsie/67750e84a32060ab0d8d to your computer and use it in GitHub Desktop.
Save Maffsie/67750e84a32060ab0d8d to your computer and use it in GitHub Desktop.
generate SSHFP records
ssh-keyscan -t dsa,rsa,ecdsa hostname 2>/dev/null|perl -MMIME::Base64 -MDigest::SHA=sha1_hex,sha256_hex -lane 'sub k2fp {my $k=shift;$k=decode_base64($k);return (sha1_hex($k),sha256_hex($k));};my ($h,$t,$f)=@F;$t=1 if $t eq "ssh-dss";$t=2 if $t eq "ssh-rsa";$t=3 if $t eq "ecdsa-sha2-nistp256";my ($s1,$s256)=k2fp $f;print "$h. 86400 IN SSHFP $t 1 $s1";print "$h. 86400 IN SSHFP $t 2 $s256";'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment