equal
deleted
inserted
replaced
1 #! /usr/bin/perl |
1 #! /usr/bin/perl |
2 |
2 |
3 use strict; |
3 use strict; |
4 use warnings; |
4 use warnings; |
5 use Test::More qw(no_plan); |
5 use Test::More qw(no_plan); |
|
6 # @TODO write tests for |
|
7 # bad-hash.dane.verisignlabs.com -> The TLSA record for this server has an incorrect hash value, although it is correctly signed with DNSSEC |
|
8 # bad-params.dane.verisignlabs.com -> The TLSA record for this server has a correct hash value, incorrect TLSA parameters, and is correctly signed with DNSSEC. NOTE: The current Firefox plugin accepts these TLSA records as valid. |
|
9 # bad-sig.dane.verisignlabs.com -> The TLSA record for this server is correct, but the DNSSEC chain-of-trust is broken and/or has a bad signature. NOTE: If you have validation enabled you won't be able to look up the hostname anyway. |
|
10 # source: http://dane.verisignlabs.com/ |
6 |
11 |
7 BEGIN { use_ok('Nagios::Check::DNS::check_tlsa_record') }; |
12 BEGIN { use_ok('Nagios::Check::DNS::check_tlsa_record') }; |
8 |
13 |
9 require_ok('Nagios::Check::DNS::check_tlsa_record'); |
14 require_ok('Nagios::Check::DNS::check_tlsa_record'); |
10 |
15 |
26 like($test_main_domain_and_port, qr(OK: .* is valid), 'main() ok with domain and port'); |
31 like($test_main_domain_and_port, qr(OK: .* is valid), 'main() ok with domain and port'); |
27 |
32 |
28 my $test_main_domain_port_protocol = Nagios::Check::DNS::check_tlsa_record::main(($domain3, 443, 'tcp')); |
33 my $test_main_domain_port_protocol = Nagios::Check::DNS::check_tlsa_record::main(($domain3, 443, 'tcp')); |
29 like($test_main_domain_port_protocol, qr(OK: .* is valid), 'main() ok with domain, port and protocol'); |
34 like($test_main_domain_port_protocol, qr(OK: .* is valid), 'main() ok with domain, port and protocol'); |
30 |
35 |
31 my $test_main_no_tlsa = Nagios::Check::DNS::check_tlsa_record::main(('google.com')); |
36 my $test_main_no_tlsa = Nagios::Check::DNS::check_tlsa_record::main(('google.com')); |
32 like($test_main_no_tlsa, qr(WARNING: .*), 'main() warning when no SSL-Certificate or no TLSA-Record/DANE is available'); |
37 like($test_main_no_tlsa, qr(WARNING: .*), 'main() warning when no SSL-Certificate or no TLSA-Record/DANE is available'); |
33 |
38 |
34 my $test_main_default_port2 = Nagios::Check::DNS::check_tlsa_record::main(($domain4)); |
39 my $test_main_default_port2 = Nagios::Check::DNS::check_tlsa_record::main(($domain4)); |
35 like($test_main_default_port2, qr(CRITICAL: .* valid), 'main() critical when DANE not valid.'); |
40 like($test_main_default_port2, qr(CRITICAL: .* valid), 'main() critical when DANE not valid.'); |
36 |
41 |
37 } |
42 } |