where %ssl_opts includes SSL_key_file, SSL_cert_file, SSL_ca_file and SSL_verify_mode. Than I accept every connection, like that:$SERVER = IO::Socket::SSL->new( Proto => 'tcp', LocalPort => $LISTEN_PORT, Listen => 5, ReuseAddr => 1, %ssl_opts, );
The IO::Socket::SSL documentation says:while(4) { last if $break_main_loop; my $CLIENT = $SERVER->accept(); if( ! $CLIENT ) { rcd_log( "fatal: $SERVER_SSL_TRAP_ERROR" ) if $opt_ssl and $SERVER +_SSL_TRAP_ERROR; next; } my $peerhost = $CLIENT->peerhost(); my $peerport = $CLIENT->peerport(); my $sockhost = $CLIENT->sockhost(); my $sockport = $CLIENT->sockport(); rcd_log( "info: connection from $peerhost:$peerport to $sockhost:$so +ckport (me)" ); # do the rest
So how I am supposed to enable the SSL caching? Adding SSL_session_cache_size to the %ssl_opts hash, doesn't do the right thing. I am trying to make 5 repeatedly connection and every time my session-id is different.SSL_session_cache_size If you make repeated connections to the same host/port and the SSL + renegotiation time is an issue, you can turn on client-side session +caching with this option by specifying a positive cache size. For suc +cessive connections, pass the SSL_reuse_ctx option to the new() calls + (or use set_default_context()) to make use of the cached sessions. T +he session cache size refers to the number of unique host/port pairs +that can be stored at one time; the oldest sessions in the cache will + be removed if new ones are added. SSL_session_cache Specifies session cache object which should be used instead of cre +ating a new. Overrules SSL_session_cache_size. This option is useful +if you want to reuse the cache, but not the rest of the context. A session cache object can be created using IO::Socket::SSL::Sessi +on_Cache->new( cachesize ). Use set_default_session_cache() to set a global cache object.
Thanksopenssl s_client -reconnect -state -prexit -connect localhost:443 -cer +t testpkey.pem
In reply to IO::Socket::SSL Server-side Session caching by dpetrov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |