1

I constructed a apache mod_perl web service based on SSL.Of course, From my browser, I can access the web service using https (Of cource,I add my self-signed CA cert to brower's trust list) access the web service,but when using SOAP::Lite , I failed. This is my source code:

$ENV{HTTPS_CERT_FILE} = '/etc/pki/tls/mycerts/client.crt';
$ENV{HTTPS_KEY_FILE}  = '/etc/pki/tls/mycerts/client.key';
#$ENV{HTTPS_CA_FILE} = '/etc/pki/tls/mycerts/ca.crt';
#$ENV{HTTPS_CA_DIR}  = '/etc/pki/tls/mycerts/ca.key';
#$ENV{HTTPS_VERSION} = 3;
$ENV{SSL_ca_file}='/etc/pki/tls/mycerts/ca.crt';
$ENV{SSL_ca_pah}='/etc/pki/tls/mycerts/';
#$ENV{SSL_cert_file}='/etc/pki/tls/mycerts/client.key';
#$ENV{SSL_key_file}='/etc/pki/tls/mycerts/client.crt';
$ENV{PERL_LWP_SSL_CA_FILE}='/etc/pki/tls/mycerts/ca.crt';
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=1;
#$ENV{PERL_LWP_SSL_CA_PATH}='/etc/pki/tls/mycerts/';
use SOAP::Lite;
my $name = "wuchang";
print "\n\nCalling the SOAP Server to say hello\n\n";
print SOAP::Lite
  -> uri('http://localhost/mod_perl_rules1')
  -> proxy('https://localhost/mod_perl_rules1')
  -> result;

I get the response:

500 Can't connect to localhost:443 (certificate verify failed) at /root/Desktop/test.pl line 18

I really cannot debug this.I don't know if my certificate format is incorrect.I use openssl to generate my cert,including client cert ,server cert and my self-signed ca cert and I make CA sign the client and server cert.I really don't know what is going wrong/.

wuchang
  • 3,003
  • 8
  • 42
  • 66
  • possible duplicate of [How can I get LWP to validate SSL server certificates?](http://stackoverflow.com/questions/74358/how-can-i-get-lwp-to-validate-ssl-server-certificates) – rjzii Jul 12 '13 at 17:12

1 Answers1

-1

Simply tell it not to check the certificate. Set SSL Verify to zero like this:

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;

Hawk
  • 551
  • 8
  • 10