]> git.pld-linux.org Git - packages/djbdns.git/blame - add-sshfp.pl
tinydns-log: add sample to log only fatals and startup messages
[packages/djbdns.git] / add-sshfp.pl
CommitLineData
04b620fd 1#!/usr/bin/perl
78e3f8b0
ER
2# Snippet from
3# http://dank.qemfd.net/dankwiki/index.php/SSHFP
4# By Henning Brauer
04b620fd
ER
5
6use strict;
7
8open IN, "ssh-keygen -f /etc/ssh/ssh_host_rsa_key.pub -r $ARGV[0] |";
9my $FP = <IN>;
10close IN;
11chop $FP;
12my ($host, $in, $sshfp, $alg, $fptype, $fp) = split " ", $FP;
13my $out = sprintf("\\%03o\\%03o", $alg, $fptype);
14for (my $i = 0; $i < length($fp); $i += 2) {
15 $out .= sprintf("\\%03o", hex substr($fp, $i, 2));
16}
17printf(":%s:44:%s:\n", $host, $out);
This page took 0.076044 seconds and 4 git commands to generate.