make Travis work again

This commit is contained in:
Dirk 2017-04-01 20:56:53 +02:00
parent f2bbba3b99
commit c9bdd23a03
2 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,7 @@ my (
pass("Running testssl.sh against badssl.com to create a baseline (may take 2~3 minutes)"); $tests++; pass("Running testssl.sh against badssl.com to create a baseline (may take 2~3 minutes)"); $tests++;
my $okout = `./testssl.sh -S -e -U --jsonfile tmp.json --color 0 badssl.com`; my $okout = `./testssl.sh -S -e -U --jsonfile tmp.json --color 0 badssl.com`;
my $okjson = json('tmp.json'); my $okjson = json('tmp.json');
unlink 'tmp.json';
cmp_ok(@$okjson,'>',10,"We have more then 10 findings"); $tests++; cmp_ok(@$okjson,'>',10,"We have more then 10 findings"); $tests++;
# Expiration # Expiration
@ -23,6 +24,7 @@ pass("Running testssl against expired.badssl.com"); $tests++;
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 expired.badssl.com`; $out = `./testssl.sh -S --jsonfile tmp.json --color 0 expired.badssl.com`;
like($out, qr/Certificate Expiration\s+expired\!/,"The certificate should be expired"); $tests++; like($out, qr/Certificate Expiration\s+expired\!/,"The certificate should be expired"); $tests++;
$json = json('tmp.json'); $json = json('tmp.json');
unlink 'tmp.json';
$found = 0; $found = 0;
foreach my $f ( @$json ) { foreach my $f ( @$json ) {
if ( $f->{id} eq "expiration" ) { if ( $f->{id} eq "expiration" ) {
@ -39,6 +41,7 @@ pass("Running testssl against self-signed.badssl.com"); $tests++;
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 self-signed.badssl.com`; $out = `./testssl.sh -S --jsonfile tmp.json --color 0 self-signed.badssl.com`;
like($out, qr/Certificate Expiration\s+\d+/,"The certificate should not be expired"); $tests++; like($out, qr/Certificate Expiration\s+\d+/,"The certificate should not be expired"); $tests++;
$json = json('tmp.json'); $json = json('tmp.json');
unlink 'tmp.json';
$found = 0; $found = 0;
foreach my $f ( @$json ) { foreach my $f ( @$json ) {
if ( $f->{id} eq "expiration" ) { if ( $f->{id} eq "expiration" ) {
@ -51,6 +54,7 @@ foreach my $f ( @$json ) {
is($found,1,"We had a finding for this in the JSON output"); $tests++; is($found,1,"We had a finding for this in the JSON output"); $tests++;
like($out, qr/Chain of trust.*?NOT ok.*\(self signed\)/,"Chain of trust should fail because of self signed"); $tests++; like($out, qr/Chain of trust.*?NOT ok.*\(self signed\)/,"Chain of trust should fail because of self signed"); $tests++;
unlink 'tmp.json';
$found = 0; $found = 0;
foreach my $f ( @$json ) { foreach my $f ( @$json ) {
if ( $f->{id} eq "chain_of_trust" ) { if ( $f->{id} eq "chain_of_trust" ) {
@ -63,6 +67,7 @@ foreach my $f ( @$json ) {
is($found,1,"We had a finding for this in the JSON output"); $tests++; is($found,1,"We had a finding for this in the JSON output"); $tests++;
like($okout, qr/Chain of trust[^\n]*?Ok/,"Chain of trust should be ok"); $tests++; like($okout, qr/Chain of trust[^\n]*?Ok/,"Chain of trust should be ok"); $tests++;
unlink 'tmp.json';
$found = 0; $found = 0;
foreach my $f ( @$okjson ) { foreach my $f ( @$okjson ) {
if ( $f->{id} eq "chain_of_trust" ) { if ( $f->{id} eq "chain_of_trust" ) {
@ -95,6 +100,7 @@ pass("Running testssl against incomplete-chain.badssl.com"); $tests++;
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 incomplete-chain.badssl.com`; $out = `./testssl.sh -S --jsonfile tmp.json --color 0 incomplete-chain.badssl.com`;
like($out, qr/Chain of trust.*?NOT ok\s+\(chain incomplete\)/,"Chain of trust should fail because of incomplete"); $tests++; like($out, qr/Chain of trust.*?NOT ok\s+\(chain incomplete\)/,"Chain of trust should fail because of incomplete"); $tests++;
$json = json('tmp.json'); $json = json('tmp.json');
unlink 'tmp.json';
$found = 0; $found = 0;
foreach my $f ( @$json ) { foreach my $f ( @$json ) {
if ( $f->{id} eq "chain_of_trust" ) { if ( $f->{id} eq "chain_of_trust" ) {
@ -113,6 +119,7 @@ is($found,1,"We had a finding for this in the JSON output"); $tests++;
#$out = `./testssl.sh -e -U --jsonfile tmp.json --color 0 cbc.badssl.com`; #$out = `./testssl.sh -e -U --jsonfile tmp.json --color 0 cbc.badssl.com`;
#like($out, qr/Chain of trust.*?NOT ok\s+\(chain incomplete\)/,"Chain of trust should fail because of incomplete"); $tests++; #like($out, qr/Chain of trust.*?NOT ok\s+\(chain incomplete\)/,"Chain of trust should fail because of incomplete"); $tests++;
#$json = json('tmp.json'); #$json = json('tmp.json');
#unlink 'tmp.json';
#$found = 0; #$found = 0;
#foreach my $f ( @$json ) { #foreach my $f ( @$json ) {
# if ( $f->{id} eq "chain_of_trust" ) { # if ( $f->{id} eq "chain_of_trust" ) {

View File

@ -19,6 +19,7 @@ $json = json('tmp.json');
# It is better to have findings in a hash # It is better to have findings in a hash
# Look for a host cert match in the process. # Look for a host cert match in the process.
unlink 'tmp.json';
my $found = 0; my $found = 0;
my %findings; my %findings;
foreach my $f ( @$json ) { foreach my $f ( @$json ) {