From 5c4cc011feaa97874d707cfdd275a844b46545e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Thu, 4 May 2017 16:42:49 +0200 Subject: [PATCH] Add static HOSTSALIAS file * tests/certs/wgethosts: New file * tests/Test-https-*.px: Remove creation of wgethosts file --- tests/Test-https-badcerts.px | 6 +----- tests/Test-https-clientcert.px | 8 ++------ tests/Test-https-pfs.px | 6 +----- tests/Test-https-selfsigned.px | 8 ++------ tests/Test-https-tlsv1.px | 6 +----- tests/Test-https-tlsv1x.px | 6 +----- tests/Test-https-weboftrust.px | 6 +----- tests/certs/wgethosts | 1 + 8 files changed, 10 insertions(+), 37 deletions(-) create mode 100644 tests/certs/wgethosts diff --git a/tests/Test-https-badcerts.px b/tests/Test-https-badcerts.px index 7bc15aae..aafd5d06 100755 --- a/tests/Test-https-badcerts.px +++ b/tests/Test-https-badcerts.px @@ -31,11 +31,7 @@ my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; # Create certindex open CERTID, ">", "$cdir/certs/certindex" or diff --git a/tests/Test-https-clientcert.px b/tests/Test-https-clientcert.px index 7fcf02c6..f6335612 100755 --- a/tests/Test-https-clientcert.px +++ b/tests/Test-https-clientcert.px @@ -30,11 +30,7 @@ my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; # Create certindex open CERTID, ">", "$cdir/certs/certindex" or @@ -78,7 +74,7 @@ unless(-e $servercrt && -e $serverkey && $servercheck == 1) exit 77; # skip } -# Prepare client certifcate +# Prepare client certificate my $clientcert = "$cdir/certs/client.crt"; my $clientkey = "$cdir/certs/client.key"; my $clientcsr = "$cdir/certs/client.csr"; diff --git a/tests/Test-https-pfs.px b/tests/Test-https-pfs.px index aa18ca2e..44af51da 100755 --- a/tests/Test-https-pfs.px +++ b/tests/Test-https-pfs.px @@ -29,11 +29,7 @@ unless ($ossl =~ m/OpenSSL 1/) my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; my $port = 54443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=PFS". diff --git a/tests/Test-https-selfsigned.px b/tests/Test-https-selfsigned.px index cb50a54c..22286c2e 100755 --- a/tests/Test-https-selfsigned.px +++ b/tests/Test-https-selfsigned.px @@ -30,13 +30,9 @@ my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; -# Prepare self-signed certifcates +# Prepare self-signed certificates my $certfile="tmpsscert.pem"; my $keyfile="tmpsskey.pem"; my $certsubj="/C=US/ST=CA/L=Mystery Spot/O=Dis/CN=$testhostname/emailAddress=tester"; diff --git a/tests/Test-https-tlsv1.px b/tests/Test-https-tlsv1.px index ef7bec9c..96bbfacb 100755 --- a/tests/Test-https-tlsv1.px +++ b/tests/Test-https-tlsv1.px @@ -29,11 +29,7 @@ unless ($ossl =~ m/OpenSSL 1/) my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; my $port = 58443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1". diff --git a/tests/Test-https-tlsv1x.px b/tests/Test-https-tlsv1x.px index bee54077..cf35245c 100755 --- a/tests/Test-https-tlsv1x.px +++ b/tests/Test-https-tlsv1x.px @@ -29,11 +29,7 @@ unless ($ossl =~ m/OpenSSL 1/) my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; my $port = 59443; my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1_1". diff --git a/tests/Test-https-weboftrust.px b/tests/Test-https-weboftrust.px index d97e4520..0d37f993 100755 --- a/tests/Test-https-weboftrust.px +++ b/tests/Test-https-weboftrust.px @@ -30,11 +30,7 @@ my $cdir = $ENV{'PWD'}; # HOSTALIASES env variable allows us to create hosts file alias. my $testhostname = "WgetTestingServer"; -my $testhostfile = "$cdir/wgethosts"; -open(my $fh, '>', $testhostfile); -print $fh "$testhostname 127.0.0.1\n"; -close $fh; -$ENV{'HOSTALIASES'} = "$cdir/wgethosts"; +$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts"; # Create certindex open CERTID, ">", "$cdir/certs/certindex" or diff --git a/tests/certs/wgethosts b/tests/certs/wgethosts new file mode 100644 index 00000000..04b52152 --- /dev/null +++ b/tests/certs/wgethosts @@ -0,0 +1 @@ +WgetTestingServer localhost