1 2 3 4 5 6
my $ua = LWP::UserAgent->new( ssl_opts => { SSL_verify_mode => SSL_VERIFY_CLIENT_ONCE(), }, SSL_verify_mode => SSL_VERIFY_CLIENT_ONCE(), );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
DEBUG: .../IO/Socket/SSL.pm:2688: new ctx 54039712
DEBUG: .../IO/Socket/SSL.pm:605: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:607: socket connected
DEBUG: .../IO/Socket/SSL.pm:629: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:662: using SNI with hostname meinserver.net
DEBUG: .../IO/Socket/SSL.pm:697: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:716: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:729: call Net::SSLeay::connect
DEBUG: .../IO/Socket/SSL.pm:732: done Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:742: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:752: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:772: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:729: call Net::SSLeay::connect
DEBUG: .../IO/Socket/SSL.pm:2589: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:732: done Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:735: SSL connect attempt failed
DEBUG: .../IO/Socket/SSL.pm:735: local error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:738: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../lib/Net/HTTPS.pm:68: ignoring less severe local error 'IO::Socket::IP configuration failed', keep 'SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed'
DEBUG: .../IO/Socket/SSL.pm:2721: free ctx 54039712 open=54039712
DEBUG: .../IO/Socket/SSL.pm:2726: free ctx 54039712 callback
DEBUG: .../IO/Socket/SSL.pm:2733: OK free ctx 54039712
500 Can't connect to meinserver.net:443
$VAR1 = bless( {
'_request' => bless( {
'_method' => 'GET',
'_protocol' => undef,
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.13'
}, 'HTTP::Headers' ),
'_content' => '',
'_uri' => bless( do{\(my $o = 'https://meinserver.net/cgi-bin/meinscript.pl')}, 'URI::https' )
}, 'HTTP::Request' ),
'_msg' => 'Can\'t connect to meinserver.net:443',
'_headers' => bless( {
'::std_case' => {
'client-date' => 'Client-Date',
'client-warning' => 'Client-Warning'
},
'content-type' => 'text/plain',
'client-date' => 'Thu, 05 Nov 2015 06:46:04 GMT',
'client-warning' => 'Internal response'
}, 'HTTP::Headers' ),
'_rc' => 500,
'_content' => 'Can\'t connect to meinserver.net:443
Bad file descriptor at C:/strawberry/perl/site/lib/LWP/Protocol/http.pm line 50.
',
'_previous' => bless( {
'_request' => bless( {
'_uri' => bless( do{\(my $o = 'http://192.168.0.50/cgi-bin/meinscript.pl')}, 'URI::http' ),
'_content' => '',
'_uri_canonical' => $VAR1->{'_previous'}{'_request'}{'_uri'},
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.13'
}, 'HTTP::Headers' ),
'_method' => 'GET'
}, 'HTTP::Request' ),
'_protocol' => 'HTTP/1.1',
'_content' => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://meinserver.net/cgi-bin/meinscript.pl">here</a>.</p>
</body></html>
',
'_msg' => 'Found',
'_headers' => bless( {
'vary' => 'Accept-Encoding',
'location' => 'https://meinserver.net/cgi-bin/meinscript.pl',
'connection' => 'close',
'content-length' => '234',
'client-response-num' => 1,
'client-date' => 'Thu, 05 Nov 2015 06:46:03 GMT',
'date' => 'Thu, 05 Nov 2015 06:46:13 GMT',
'x-frame-options' => 'SAMEORIGIN',
'title' => '302 Found',
'client-peer' => '192.168.0.50:80',
'server' => 'Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8t',
'::std_case' => {
'title' => 'Title',
'client-peer' => 'Client-Peer',
'content-base' => 'Content-Base',
'x-frame-options' => 'X-Frame-Options',
'client-date' => 'Client-Date',
'client-response-num' => 'Client-Response-Num',
'base' => 'Base'
},
'content-type' => 'text/html; charset=iso-8859-1'
}, 'HTTP::Headers' ),
'_rc' => '302'
}, 'HTTP::Response' )
}, 'HTTP::Response' );
Quotekennen wir ja noch aus change EAGAIN to EWOULDBLOCK to support Windows too #66, ist gepatcht.Bad file descriptor at C:/strawberry/perl/site/lib/LWP/Protocol/http.pm line 50.
Guest janusoder so:
1 2 3 4 5 6
my $ua = LWP::UserAgent->new( ssl_opts => { SSL_verify_mode => SSL_VERIFY_NONE(), }, SSL_verify_mode => SSL_VERIFY_NONE(), );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
DEBUG: .../IO/Socket/SSL.pm:2688: new ctx 40137824
DEBUG: .../IO/Socket/SSL.pm:605: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:607: socket connected
DEBUG: .../IO/Socket/SSL.pm:629: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:665: not using SNI because hostname is unknown
DEBUG: .../IO/Socket/SSL.pm:697: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:716: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:729: call Net::SSLeay::connect
DEBUG: .../IO/Socket/SSL.pm:732: done Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:742: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:752: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:772: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:729: call Net::SSLeay::connect
DEBUG: .../IO/Socket/SSL.pm:2589: did not get stapled OCSP response
DEBUG: .../IO/Socket/SSL.pm:2542: ok=0 [0] /CN=ICH Certificate Authority/CN=meinserver.net
DEBUG: .../IO/Socket/SSL.pm:732: done Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:735: SSL connect attempt failed
DEBUG: .../IO/Socket/SSL.pm:735: local error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:738: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../lib/Net/HTTPS.pm:68: ignoring less severe local error 'IO::Socket::IP configuration failed', keep 'SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed'
DEBUG: .../IO/Socket/SSL.pm:2721: free ctx 40137824 open=40137824
DEBUG: .../IO/Socket/SSL.pm:2726: free ctx 40137824 callback
DEBUG: .../IO/Socket/SSL.pm:2733: OK free ctx 40137824
500 Can't connect to 192.168.0.50:443
$VAR1 = bless( {
'_msg' => 'Can\'t connect to 192.168.0.50:443',
'_content' => 'Can\'t connect to 192.168.0.50:443
Bad file descriptor at C:/strawberry/perl/site/lib/LWP/Protocol/http.pm line 50.
',
'_headers' => bless( {
'client-date' => 'Fri, 06 Nov 2015 05:47:15 GMT',
'content-type' => 'text/plain',
'client-warning' => 'Internal response',
'::std_case' => {
'client-warning' => 'Client-Warning',
'client-date' => 'Client-Date'
}
}, 'HTTP::Headers' ),
'_rc' => 500,
'_request' => bless( {
'_method' => 'GET',
'_uri' => bless( do{\(my $o = 'https://192.168.0.50/cgi-bin/meinscript.pl')}, 'URI::https' ),
'_content' => '',
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.13'
}, 'HTTP::Headers' )
}, 'HTTP::Request' )
}, 'HTTP::Response' );
2015-11-05T22:44:44 noxxiDer bessere Weg ist natürlich die Zetifikatsverifikation nicht auszuschalten, weil ohne die Validierung kann man leicht man-in-the-middle Angriffe machen.
2015-11-05T22:44:44 noxxiDer andere Weg, den Du offensichtlich probiert hast, ist das Zertifikat über SSL_ca_file anzugeben. Dieses ist möglich solange
* Der Hostname im Zertifikat tatsächlich dem Namen in der URL entspricht.
* Und das Zertifikat korrekt selbst-signiert ist. D.h. insbesondere auch, dass das Zertifikat das CA-Flag auf true gesetzt hat, weil nur in diesem Fall darf das Zertifikat überhaupt zum signieren benutzt werden.
1
2
3
4
5
6
my $ua = LWP::UserAgent->new(
ssl_opts => {
SSL_verify_mode => SSL_VERIFY_NONE(), # ausschalten
verify_hostname => 0, # und auch aus lassen!
}
);