HP Remote Insight Lights-Out Edition RILOE II Manuel De L'utilisateur page 212

Table des Matières

Publicité

212
Remote Insight Lights-Out Edition II Manuel de l'utilisateur
# opens an ssl connection to port 443 of the passed host
#
sub openSSLconnection($)
{
}
my $host = shift;
my ($ctx, $ssl, $sin, $ip, $nip);
if (not $ip = inet_aton($host))
{
print "$host is a DNS Name, performing lookup\n" if
$debug;
$ip = gethostbyname($host) or die "ERROR: Host
$hostname not found.\n";
}
$nip = inet_ntoa($ip);
print STDERR "Connecting to $nip:443\n";
$sin = sockaddr_in(443, $ip);
socket (S, &AF_INET, &SOCK_STREAM, 0) or die "ERROR:
socket: $!";
connect (S, $sin) or die "connect: $!";
$ctx = Net::SSLeay::CTX_new() or die_now("ERROR:
Failed to create SSL_CTX $! ");
Net::SSLeay::CTX_set_options($ctx,
&Net::SSLeay::OP_ALL);
die_if_ssl_error("ERROR: ssl ctx set options");
$ssl = Net::SSLeay::new($ctx) or die_now("ERROR:
Failed to create SSL $!");
Net::SSLeay::set_fd($ssl, fileno(S));
Net::SSLeay::connect($ssl) and
die_if_ssl_error("ERROR: ssl connect");
print STDERR 'SSL Connected ';
print 'Using Cipher: ' .
Net::SSLeay::get_cipher($ssl) if $debug;
print STDERR "\n\n";
return $ssl;

Publicité

Table des Matières
loading

Table des Matières