1SSL_CTX_set_session_cache_mode(3)   OpenSSL  SSL_CTX_set_session_cache_mode(3)
2
3
4

NAME

6       SSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode -
7       enable/disable session caching
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        long SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode);
13        long SSL_CTX_get_session_cache_mode(SSL_CTX ctx);
14

DESCRIPTION

16       SSL_CTX_set_session_cache_mode() enables/disables session caching by
17       setting the operational mode for ctx to <mode>.
18
19       SSL_CTX_get_session_cache_mode() returns the currently used cache mode.
20

NOTES

22       The OpenSSL library can store/retrieve SSL/TLS sessions for later
23       reuse.  The sessions can be held in memory for each ctx, if more than
24       one SSL_CTX object is being maintained, the sessions are unique for
25       each SSL_CTX object.
26
27       In order to reuse a session, a client must send the session's id to the
28       server. It can only send exactly one id.  The server then either agrees
29       to reuse the session or it starts a full handshake (to create a new
30       session).
31
32       A server will look up the session in its internal session storage. If
33       the session is not found in internal storage or lookups for the
34       internal storage have been deactivated
35       (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP), the server will try the external
36       storage if available.
37
38       Since a client may try to reuse a session intended for use in a
39       different context, the session id context must be set by the server
40       (see SSL_CTX_set_session_id_context(3)).
41
42       The following session cache modes and modifiers are available:
43
44       SSL_SESS_CACHE_OFF
45           No session caching for client or server takes place.
46
47       SSL_SESS_CACHE_CLIENT
48           Client sessions are added to the session cache. As there is no
49           reliable way for the OpenSSL library to know whether a session
50           should be reused or which session to choose (due to the abstract
51           BIO layer the SSL engine does not have details about the
52           connection), the application must select the session to be reused
53           by using the SSL_set_session(3) function. This option is not
54           activated by default.
55
56       SSL_SESS_CACHE_SERVER
57           Server sessions are added to the session cache. When a client
58           proposes a session to be reused, the server looks for the
59           corresponding session in (first) the internal session cache (unless
60           SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), then (second) in the
61           external cache if available. If the session is found, the server
62           will try to reuse the session.  This is the default.
63
64       SSL_SESS_CACHE_BOTH
65           Enable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the
66           same time.
67
68       SSL_SESS_CACHE_NO_AUTO_CLEAR
69           Normally the session cache is checked for expired sessions every
70           255 connections using the SSL_CTX_flush_sessions(3) function. Since
71           this may lead to a delay which cannot be controlled, the automatic
72           flushing may be disabled and SSL_CTX_flush_sessions(3) can be
73           called explicitly by the application.
74
75       SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
76           By setting this flag, session-resume operations in an SSL/TLS
77           server will not automatically look up sessions in the internal
78           cache, even if sessions are automatically stored there. If external
79           session caching callbacks are in use, this flag guarantees that all
80           lookups are directed to the external cache.  As automatic lookup
81           only applies for SSL/TLS servers, the flag has no effect on
82           clients.
83
84       SSL_SESS_CACHE_NO_INTERNAL_STORE
85           Depending on the presence of SSL_SESS_CACHE_CLIENT and/or
86           SSL_SESS_CACHE_SERVER, sessions negotiated in an SSL/TLS handshake
87           may be cached for possible reuse.  Normally a new session is added
88           to the internal cache as well as any external session caching
89           (callback) that is configured for the SSL_CTX. This flag will
90           prevent sessions being stored in the internal cache (though the
91           application can add them manually using SSL_CTX_add_session(3)).
92           Note: in any SSL/TLS servers where external caching is configured,
93           any successful session lookups in the external cache (ie. for
94           session-resume requests) would normally be copied into the local
95           cache before processing continues - this flag prevents these
96           additions to the internal cache as well.
97
98       SSL_SESS_CACHE_NO_INTERNAL
99           Enable both SSL_SESS_CACHE_NO_INTERNAL_LOOKUP and
100           SSL_SESS_CACHE_NO_INTERNAL_STORE at the same time.
101
102       The default mode is SSL_SESS_CACHE_SERVER.
103

RETURN VALUES

105       SSL_CTX_set_session_cache_mode() returns the previously set cache mode.
106
107       SSL_CTX_get_session_cache_mode() returns the currently set cache mode.
108

SEE ALSO

110       ssl(3), SSL_set_session(3), SSL_session_reused(3),
111       SSL_CTX_add_session(3), SSL_CTX_sess_number(3),
112       SSL_CTX_sess_set_cache_size(3), SSL_CTX_sess_set_get_cb(3),
113       SSL_CTX_set_session_id_context(3), SSL_CTX_set_timeout(3),
114       SSL_CTX_flush_sessions(3)
115

HISTORY

117       SSL_SESS_CACHE_NO_INTERNAL_STORE and SSL_SESS_CACHE_NO_INTERNAL were
118       introduced in OpenSSL 0.9.6h.
119
120
121
1221.0.2o                            2019-09-10 SSL_CTX_set_session_cache_mode(3)
Impressum