Ok todays tutorial is for advanced cyber elite hacker ninja monkey admins, what is it?
well this should show you how to store your ssh servers host key in its dns record so that ssh can auotomatically verify the authenticity of the machine, not so useful after the inital connection (where you type yes) but its handy if you use machines that dont have your servers fingerprint alot (eg tech support guys, contractor, student)
scince this i a 10 minute hack its worth it (10 minutes for you, i spent half a day getting it to work) so i thought i would pass on my knowlage to you. note that you can also put your pgp keys in your dns record and have openpgp pull them from dns rather than a keyserver

, eg peter.yourdomain.com with your pgp public key would be the ekey for the email adress peter@yourdomain.com
anyway onto the howto

prerequisetes:
A dns server that you control the zone files on (the godaddy interface dosent count, you really need to run your own dns server orbe able to hack the zone files by hand)
idealy the dns server on a diffrent machine and ip to the ssh server (its a trust/hack thing)
anyway, locate the ssh server you wish to publish the keys for, ill use my zone ifles to show off

CODE
for bind less than 9.3
pocketnix.org. A 203.12.2.248
TYPE44 \# 22 ( 02013f4bd588c6146610bc2c3d70e6adc6de2bad8fa5 )
TYPE44 \# 22 ( 0101950f1a8aa5162e0235be3c3e7bfbad5445d3f508 )
CODE
for bind equal to or greater than 9.3
pocketnix.org. A 203.12.2.248
pocketnix.org SSHFP 1 1 950f1a8aa5162e0235be3c3e7bfbad5445d3f508
pocketnix.org SSHFP 2 1 3f4bd588c6146610bc2c3d70e6adc6de2bad8fa5
the reson for the differing code is that the older bind dosent have direct support for it (record type 44) but you can hack it to work by entering the packet type, then the raw payload in hex which is mostly aoutgenerated, i only had to add 2 0's
the program to generate the keys, or more acurattly format the exsisting keys into dns records is ssh-keygen -r <hostname>
first go to /etc/ssh, the entere ssh-keygen <hostname> where hostname matches the dns name of the PC, when prompted for a keyfile enter ssh_host_dsa_key.pub
and repeat for the rsa key (ssh_host_rsa_key.pub). this should have spat out a line of code that looks like the second example i gave, if you use bind >=9.3 then copy it to the zone file in the line below the hosts A record
if you are using the older bind then it needs a bit of massaging see the following steps
pocketnix.org IN SSHFP 2 1 3f4bd588c6146610bc2c3d70e6adc6de2bad8fa5
remove pocketnix.org IN SSHFP so it becomes
CODE
2 1 3f4bd588c6146610bc2c3d70e6adc6de2bad8fa5
add a 0 to the 2 and the one at the beggining (or both 1s for the rsa key
CODE
02 01 3f4bd588c6146610bc2c3d70e6adc6de2bad8fa5
remove spaces
CODE
02013f4bd588c6146610bc2c3d70e6adc6de2bad8fa5
wrap in barackets with spaces
CODE
( 02013f4bd588c6146610bc2c3d70e6adc6de2bad8fa5 )
add TYPE44 \# 22 to the front
CODE
TYPE44 \# 22 ( 02013f4bd588c6146610bc2c3d70e6adc6de2bad8fa5 )
and finally add underneath the hosts A record, the reson for adding it underneath the hosts A record is because we did not specify the host the key belongs to, by placing it under the A record it uses the last A record to work out who it belongs to
hope this helped, its not your standard feature but for some peopel it adds a bit of security.
when you now login to the server for the first time it will say
CODE
The authenticity of host 'lookout.pocketnix.org (203.12.2.248)' can't be established.
RSA key fingerprint is e5:ec:ae:56:a0:75:56:b0:c2:07:d8:1d:d0:89:fd:d8.
Matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)?
see the matching host in dns bit?, it comes in handy if you dont want to remeber the fingerprints of every host
i also added this to my .ssh/config file
VerifyHostKeyDNS yes
this makes ssh check the dns entry by default, otherwise you have ot do ssd -o "VerifyHostKeyDNS yes" <hostname> to get it to verify the keys (i suppose i should mention that at an earlier point)