SSLClient Authentification
Zur Navigation springen
Zur Suche springen
Per Perl mittels SSL-Client-Certifikat an einer Webseite anmelden:
#!/usr/bin/perl use IO::Socket::SSL;# qw(debug4); $host = "www.server.tld"; $port = 443; $url = "/login"; $client_cert ="client.pem"; $client_key ="client_key.pem"; $key_passwd = "client_passwd"; my $client = new IO::Socket::SSL(SSL_use_cert => 1, #SSL_verify_mode => 0x01, SSL_cert_file => $client_cert, SSL_key_file => $client_key, SSL_passwd_cb => sub { return ($key_passwd)}, #SSL_ca_file => $trusted_ca_file, #SSL_ca_path => $trusted_ca_path, PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => '5' ); if ($client) { print $client "GET $url HTTP/1.0\r\n\r\n"; print <$client>; close $client; } else { warn "I encountered a problem: ", IO::Socket::SSL::errstr(); }