dmwm / PHEDEX

CMS data-placement suite
8 stars 18 forks source link

Update perl SSL client used by PhEDEX #1066

Open nikmagini opened 7 years ago

nikmagini commented 7 years ago

The 'phedex' CLI, the Lifecycle and Spacemon (through PHEDEX::CLI::UserAgent and PHEDEX::Testbed::Lifecycle::Datasvc) depend on the Net::SSL module which is distributed with the perl-Crypt-SSLeay rpm

Net::SSL is obsolete and can be replaced by the newer IO::Socket::SSL module (perl-IO-Socket-SSL rpm), but the syntax is different so this requires some changes to UserAgent. Specifically the SSL options need to be passed through a function instead of env variables. Example below:

Old syntax:

===

use Net::SSL;

use LWP::UserAgent;
        $ENV{HTTPS_CERT_FILE} = '/data/ProdNodes/niccocert';
        $ENV{HTTPS_KEY_FILE}  = '/data/ProdNodes/niccocert';
        $ENV{HTTPS_CA_FILE}   = '/data/ProdNodes/niccocert';
        $ENV{HTTPS_CA_DIR}    = '/etc/grid-security/certificates';
my $ua = LWP::UserAgent->new();

===

New syntax:

===

use IO::Socket::SSL;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
$ua->ssl_opts(
 SSL_cert_file => '/data/ProdNodes/niccocert',
 SSL_key_file => '/data/ProdNodes/niccocert',
 SSL_ca_path => '/etc/grid-security/certificates',
 SSL_ca_file => '/data/ProdNodes/niccocert', 
);

===

Also remember to update rpm dependencies of PHEDEX to add the perl-IO-Socket-SSL rpm if/when this is done.