SSL handshake problem

Michael Fung mike at 3open.org
Wed Feb 13 08:38:26 CET 2013


Dear All,


I run out of ideas and hope someone could help.

I want to run a tcp server with forked children to handle thousands of 
concurrent clients. The code is working okay in plain text. However, 
when I switch on SSL support:

### parent code:
my $server_socket = IO::Socket::INET->new(		
	Listen => 20,
	LocalAddr => '0.0.0.0',
	ReuseAddr => 1,
	LocalPort => 9123,
	Blocking => 0,	
)

# fork n child ...
...
### child code:
my $w = AE::io $server_socket, 0, sub {
	while(accept my $client_socket, $server_socket) {					
		my $handles->{$client_id} = new AnyEvent::Handle(
			fh => $client_socket,
			tls => 'accept',
			tls_ctx => {
				method => 'any',
				key_file => 'key.pem',
				cert_file => 'cert.pem',
			},

		on_read => sub { ... },
		on_error => sub { ... },
...
$mainloop->recv;

Test with openssl failed:
$openssl s_client -CAfile cacert.pem -connect hostname:9123
> CONNECTED(00000003)
> write:errno=104
> ---
> no peer certificate available
> ---
> No client certificate CA names sent
> ---
> SSL handshake has read 0 bytes and written 320 bytes
> ---
> New, (NONE), Cipher is (NONE)
> Secure Renegotiation IS NOT supported
> Compression: NONE
> Expansion: NONE
> ---


Any hints are welcome.

Thanks,
Michael




More information about the anyevent mailing list