This site is now 100% read-only, and retired.

XML logo

Adding SSH fingerprints to TinyDNS
Posted by lee on Thu 12 May 2011 at 21:04
Tags: ,

Everytime I set up a new sever, I always seem to have forgotten how to generate the fingerprint data to store in DNS. So, for the benefit of my future self:

Install sshfp (a python script packaged for debian/ubuntu)

Then to get the output in a format usable by TinyDNS, run it through another script.

sshfp -s s1.example.com s2.example.com | sshfp2tdns
#!/usr/bin/perl
## sshfp2tdns - convert sshfp output for use in TinyDNS
## adaped from code on http://dank.qemfd.net/dankwiki/index.php/SSHFP

use strict;

while (<>) {
  chomp;
  my ($host, $in, $sshfp, $alg, $fptype, $fp) = split " ", $_;
  my $out = sprintf("\\%03o\\%03o", $alg, $fptype);
  for (my $i = 0; $i < length($fp); $i += 2) {
        $out .= sprintf("\\%03o", hex substr($fp, $i, 2));
  }
  printf(":%s:44:%s:\n", $host, $out);
}