Jemand zu Hause?
LWP::UserAgent eine gesicherte Verbindung zu einem Dienstleister herzustellen. Leider erhalte ich dabei aber ständig den Fehler "Ein nicht blockierender Socketvorgang konnte nicht sofort ausgeführt werden."
LWP::UserAgent 6.06
IO::Socket::SSL 2.012
Net::SSLeay 1.662015-03-23T14:04:19 GwenDragonCrypt::SSLeay is up to date (0.72).Crypt::SSLeay?
2015-03-23T14:04:19 GwenDragonJa, hatte Ende letzter Woche das gesamte Perl inkl. aller Module komplett neu installiert. Und CPAN hat die jeweils letzte Version von allem installiert (hoffe ich).Überall die wirklich letzten aktuiellen Versipnen auch der anderen Module?
Crypt::OpenSSL::AES.
IO::Socket::SSL es kaputt macht. Sobald das drauf ist funktionieren keine SSL Verbindungen mehr. Aber wie kann das sein? Laut Log überschreibt es doch nichts, was schon da ist.Quotecpan> install IO::Socket::SSL
Database was generated on Tue, 24 Mar 2015 08:07:12 GMT
Running install for module 'IO::Socket::SSL'
Checksum for C:\strawberry\cpan\sources\authors\id\S\SU\SULLR\IO-Socket-SSL-2.012.tar.gz ok
Scanning cache C:\strawberry\cpan\build for sizes
............................................................................DONE
Configuring S/SU/SULLR/IO-Socket-SSL-2.012.tar.gz with Makefile.PL
Should I do external tests?
These test will detect if there are network problems and fail soft,
so please disable them only if you definitely don't want to have any
network traffic to external sites. [Y/n] [y]
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for IO::Socket::SSL
Writing MYMETA.yml and MYMETA.json
SULLR/IO-Socket-SSL-2.012.tar.gz
C:\strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for S/SU/SULLR/IO-Socket-SSL-2.012.tar.gz
cp lib/IO/Socket/SSL/Intercept.pm blib\lib\IO\Socket\SSL\Intercept.pm
cp lib/IO/Socket/SSL/Utils.pm blib\lib\IO\Socket\SSL\Utils.pm
cp lib/IO/Socket/SSL.pod blib\lib\IO\Socket\SSL.pod
cp lib/IO/Socket/SSL.pm blib\lib\IO\Socket\SSL.pm
cp lib/IO/Socket/SSL/PublicSuffix.pm blib\lib\IO\Socket\SSL\PublicSuffix.pm
SULLR/IO-Socket-SSL-2.012.tar.gz
C:\strawberry\c\bin\dmake.exe -- OK
Running make test
C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harne
ss(0, 'blib\lib', 'blib\arch')" t/*.t t/external/*.t
t/01loadmodule.t .................. # openssl version=0x1000107f
# Net::SSLeay::VERSION=1.66
t/01loadmodule.t .................. ok
t/acceptSSL-timeout.t ............. ok
t/alpn.t .......................... skipped: ALPN not available in Net::SSLeay
t/auto_verify_hostname.t .......... ok
t/cert_formats.t .................. ok
t/cert_no_file.t .................. ok
t/compatibility.t ................. ok
t/connectSSL-timeout.t ............ ok
t/core.t .......................... ok
t/dhe.t ........................... ok
t/ecdhe.t ......................... ok
t/external/ocsp.t ................. # tcp connect to www.live.com:443 ok
# fingerprint matches
# validation with default CA w/o OCSP ok
# got stapled response as expected
# validation with default CA with OCSP defaults ok
# validation with default CA with OCSP full chain ok
t/external/ocsp.t ................. 1/3 # tcp connect to www.google.com:443 ok
# tcp connect to revoked.grc.com:443 ok
# fingerprint matches
# validation with default CA w/o OCSP ok
t/external/ocsp.t ................. ok
t/external/usable_ca.t ............ # found 154 CA certs
# have root CA for www.google.com in store
# 5 connections to www.google.com ok
t/external/usable_ca.t ............ 1/21 # have root CA for www.yahoo.com in store
# 5 connections to www.yahoo.com ok
# fingerprint www.yahoo.com matches
# check www.yahoo.com against builtin CA store ok
t/external/usable_ca.t ............ 4/21 # have root CA for www.comdirect.de in store
# 5 connections to www.comdirect.de ok
# fingerprint www.comdirect.de matches
# check www.comdirect.de against builtin CA store ok
t/external/usable_ca.t ............ 7/21 # have root CA for meine.deutsche-bank.de in store
# 5 connections to meine.deutsche-bank.de ok
# fingerprint meine.deutsche-bank.de matches
# check meine.deutsche-bank.de against builtin CA store ok
t/external/usable_ca.t ............ 12/21 # have root CA for www.twitter.com in store
# 5 connections to www.twitter.com ok
# have root CA for www.facebook.com in store
# 5 connections to www.facebook.com ok
# have root CA for www.live.com in store
# 5 connections to www.live.com ok
# fingerprint www.live.com matches
# check www.live.com against builtin CA store ok
t/external/usable_ca.t ............ ok
t/io-socket-inet6.t ............... ok
t/io-socket-ip.t .................. ok
t/memleak_bad_handshake.t ......... skipped: ps not implemented on this platform
t/mitm.t .......................... ok
t/nonblock.t ...................... ok
t/npn.t ........................... ok
t/plain_upgrade_downgrade.t ....... # -- test: newINET start_SSL stop_SSL start_SSL
# server accepted new client
# wait for initial data from client
# got 0x666f6f from client
# server: got plain data at start of connection
# server: TLS upgrade
t/plain_upgrade_downgrade.t ....... 1/15 # server: TLS downgrade
# server: TLS upgrade#2
# -- test: newSSL stop_SSL connect_SSL
# server accepted new client
# wait for initial data from client
# got 0x160301 from client
# server: TLS upgrade
# server: TLS downgrade
# server: TLS upgrade#2
# -- test: newSSL:0 connect_SSL stop_SSL connect_SSL
# server accepted new client
# wait for initial data from client
# got 0x666f6f from client
# server: got plain data at start of connection
# server: TLS upgrade
# server: TLS downgrade
# server: TLS upgrade#2
# -- test: newSSL:0 start_SSL stop_SSL connect_SSL
# server accepted new client
# wait for initial data from client
# got 0x666f6f from client
# server: got plain data at start of connection
# server: TLS upgrade
# server: TLS downgrade
# server: TLS upgrade#2
# server accepted new client
# wait for initial data from client
# got 0x656e64 from client
# client requested end of tests
t/plain_upgrade_downgrade.t ....... ok
t/protocol_version.t .............. ok
t/public_suffix_lib_encode_idn.t .. ok
t/public_suffix_lib_libidn.t ...... ok
t/public_suffix_lib_uri.t ......... ok
t/public_suffix_ssl.t ............. ok
t/readline.t ...................... ok
t/sessions.t ...................... ok
t/signal-readline.t ............... skipped: signals not relevant on this platform
t/sni.t ........................... ok
t/sni_verify.t .................... ok
t/start-stopssl.t ................. ok
t/startssl-failed.t ............... ok
t/startssl.t ...................... ok
t/sysread_write.t ................. ok
t/verify_fingerprint.t ............ ok
t/verify_hostname.t ............... ok
t/verify_hostname_standalone.t .... ok
All tests successful.
Files=37, Tests=765, 129 wallclock secs ( 0.28 usr + 0.05 sys = 0.33 CPU)
Result: PASS
SULLR/IO-Socket-SSL-2.012.tar.gz
C:\strawberry\c\bin\dmake.exe test -- OK
Running make install
Installing C:\strawberry\perl\site\lib\IO\Socket\SSL.pm
Installing C:\strawberry\perl\site\lib\IO\Socket\SSL.pod
Installing C:\strawberry\perl\site\lib\IO\Socket\SSL\Intercept.pm
Installing C:\strawberry\perl\site\lib\IO\Socket\SSL\PublicSuffix.pm
Installing C:\strawberry\perl\site\lib\IO\Socket\SSL\Utils.pm
Appending installation info to C:\strawberry\perl\lib/perllocal.pod
SULLR/IO-Socket-SSL-2.012.tar.gz
C:\strawberry\c\bin\dmake.exe install UNINST=1 -- OK
Net::FTP kein SSL macht ohne
IO::Socket::SSL.
IO::Socket::SSL scheinbar hier auf Win 7 64 Bit die HTTPS Kommunikation kaputt macht?
2015-03-24T11:35:23 GwenDragonWie machst du das mit der Überprüfung der Zertifikate bei SSL?
1 2 3 4 5 6
my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0, }, cookie_jar => {}, );
1 2 3 4 5 6 7
my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 1, SSL_ca_file => '/pfad/datei.ca', # CA Datei vom Dienstleister bekommen, mit SOAP::Lite funktioniert diese }, cookie_jar => {}, );
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
#!/usr/bin/perl use strict; use warnings; use 5.010; use Net::FTP; my $ftp = Net::FTP->new( "*********.de", SSL_verify_mode => 1, SSL_ca_file => 'X:\etc\ssl\certs\cacerts.pem', Debug => 1 ) or die "Cannot connect: $@"; $ftp->starttls(); $ftp->passive(); $ftp->login("*********",'****************') or die "Cannot login ", $ftp->message; $ftp->cwd("/") or die "Cannot change working directory ", $ftp->message; my @files = $ftp->ls() or die "ls failed ", $ftp->message; say for @files; $ftp->quit();
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
T:\>perl -v
This is perl 5, version 18, subversion 4 (v5.18.4) built for MSWin32-x64-multi-thread
Copyright 1987-2013, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
T:\>perl f.pl
Net::FTP>>> Net::FTP(3.05)
Net::FTP>>> Exporter(5.70)
Net::FTP>>> Net::Cmd(3.05)
Net::FTP>>> IO::Socket::SSL(2.012)
Net::FTP>>> IO::Socket::IP(0.32)
Net::FTP>>> IO::Socket(1.36)
Net::FTP>>> IO::Handle(1.34)
Net::FTP=GLOB(0x2e8e0a8)<<< 220 ***.***.**.*** FTP server ready
Net::FTP=GLOB(0x2e8e0a8)>>> AUTH TLS
Net::FTP=GLOB(0x2e8e0a8)<<< 234 AUTH TLS successful
Net::FTP=GLOB(0x2e8e0a8)>>> PBSZ 0
Net::FTP=GLOB(0x2e8e0a8)<<< 200 PBSZ 0 successful
Net::FTP=GLOB(0x2e8e0a8)>>> PROT P
Net::FTP=GLOB(0x2e8e0a8)<<< 200 Protection set to Private
Net::FTP=GLOB(0x2e8e0a8)>>> USER us123456789
Net::FTP=GLOB(0x2e8e0a8)<<< 331 Password required for us123456789
Net::FTP=GLOB(0x2e8e0a8)>>> PASS ....
Net::FTP=GLOB(0x2e8e0a8)<<< 230 User us123456789 logged in
Net::FTP=GLOB(0x2e8e0a8)>>> CWD /
Net::FTP=GLOB(0x2e8e0a8)<<< 250 CWD command successful
Net::FTP=GLOB(0x2e8e0a8)>>> PASV
Net::FTP=GLOB(0x2e8e0a8)<<< 227 Entering Passive Mode (***,***,***,***,**,**).
Net::FTP=GLOB(0x2e8e0a8)>>> NLST
Net::FTP=GLOB(0x2e8e0a8)<<< 150 Opening BINARY mode data connection for file list
Net::FTP=GLOB(0x2e8e0a8)<<< 226 Transfer complete
favicon.ico
404.html
index.html
Net::FTP=GLOB(0x2e8e0a8)>>> QUIT
Net::FTP=GLOB(0x2e8e0a8)<<< 221 Goodbye.
Quotecpan> notest install Net::FTP IO::Socket::SSL LWP LWP::Protocol::https
Database was generated on Tue, 24 Mar 2015 08:07:12 GMT
Net::FTP is up to date (3.05).
IO::Socket::SSL is up to date (2.012).
LWP is up to date (6.13).
LWP::Protocol::https is up to date (6.06).
IO::Socket::SSL vorhanden ist. Das ist wirklich eine 1:1 Abhängigkeit. Lösche ich das Verzeichnis gehen SOAP und LWP mit SSL wieder.
IO::Socket::SSL 1.998
Net::FTP 3.05
Net::SSLeay 1.66
SOAP::Lite 1.11
LWP::UserAgent 6.06
IO::Socket::SSL, Log hat sich nicht geändert, siehe msg #1803181 2 3 4 5 6 7 8 9 10 11 12 13 14 15
READ: { die "read timeout" unless $self->can_read; my $n = $self->sysread($_, 1024, length); unless (defined $n) { redo READ if $!{EINTR} || $!{EAGAIN}; # if we have already accumulated some data let's at least # return that as a line die "$what read failed: $!" unless length; # <= ZEILE 276 } unless ($n) { return undef unless length; return substr($_, 0, length, ""); } }
1 2 3 4 5 6 7 8 9 10
my @result = (); my $result; eval { $result = $expat->parse($arg); # <= Zeile 187 }; my $err = $@; if ($err) { $expat->release; die $err; }
Crypt::SSLeay verhält es sich so, dass der LWP ab Version 6.02 selbst kein SSL mehr kann sondern diese in
LWP::Protocol::https ausgelagert wurde.
Crypt::SSLeay sondern
IO::Socket::SSL verwendet, wenn
IO::Socket::SSL da ist. Das klärt meine Frage, warum alles läuft, wenn
IO::Socket::SSL nicht da ist.
IO::Socket::SSL lässt seinerseits die Abschaltung der Hostnamen Überprüfung nicht mehr zu, sie *MUSS* gemacht werden (obwohl das in der Doku zu LWP noch anders steht), verify_hostname => 0 gibts nicht mehr, das heißt, man braucht zwingend Zertifikate.
Mozilla::CA installiert.
IO::Socket::SSL lösche und die Zertifikatsprüfung abschalte klappt jeder Request.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
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 1 } ); $ua->add_handler("request_send", sub { print "\n\n***** Request *****\n"; shift->dump; return }); $ua->add_handler("response_done", sub { print "\n\n***** Response *****\n"; shift->dump; return }); my $stop = 0; my $versuch = 0; my %felder = ( foo => 'bar' ); while(!$stop) { $versuch ++; print "////// VERSUCH $versuch \\\\\\\\\\\\\n"; my $response = $ua->post('https: //ssl. ibanrechner .de/http.html',\%felder); # BLANKS ENTFERNEN!!! $stop = 1 if $response->is_success; } print "\n\n-------------------------------------------------------------\n"; print "Version IO::Socket::SSL: ".(defined $IO::Socket::SSL::VERSION ? $IO::Socket::SSL::VERSION : '- nicht inst. -')."\n"; print "Version Crypt::SSLeay: ".(defined $Crypt::SSLeay::VERSION ? $Crypt::SSLeay::VERSION : '- nicht inst. -')."\n"; print "Version LWP::UserAgent: ".$LWP::UserAgent::VERSION."\n"; print "Version Mozilla::CA: ".(defined $Mozilla::CA::VERSION ? $Mozilla::CA::VERSION : '- nicht inst. -')."\n";
IO::Socket::SSL kommt Fehler "Ein nicht blockierender Socketvorgang konnte nicht sofort ausgef³hrt werden".