mirror of
https://github.com/mirror/wget.git
synced 2026-08-22 19:03:27 +08:00
Added new tests for SSL
* tests/Test-https-badcerts.px : New file
* tests/Test-https-clientcert.px : New file
* tests/Test-https-crl.px : New file
* tests/Test-https-weboftrust.px : New file
* tests/certs/interca.conf : New file
* tests/certs/rootca.conf : New file
* tests/certs/test-ca-key.pem : New file
Added all new SSL / HTTPS tests to make check
Added Test for SSL Web of Trust, accept only if CA chain of trust is intact.
Added a test script for client certificate
Added Test for crlfile option of wget
Added test to make sure that wget doesn't accept expired or invalid certs
Some clean up : 1, Removed cause of warnings from perl & other cosmetic changes
2, Fix make -j 4 check such that it passes all tests
This commit is contained in:
@@ -20,10 +20,17 @@ my %urls = (
|
||||
},
|
||||
);
|
||||
|
||||
# Skip the test if openssl is not available
|
||||
my $ossl = `openssl version`;
|
||||
unless ($ossl =~ m/OpenSSL 1/)
|
||||
{
|
||||
exit 77;
|
||||
}
|
||||
|
||||
my $cdir = $ENV{'PWD'};
|
||||
|
||||
# HOSTALIASES env variable allows us to create hosts file alias.
|
||||
my $testhostname = "wgettesterr";
|
||||
my $testhostname = "WgetTestingServer";
|
||||
my $testhostfile = "$cdir/wgethosts";
|
||||
open(my $fh, '>', $testhostfile);
|
||||
print $fh "$testhostname 127.0.0.1\n";
|
||||
@@ -52,9 +59,9 @@ my $cacrt = "$cdir/certs/test-ca-cert.pem";
|
||||
my $cakey = "$cdir/certs/test-ca-key.pem";
|
||||
|
||||
# Prepare expired server certificate
|
||||
my $servercrt = "certs/tmpserver.crt";
|
||||
my $serverkey = "certs/tmpserver.key";
|
||||
my $servercsr = "$cdir/certs/tmpserver.csr";
|
||||
my $servercrt = "certs/tmpserver3.crt";
|
||||
my $serverkey = "certs/tmpserver3.key";
|
||||
my $servercsr = "$cdir/certs/tmpserver3.csr";
|
||||
my $enddate = strftime "%y%m%d%H%M%S%z", localtime(time-86400);
|
||||
my $startdate = strftime "%y%m%d%H%M%S%z", localtime(time+86400);
|
||||
my $serversubj = "/C=US/ST=CA/L=Server Mystery Spot/O=Serv/CN=".
|
||||
@@ -77,8 +84,9 @@ unless(-e $servercrt && -e $serverkey && $servercheck == 1)
|
||||
}
|
||||
|
||||
# Try Wget using SSL with expired cert. Expect Failure.
|
||||
my $port = 60443;
|
||||
my $cmdline = $WgetTest::WGETPATH . " --ca-certificate=$cacrt".
|
||||
" https://$testhostname:55443/somefile.txt";
|
||||
" https://$testhostname:$port/somefile.txt";
|
||||
my $expected_error_code = 5;
|
||||
my %existing_files = (
|
||||
);
|
||||
@@ -96,7 +104,8 @@ my $sslsock = SSLTest->new(cmdline => $cmdline,
|
||||
output => \%expected_downloaded_files,
|
||||
certfile => $servercrt,
|
||||
keyfile => $serverkey,
|
||||
lhostname => $testhostname);
|
||||
lhostname => $testhostname,
|
||||
sslport => $port);
|
||||
if ($sslsock->run() == 0)
|
||||
{
|
||||
exit -1;
|
||||
@@ -123,8 +132,9 @@ unless(-e $servercrt && -e $serverkey && $servercheck == 1)
|
||||
|
||||
|
||||
# Retry the test with --no-check-certificate. expect success
|
||||
$port = 50443;
|
||||
$cmdline = $WgetTest::WGETPATH . " --ca-certificate=$cacrt".
|
||||
" https://$testhostname:55443/somefile.txt";
|
||||
" https://$testhostname:$port/somefile.txt";
|
||||
|
||||
$expected_error_code = 5;
|
||||
|
||||
@@ -135,7 +145,8 @@ my $retryssl = SSLTest->new(cmdline => $cmdline,
|
||||
output => \%expected_downloaded_files,
|
||||
certfile => $servercrt,
|
||||
keyfile => $serverkey,
|
||||
lhostname => $testhostname);
|
||||
lhostname => $testhostname,
|
||||
sslport => $port);
|
||||
if ($retryssl->run() == 0)
|
||||
{
|
||||
exit 0;
|
||||
|
||||
Reference in New Issue
Block a user