From 72587a1849c3d2fd538c49450490eaa6cb699399 Mon Sep 17 00:00:00 2001 From: PETIT Jeremy <Jeremy.PETIT@ext.ec.europa.eu> Date: Thu, 15 Sep 2022 15:41:30 +0200 Subject: [PATCH] Recommit important ssl initialization for the fie --- bin/synchronize_proteus_Users.pl | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/bin/synchronize_proteus_Users.pl b/bin/synchronize_proteus_Users.pl index 4e274e3..c055a07 100755 --- a/bin/synchronize_proteus_Users.pl +++ b/bin/synchronize_proteus_Users.pl @@ -14,12 +14,30 @@ use Net::LDAP; use File::Copy; use File::Basename; use Sys::Hostname; +use Sys::Hostname::Long; + +use IO::Socket::SSL; + +no if $] >= 5.017011, warnings => 'experimental::smartmatch'; + +my $SERVER = 'SERVER'; +if ( $] eq '5.020002' ) { + + # jessie + $SERVER = 'SERVER'; +} else { + $SERVER = 'SERVER_PROXY'; + + # set some variables in order to disable SSL certificate check due to stunnel + $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; + $ENV{HTTPS_DEBUG} = 1; + IO::Socket::SSL::set_ctx_defaults( SSL_verifycn_scheme => 'www', + SSL_verify_mode => 0 ); +} # unbuffered output: $| = 1; -use lib ( new Config::IniFiles( -file => "/opt/etc/ini/global.ini" )->val( 'APPLICATION', 'LIBRARY' ) ); - BEGIN { my $iniFile = new Config::IniFiles( -file => "/opt/etc/ini/global.ini" ); push( @INC, $iniFile->val( 'APPLICATION', 'LIBRARY' ) ); @@ -29,14 +47,20 @@ use SNET::common; use SNET::snmpd; use SNET::LdapNS qw(:all); use SNET::libsoap; +## load the Proteus API +use Proteus::API; +use Proteus::SNET; -use vars qw($verbose $debug $help $force $cli_mode $dry_run ); +use vars qw($verbose $debug $help $script $cli_mode $force $dry_run ); $verbose = 0; $debug = 0; $cli_mode = 1; my $PROGNAME = basename( $0 ); $PROGNAME =~ s/\.p[lm]$//; +( $script ) = split( /\./, basename( $0 ) ); +my $hostname = hostname(); +my $fqdn = hostname_long(); my %options = ( "help" => \$help, @@ -270,7 +294,7 @@ my $proteusUser = $PiniFile->val( 'PROTEUS_SOAP', 'USER' ); print "error value of proteusUser is undefined" if ( !defined( $proteusUser ) ); my $proteusPass = $PiniFile->val( 'PROTEUS_SOAP', 'PASSWORD' ); print "error value of proteusPass is undefined" if ( !defined( $proteusPass ) ); -my $proteusServer = $PiniFile->val( 'PROTEUS_SOAP', 'SERVER' ); +my $proteusServer = $PiniFile->val( 'PROTEUS_SOAP', $SERVER ); print "error value of proteusDbServer is undefined" if ( !defined( $proteusServer ) ); my $Proteus_cfg_name = $PiniFile->val( 'GLOBAL', 'CONFIG' ); print "error value of Proteus_cfg_name is undefined" if ( !defined( $Proteus_cfg_name ) ); -- GitLab