Support TLSA records

Closes: #4
This commit is contained in:
Matthew Slowe 2021-06-19 15:49:54 +01:00
parent 17ff01d066
commit fc2031eb7c

View File

@ -42,7 +42,7 @@ my %supported_types = (
PTR => "yes", PTR => "yes",
SSHFP => "yes", SSHFP => "yes",
SRV => "yes", SRV => "yes",
TLSA => "not yet implemented", TLSA => "yes",
TXT => "yes", TXT => "yes",
); );
sub is_unsupported($) { sub is_unsupported($) {
@ -141,6 +141,12 @@ sub format_record($$$$) {
$record->{sshfp_type} = $keytype; $record->{sshfp_type} = $keytype;
$record->{sshfp_algorithm} = $algo; $record->{sshfp_algorithm} = $algo;
$record->{data} = $data; $record->{data} = $data;
} elsif ($type eq 'TLSA') {
my ($usage, $selector, $matching, $data) = split(/\s+/, $value);
$record->{tlsa_usage} = $usage;
$record->{tlsa_selector} = $selector;
$record->{tlsa_matching} = $matching;
$record->{data} = $data;
} }
return $record; return $record;
@ -169,6 +175,13 @@ sub reformat_data($$) {
$data->{sshfp_type}, $data->{sshfp_type},
$data->{data}, $data->{data},
); );
} elsif($type eq 'TLSA') {
return sprintf('%d %d %d %s',
$data->{tlsa_usage},
$data->{tlsa_selector},
$data->{tlsa_matching},
$data->{data},
);
} }
return $data->{data}; return $data->{data};