http://www.perlmonks.org?node_id=969574


in reply to RFC - PERL SCRIPT TO SSH MULTIPLE SERVER NODES, CHECKS OF SSL CERTIFICATES EXPIRY AND EMAIL TO ROOT

for my $box (@servers) { my $ssh = Net::OpenSSH->new($box, user => $user, password => $password); if ($ssh->error) { warn "unable to connect to $box"; next; } for my $certfile (@certfiles) { my $output = $ssh->capture('openssl', 'x509', '-in', "/etc/pki/tls/$certfile", '-noout', '-subject', '-hash', '-enddate'); unless ($output =~ /notAfter=(\S+)/) { warn "expiration data not found in $box:$certfile" next; } my $notAfter = $1; ... } }
  • Comment on Re: RFC - PERL SCRIPT TO SSH MULTIPLE SERVER NODES, CHECKS OF SSL CERTIFICATES EXPIRY AND EMAIL TO ROOT
  • Download Code