1 2 3 4 5 6 7 8 9 10 11 12
my $d = JSON::RPC::Server::Daemon->new( LocalAddr => $cfg->val('daemon', 'addr'), LocalPort => $cfg->val('daemon', 'port'), ReuseAddr => 1, Timeout => $cfg->val('daemon', 'timeout'), SSL_use_cert => 1, SSL_server => 1, SSL_verify_mode => 0x01, SSL_ca_file => $cfg->val('ssl', 'ca_file'), SSL_cert_file => $cfg->val('ssl', 'cert_file'), SSL_key_file => $cfg->val('ssl', 'key_file'), );
1 2 3 4 5 6
my $c = JSON::RPC::Simple::Client->new("https://127.0.0.1:4711/json-rpc/API"); my $results = $c->echo({ lala => 'foo', lalu => 'bar', });
QuoteSSL_verify_mode
Type of verification process which is to be performed upon a peer certificate. This can be a combination of 0x00 (don't verify), 0x01 (verify peer), 0x02 (fail verification if there's no peer certificate), and 0x04 (verify client once). Default: verify peer.
LWP::Protocol::https::Socket: SSL connect attempt failed because of handshake problemserror:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure at /usr/lib/perl5/vendor_perl/5.12.3/LWP/Protocol/http.pm line 57.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#!/usr/bin/env perl package testAPI; use base qw(JSON::RPC::Procedure); sub echo : Public { my ($self, $data) = @_; return $data; } 1; use strict; use warnings; use JSON::RPC::Server::Daemon; my $d = JSON::RPC::Server::Daemon->new( LocalAddr => '127.0.0.1', LocalPort => 4711, ReuseAddr => 1, Timeout => 30, SSL_use_cert => 1, SSL_server => 1, SSL_verify_mode => 0x03, SSL_ca_file => "ssl/cacert.pem", SSL_cert_file => "ssl/server-cert.pem", SSL_key_file => "ssl/server-key.pem", SSL_passwd_cb => sub { return 'system' }, ); $d->dispatch({ '/json-rpc/API' => 'testAPI', }); $d->handle();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/bin/env perl use strict; use warnings; use JSON::RPC::Simple::Client; use Data::Dumper; my $c = JSON::RPC::Simple::Client->new("https://127.0.0.1:4711/json-rpc/API", { debug => 2, SSL_ca_file => "ssl/cacert.pem", SSL_cert_file => "ssl/client-cert.pem", SSL_key_file => "ssl/client-key.pem", SSL_passwd_cb => sub { return 'system' }, }); my $results = $c->echo({ lala => 'foo', lalu => 'bar', }); print Data::Dumper::Dumper($results) . "\n";
2011-07-20T11:15:18 GwenDragonFordert der Server denn ein Client cert auch an?