Selecting SSL_VERIFY_NONE for SSL_verify_mode

Rod Baldwin picture Rod Baldwin · Apr 8, 2013 · Viewed 34.9k times · Source

I am trying to create a client connection to an internal ssl site that does not have a certificate and needs to bypass the proxy.

I am able to bypass the proxy, and I am able to connect to the site and create a client connection, however, i am getting this ugly warning:

*******************************************************************
 Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
 is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER 
 together with SSL_ca_file|SSL_ca_path for verification.
 If you really don't want to verify the certificate and keep the
 connection open to Man-In-The-Middle attacks please set
 SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************

at C:/strawberry/perl/site/lib/LWP/Protocol/http.pm line 31

My Code:

use    RPC::XML::Client;
use    XML::Simple;
use LWP::Protocol::https;

$ENV{NO_PROXY} = '10.*';

$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

my $server = RPC::XML::Client->new("$vneUrl/api/index.ice",
                                 ssl_opts =>    { SSL_verify_mode   => 'SSL_VERIFY_NONE',
                                                 verify_hostname    => 0,   
                                                 SSL_use_cert => 0x00
                                               },
                                   );

Answer

ikegami picture ikegami · Apr 8, 2013

That message is from IO::Socket::SSL, and it refers to the constant SSL_VERIFY_NONE it exports rather than the string 'SSL_VERIFY_NONE'.

Secondly, ssl_opts is an argument of LWP::UserAgent's constructor, not RPC::XML::Client's.

Try:

use IO::Socket::SSL qw( SSL_VERIFY_NONE );

RPC::XML::Client->new($uri,
   useragent => [
      ssl_opts => {
         verify_hostname => 0,
         SSL_verify_mode => SSL_VERIFY_NONE,
      },
   ],
);