use Net::DNS
This commit is contained in:
parent
6ea7b77093
commit
b699bf6311
11
gen_tlsa.pl
11
gen_tlsa.pl
@ -6,7 +6,7 @@ use autodie;
|
|||||||
|
|
||||||
use Digest::SHA;
|
use Digest::SHA;
|
||||||
use MIME::Base64;
|
use MIME::Base64;
|
||||||
|
use Net::DNS;
|
||||||
|
|
||||||
use constant WAIT_BEGIN => 1;
|
use constant WAIT_BEGIN => 1;
|
||||||
use constant WAIT_END =>2;
|
use constant WAIT_END =>2;
|
||||||
@ -18,13 +18,15 @@ sub usage {
|
|||||||
|
|
||||||
usage() if (scalar(@ARGV) != 2);
|
usage() if (scalar(@ARGV) != 2);
|
||||||
|
|
||||||
gen_tlsa(@ARGV);
|
my $tlsa = gen_tlsa(@ARGV);
|
||||||
|
|
||||||
|
say $tlsa->string();
|
||||||
|
|
||||||
sub gen_tlsa {
|
sub gen_tlsa {
|
||||||
my ($label, $cert_file) = @_;
|
my ($label, $cert_file) = @_;
|
||||||
my $state = WAIT_BEGIN;
|
my $state = WAIT_BEGIN;
|
||||||
my $pem = '';
|
my $pem = '';
|
||||||
my ($fh, $line);
|
my ($fh, $line, $rr);
|
||||||
|
|
||||||
open($fh, '<', $cert_file);
|
open($fh, '<', $cert_file);
|
||||||
while($line = <$fh>) {
|
while($line = <$fh>) {
|
||||||
@ -41,6 +43,7 @@ sub gen_tlsa {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
close($fh);
|
close($fh);
|
||||||
say($label, ' IN TLSA 1 0 1 ',
|
$rr = new Net::DNS::RR($label.' IN TLSA 1 0 1 '.
|
||||||
Digest::SHA::sha256_hex(decode_base64($pem)));
|
Digest::SHA::sha256_hex(decode_base64($pem)));
|
||||||
|
return $rr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user