Hello monks, I got little problem with Server-side SSL Session cache. I got a IO::Socket::SSL Server, which listen at a $LISTEN_PORT and accepts connection.
$SERVER = IO::Socket::SSL->new( Proto => 'tcp', LocalPort => $LISTEN_PORT, Listen => 5, ReuseAddr => 1, %ssl_opts, );
where %ssl_opts includes SSL_key_file, SSL_cert_file, SSL_ca_file and SSL_verify_mode. Than I accept every connection, like that:
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
The IO::Socket::SSL documentation says:
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.
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.
openssl s_client -reconnect -state -prexit -connect localhost:443 -cer +t testpkey.pem
Thanks

In reply to IO::Socket::SSL Server-side Session caching by dpetrov

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.