Thread LWP::UserAgent SSL ausschalten (14 answers)
Opened by bianca at 2015-11-05 08:05

bianca
 2015-11-06 07:02
#182781 #182781
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
Danke GwenDragon, janus und noxxi für die Antworten!

Der Aufruf lautet nun:
Code (perl): (dl )
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(),
);
gegen https://192.168.0.50/cgi-bin/meinscript.pl

und leider ist das immer noch nicht so wie ich das erwarten würde:
Code: (dl )
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' );


Ist das Bad file descriptor at C:/strawberry/perl/site/lib/LWP/Protocol/http.pm line 50. da mittendrin in Ordnung?

2015-11-05T22:44:44 noxxi
Der bessere Weg ist natürlich die Zetifikatsverifikation nicht auszuschalten, weil ohne die Validierung kann man leicht man-in-the-middle Angriffe machen.

Ja, das simmt. Für mich ist das in diesem Fall nicht wichtig, weil a) es im LAN läuft und b) ein ganz harmloser Aufruf ohne irgendwelchen Datenaustausch ist. Ich hätte das am liebsten per Ajax gemacht aber die SOP steht mir in diesem Fall im Weg, weil das Script vom lokalen Webserver bedient wird, was auch so bleiben muss.

2015-11-05T22:44:44 noxxi
Der 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.

Vor etlicher Zeit hatte ich da tatsächlich mal was probiert aber am Ende funktionierte es trotzdem nicht. Ich will mich da schon immer mal eingearbeitet haben aber es findet sich so wenig deutsche Literatur dazu.
10 print "Hallo"
20 goto 10

View full thread LWP::UserAgent SSL ausschalten