From 17ff01d0660dfc4b0785a85a3c88035946f4cc80 Mon Sep 17 00:00:00 2001 From: Matthew Slowe Date: Sat, 19 Jun 2021 15:42:11 +0100 Subject: [PATCH] Handle SSHFP records Closes #2 --- manage-dns.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/manage-dns.pl b/manage-dns.pl index 19aa768..660f4ee 100755 --- a/manage-dns.pl +++ b/manage-dns.pl @@ -40,7 +40,7 @@ my %supported_types = ( MX => "yes", NS => "yes", PTR => "yes", - SSHFP => "not yet implemented", + SSHFP => "yes", SRV => "yes", TLSA => "not yet implemented", TXT => "yes", @@ -136,6 +136,11 @@ sub format_record($$$$) { $record->{caa_property} = $property; $record->{caa_tag} = $property; $record->{data} = $data; + } elsif ($type eq 'SSHFP') { + my ($algo, $keytype, $data) = split(/\s+/, $value); + $record->{sshfp_type} = $keytype; + $record->{sshfp_algorithm} = $algo; + $record->{data} = $data; } return $record; @@ -158,6 +163,12 @@ sub reformat_data($$) { $data->{caa_property} || $data->{caa_tag}, $data->{data} ); + } elsif($type eq 'SSHFP') { + return sprintf('%d %d %s', + $data->{sshfp_algorithm}, + $data->{sshfp_type}, + $data->{data}, + ); } return $data->{data};