Thread JSON::RPC::Server & IO::Socket::SSL client-cert (5 answers)
Opened by foobar12345 at 2011-07-20 12:48

foobar12345
 2011-07-20 21:09
#150629 #150629
User since
2011-07-20
20 Artikel
BenutzerIn
[default_avatar]
ja, 0x03 scheint was zu tun, fast ;(

bei einem connect mit dem client kommt jetzt

Code: (dl )
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.


ich seh den wald vor lauter bäumen nicht mehr ...
eventuell kann mir jemand helfen, deshalb hier mal der server
Code (perl): (dl )
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();


und hier der client

Code (perl): (dl )
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";


zum eventuellen test ...
Last edited: 2011-07-20 21:10:29 +0200 (CEST)

View full thread JSON::RPC::Server & IO::Socket::SSL client-cert