mirror of
https://github.com/mirror/wget.git
synced 2025-01-27 12:50:13 +08:00
Made CRL related files in the repo, instead of trying to generate them
This commit is contained in:
parent
2894a37189
commit
cc74f8b7e2
@ -5,10 +5,8 @@ use warnings;
|
||||
use Socket;
|
||||
use WgetFeature qw(https);
|
||||
use SSLTest;
|
||||
use File::Remove 'remove';
|
||||
|
||||
###############################################################################
|
||||
my @tempfiles;
|
||||
|
||||
# code, msg, headers, content
|
||||
my %urls = (
|
||||
@ -37,7 +35,6 @@ if (@ARGV) {
|
||||
}
|
||||
$srcdir = Cwd::abs_path("$srcdir");
|
||||
|
||||
my $cdir = $ENV{'PWD'};
|
||||
# HOSTALIASES env variable allows us to create hosts file alias.
|
||||
my $testhostname = "WgetTestingServer";
|
||||
$ENV{'HOSTALIASES'} = "$srcdir/certs/wgethosts";
|
||||
@ -54,49 +51,17 @@ unless (inet_ntoa($addr) =~ "127.0.0.1")
|
||||
exit 77;
|
||||
}
|
||||
|
||||
# Create certindex
|
||||
push (@tempfiles, "$cdir/certindex");
|
||||
open CERTID, ">", "$cdir/certindex" or
|
||||
warn "Cannot overwrite file $cdir/certindex";
|
||||
close CERTID;
|
||||
|
||||
# Create certserial
|
||||
push (@tempfiles, "$cdir/certserial");
|
||||
open CERTSN, ">", "$cdir/certserial" or
|
||||
warn "Cannot overwrite file $cdir/certserial";
|
||||
print CERTSN "1122";
|
||||
close CERTSN;
|
||||
|
||||
# Create crlnumber
|
||||
push (@tempfiles, "$cdir/crlnumber");
|
||||
open CRLN, ">", "$cdir/crlnumber" or
|
||||
warn "Cannot overwrite file $cdir/crlnumber";
|
||||
print CRLN "1122";
|
||||
close CRLN;
|
||||
|
||||
my $caconf = "$srcdir/certs/rootca.conf";
|
||||
my $cacrt = "$srcdir/certs/test-ca-cert.pem";
|
||||
my $cakey = "$srcdir/certs/test-ca-key.pem";
|
||||
|
||||
# Prepare server certificate
|
||||
my $servercrt = "$cdir/tmpserver$$.crt";
|
||||
my $serverkey = "$cdir/tmpserver$$.key";
|
||||
my $servercsr = "$cdir/tmpserver$$.csr";
|
||||
push (@tempfiles, $servercrt, $serverkey, $servercsr);
|
||||
my $serversubj = "/C=US/ST=CA/L=Server Mystery Spot/O=Serv/CN=".
|
||||
"$testhostname/emailAddress=servertester";
|
||||
my $servercmd = "openssl genrsa -out $serverkey 4096 && openssl req -new".
|
||||
" -sha256 -key $serverkey -out $servercsr -days 365 ".
|
||||
" -subj \"$serversubj\" &&".
|
||||
"openssl ca -batch -config $caconf -notext -in $servercsr".
|
||||
" -out $servercrt";
|
||||
|
||||
system($servercmd);
|
||||
# Use a revoked certificate
|
||||
my $servercrt = "$srcdir/certs/revoked.crt";
|
||||
my $serverkey = "$srcdir/certs/revoked.key";
|
||||
|
||||
my $servercheck =`(openssl x509 -noout -modulus -in $servercrt | openssl md5 ;
|
||||
openssl rsa -noout -modulus -in $serverkey | openssl md5) |
|
||||
uniq | wc -l`;
|
||||
# Check if certificate and key are made correctly.
|
||||
# Check if certificate and key are correct.
|
||||
unless(-e $servercrt && -e $serverkey && $servercheck == 1)
|
||||
{
|
||||
exit 77; # skip
|
||||
@ -131,13 +96,8 @@ if ($sslsock->run() != 0)
|
||||
}
|
||||
|
||||
# Revoke the certificate
|
||||
my $crlfile = "$cdir/servercrl.pem";
|
||||
push (@tempfiles, $crlfile);
|
||||
my $revokecmd = "openssl ca -config $caconf -revoke $servercrt &&
|
||||
openssl ca -config $caconf -gencrl -keyfile $cakey ".
|
||||
"-cert $cacrt -out $crlfile";
|
||||
my $crlfile = "$srcdir/certs/revokedcrl.pem";
|
||||
|
||||
system($revokecmd);
|
||||
# Check if CRL file is generated.
|
||||
unless(-e $crlfile)
|
||||
{
|
||||
@ -174,8 +134,3 @@ else
|
||||
exit 0;
|
||||
}
|
||||
# vim: et ts=4 sw=4
|
||||
|
||||
END {
|
||||
print "remove(@tempfiles);\n";
|
||||
remove(@tempfiles);
|
||||
}
|
||||
|
41
tests/certs/revoked.crt
Normal file
41
tests/certs/revoked.crt
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ECaPEWGXII8dh9WlomxpjpZABZ/cmeG2SM7BxVwjIjACscXogJ
|
||||
A/Gm7I0hhvYSZ/G+kFbYbSf/Pj7Rz/4KW6WSwwQK23ab00MXBM6jWEueAeWebzeW
|
||||
rzWgyyy+GiqgLqQAKQrYtD51uF5Co+S0e2wazORLakvdF/USCBQwX+Pla09Wyf+b
|
||||
0HBqNjuxQc278/69Xp0mg8k67oUrWt3zgJ8kDhNIGvLnCB+0595G/z+7+mxdEztc
|
||||
BavKAMEDWTSCClwxO6lBQR7+oiNWdaaqHP1SS8sckjtt2jTbmjmRzWWkU+xSIlt2
|
||||
waIXS/BYRbyhLuWfxivvRjS7eQogeSP0rtZj/upBwM4xKVPF0bal/LMyEfrY3qV5
|
||||
8YXXFhnoVr7q3t0YaioIZXY35QcA5aR+P4XyLnzCTVuKUi172BS8KJBXMijEXxta
|
||||
rRQxtHLQeYB5eP/MaC2qMJH/OMR3A9Z7sXYbp/YuE+V/MxcGwAoHWKxMeKtdF420
|
||||
HGeKfzMla6uJQk26VEFAt+TYV2KUriPWyL/IPDzAjrSPMF9ZDIMhqELjFYCRGPwc
|
||||
X6txpIEgZCGdJWK0H3et8ZSe469AED6oqTfn44w=
|
||||
-----END CERTIFICATE-----
|
51
tests/certs/revoked.key
Normal file
51
tests/certs/revoked.key
Normal file
@ -0,0 +1,51 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJJwIBAAKCAgEAzkPgzYpi/xrU2mWaLVNtZS5OLWZ2y64CZAY5SFkL1Dfdb4Y6
|
||||
0KiQyu6cKI5OZCmeES/mQT3XdHWIFzDWg35b/ZpcJc0yMMtJ73mO/wDzC0eKfj7W
|
||||
5ilT92F3vJC5oJCZJVp7buoglYREjvDyfyLdilEum4K/zNs1zeh4j5YJ7CMh9TKP
|
||||
jcbb7Ox8/kHPt+63LZoLUkduan0LaiuDJs3gBnDCBtyUZVU+gdXI5TpiCdt/ignd
|
||||
uLZ4N/htPuLtRZyEEtGducqz1kr0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
|
||||
vlYxt2AqlFxgGMAu2A/QrrPYB0KVmeE9FAz3LGtCzBkjTaFzYeoYisS5sv4b6Rhl
|
||||
jCEPIZEyVs602SwbGaGCBZI5/Ha2khVATlIq3Jx7QFfmUVXxqUoXl34fY9wrxzzg
|
||||
syN3VMguE1WaraAUACQGT1FutyfBFRyxc7kxQZop/DDGU9/Emd9EOn2QNPM5soMs
|
||||
bTApAoIBAAZnMaxphWdNX1uvLsrbxx7Y2n7l5FNHxfy0CRLx0iu21dGL2A+omR1E
|
||||
1JGNXVDYLeiLumW6mp8MtNWIjMVeUIDUMPdqhjMlbj8U0fxrEEg6KRc3/moomHqP
|
||||
5LVYBXov/n+6s2q9hJ2WPLTd+FH2+SZxMsMt2Hqp4sqT6L7hsnTh6l9NNl4zmZxV
|
||||
MeslMZHzMCRf0Ic/TS3ub4gKsjBmdOXEDsx0264NWVNOiJJV6tQVlbENXU7a2lCk
|
||||
G4gu4xVNggtFnqRcdl6iJb1KzpvHzd6eg1cqZ53QiJhtNnbudMU8UiJnArAvTUQt
|
||||
cmYXKUSMp0TWMs8ItlG74udmPKjeL60CggEAdUp2FbZZEB3/G8tR7Z5slF925zXK
|
||||
N8ku/qOUEk3d76kcqYi9XJLmyJAXu9PhQnsN8DpfThOqJUXCh9xtk+1AiHTdXk8m
|
||||
BP7RE2oI2aoT9lO0ozwFJBFRRCkd6zTtYJYUbwIk1nayro83xl/AQPF2wRm5unKU
|
||||
xl5KJ8I2GCUw4Bh5Gjwk21y6XpPsjO8tfbO5jrAIQVTqab3hAcBouwQNsxNpunJm
|
||||
BaP+XYTBNM+HVamwLwDQgtVxPb8WUX8TSTuFv99jpWBYhlhq/OUcbo8f1D7miIFt
|
||||
b6UYNl1ofvBtqjlNz3NKJ+S57AN+jcdQfOG8xAiKPWCj1QnVc3aJdr+8bQ==
|
||||
-----END RSA PRIVATE KEY-----
|
19
tests/certs/revokedcrl.pem
Normal file
19
tests/certs/revokedcrl.pem
Normal file
@ -0,0 +1,19 @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||
4K0CAIbfhYx1eeIakeFFHdIGPSXf+oFGomij0yt3bZC2h4sFhsr7sYUIMb5KlSSW
|
||||
mZ3uHBLaS0xQ9p1vSRo=
|
||||
-----END X509 CRL-----
|
Loading…
Reference in New Issue
Block a user