简体   繁体   中英

Error: 500 Can't connect to foo.com:443 ( unknown errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3)

I am using LWP::UserAgent version 6.03 to fetch the status of website.

   my $ua = LWP::UserAgent->new(ssl_opts => {verify_hostname => 0},);
   $ua->cookie_jar({});
   $ua->agent('Mozilla/5.0');
   push @{$ua->requests_redirectable}, 'POST';
   push @{$ua->requests_redirectable}, 'GET';

   my $url = 'https://foo.com'
   $page = $ua->get($url);
   print "Error ".$page->status_line."\n";

When I am running this code on my unix machine it giving the following status and the error message for LWP module.

   #status
   500 Can't connect to foo.com:443

   #error
   LWP::Protocol::https::Socket: SSL connect attempt failed with unknown 
   errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert 
   unexpected message at /usr/local/lib/perl5/site_perl/5.8.9/LWP/Protocol/http.pm line 51.

I tried to make use of answer given to similar question but it did not worked out. Need your valuable advice.

ran the debug

DEBUG: .../IO/Socket/SSL.pm:193: set domain to 2
DEBUG: .../IO/Socket/SSL.pm:1545: new ctx 74489552
DEBUG: .../IO/Socket/SSL.pm:334: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:336: socket connected
DEBUG: .../IO/Socket/SSL.pm:349: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:379: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:402: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:412: waiting for fd to become ready: SSL wants a  read first
DEBUG: .../IO/Socket/SSL.pm:432: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:1276: SSL connect attempt failed with unknown errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

DEBUG: .../IO/Socket/SSL.pm:398: fatal SSL error: SSL connect attempt failed with unknown errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message
DEBUG: .../IO/Socket/SSL.pm:1276: IO::Socket::INET6 configuration failederror:00000000:lib(0):func(0):reason(0)
DEBUG: .../IO/Socket/SSL.pm:1582: free ctx 74489552 open=74489552

DEBUG: .../IO/Socket/SSL.pm:1590: OK free ctx 74489552`

Yeah... This sort of thing happens when some services account for the Poodle vulnerability. I haven't done the research to find the exact cause. It just appears the in some cases the client and server don't properly negotiate the protocol. We've gotten around it by adding 'SSL_version' => 'tlsv1' to the " ssl_opts ". I don't really like it though since next protocol upgrade it will need fixing again. I'd far rather let the libraries do the negotiation on their own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM