| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_tls_shmcache</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_tls_shmcache</code></b></h2> |
| 12 | </center> |
| 13 | <hr> |
| 14 | |
| 15 | <p> |
| 16 | The <code>mod_tls_shmcache</code> submodule is contained in the |
| 17 | <code>mod_tls_shmcache.c</code> file, and is not compiled by default. |
| 18 | Installation instructions are discussed <a href="#Installation">here</a>. |
| 19 | |
| 20 | <p> |
| 21 | This submodule provides a SysV shared memory-based implementation of |
| 22 | an external SSL session cache for use by the <code>mod_tls</code> module's |
| 23 | <a href="mod_tls.html#TLSSessionCache"><code>TLSSessionCache</code></a> |
| 24 | directive. The module also implements a SysV shared memory-based |
| 25 | implementation of an external OCSP response cache for the |
| 26 | <a href="mod_tls.html#TLSStaplingCache"><code>TLSStaplingCache</code></a> |
| 27 | directive. |
| 28 | |
| 29 | <p> |
| 30 | This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). |
| 31 | |
| 32 | <p> |
| 33 | This product includes cryptographic software written by Eric Young ([email protected]). |
| 34 | |
| 35 | <h2>Author</h2> |
| 36 | <p> |
| 37 | Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any |
| 38 | questions, concerns, or suggestions regarding this module. |
| 39 | |
| 40 | <p> |
| 41 | The <code>mod_tls_shmcache</code> module supports the "shm" string |
| 42 | for the <em>type</em> parameter of the |
| 43 | <a href="mod_tls.html#TLSSessionCache"><code>TLSSessionCache</code></a> |
| 44 | configuration directive. The <em>info</em> parameter for |
| 45 | <code>mod_tls_shmcache</code> must be formatted like: |
| 46 | <pre> |
| 47 | /file=<i>/path/to/cache/file</i>[&size=<i>bytes</i>] |
| 48 | </pre> |
| 49 | The configured path is used for synchronizing access to the shared memory |
| 50 | segment among the various server processes. The default shared memory |
| 51 | segment size allocated is 1.5MB; use the optional <em>size</em> key to |
| 52 | configure a different size, in bytes. Note that the configured size |
| 53 | <i>must</i> be able to hold at least one cached session; if a too-small size |
| 54 | is configured, that size will be ignored and the default size will be used. |
| 55 | |
| 56 | <p> |
| 57 | The <code>mod_tls_shmcache</code> module also supports the "shm" |
| 58 | string for the <em>type</em> parameter of the |
| 59 | <a href="mod_tls.html#TLSStaplingCache"><code>TLStaplingCache</code></a> |
| 60 | configuration directive. The <em>info</em> parameter for |
| 61 | <code>mod_tls_shmcache</code> must be formatted like: |
| 62 | <pre> |
| 63 | /file=<i>/path/to/cache/file</i>[&size=<i>bytes</i>] |
| 64 | </pre> |
| 65 | The configured path is used for synchronizing access to the shared memory |
| 66 | segment among the various server processes. The default shared memory |
| 67 | segment size allocated is 1.5MB; use the optional <em>size</em> key to |
| 68 | configure a different size, in bytes. Note that the configured size |
| 69 | <i>must</i> be able to hold at least one cached OCSP response; if a too-small |
| 70 | size is configured, that size will be ignored and the default size will be used. |
| 71 | |
| 72 | <p> |
| 73 | <b>Examples</b><br> |
| 74 | |
| 75 | <p> |
| 76 | Use the default shared memory segment size and timeout: |
| 77 | <pre> |
| 78 | <IfModule mod_tls.c> |
| 79 | ... |
| 80 | |
| 81 | <IfModule mod_tls_shmcache.c> |
| 82 | TLSSessionCache shm:/file=/var/ftpd/sess_cache |
| 83 | TLSStaplingCache shm:/file=/var/ftpd/ocsp_pcache |
| 84 | </IfModule> |
| 85 | </IfModule> |
| 86 | </pre> |
| 87 | |
| 88 | <p> |
| 89 | Use a larger shared memory segment size: |
| 90 | <pre> |
| 91 | <IfModule mod_tls.c> |
| 92 | ... |
| 93 | |
| 94 | <IfModule mod_tls_shmcache.c> |
| 95 | TLSSessionCache shm:/file=/var/ftpd/sess_cache&size=2097152 |
| 96 | TLSStaplingCache shm:/file=/var/ftpd/ocsp_cache&size=2097152 |
| 97 | </IfModule> |
| 98 | </IfModule> |
| 99 | </pre> |
| 100 | |
| 101 | <p> |
| 102 | Use a smaller shared memory size, and a shorter timeout: |
| 103 | <pre> |
| 104 | <IfModule mod_tls.c> |
| 105 | ... |
| 106 | |
| 107 | <IfModule mod_tls_shmcache.c> |
| 108 | TLSSessionCache shm:/file=/var/ftpd/sess_cache&size=512000 600 |
| 109 | |
| 110 | # Note that TLSStaplingCache does not use a timeout |
| 111 | TLSStaplingCache shm:/file=/var/ftpd/ocsp_cache&size=512000 |
| 112 | </IfModule> |
| 113 | </IfModule> |
| 114 | </pre> |
| 115 | |
| 116 | <p> |
| 117 | <hr> |
| 118 | <h2><a name="Installation">Installation</a></h2> |
| 119 | The <code>mod_tls_shmcache</code> module is distributed with the ProFTPD |
| 120 | source code. Simply follow the normal steps for using third-party modules |
| 121 | in ProFTPD, being sure to include the <code>mod_tls</code> module (on which |
| 122 | <code>mod_tls_shmcache</code> depends): |
| 123 | <pre> |
| 124 | $ ./configure --with-modules=mod_tls:mod_tls_shmcache |
| 125 | $ make |
| 126 | $ make install |
| 127 | </pre> |
| 128 | |
| 129 | <p> |
| 130 | Alternatively, if your <code>proftpd</code> was compiled with DSO support, you |
| 131 | can use the <code>prxs</code> tool to build <code>mod_tls_shmcache</code> as |
| 132 | a shared module: |
| 133 | <pre> |
| 134 | $ prxs -c -i -d mod_tls_shmcache.c |
| 135 | </pre> |
| 136 | |
| 137 | <p> |
| 138 | <b>Note</b>: If using <code>mod_tls_shmcache</code> as a shared module, make |
| 139 | sure that this module is loaded <i>after</i> the <code>mod_tls</code> module, |
| 140 | <i>i.e.</i>: |
| 141 | <pre> |
| 142 | # Load mod_tls first |
| 143 | LoadModule mod_tls.c |
| 144 | |
| 145 | # Then load any SSL caching modules |
| 146 | LoadModule mod_tls_shmcache.c |
| 147 | </pre> |
| 148 | |
| 149 | <p> |
| 150 | <hr> |
| 151 | <h2><a name="Usage">Usage</a></h2> |
| 152 | |
| 153 | <p> |
| 154 | <b>Logging</b><br> |
| 155 | The <code>mod_tls_shmcache</code> module supports <a href="../howto/Tracing.html">trace logging</a>, via the module-specific log channels: |
| 156 | <ul> |
| 157 | <li>tls.shmcache |
| 158 | </ul> |
| 159 | Thus for trace logging, to aid in debugging, you would use the following in |
| 160 | your <code>proftpd.conf</code>: |
| 161 | <pre> |
| 162 | TraceLog /path/to/ftpd/trace.log |
| 163 | Trace tls.shmcache:20 |
| 164 | </pre> |
| 165 | This trace logging can generate large files; it is intended for debugging use |
| 166 | only, and should be removed from any production configuration. |
| 167 | |
| 168 | <p><a name="FAQ"> |
| 169 | <b>Frequently Asked Questions</b><br> |
| 170 | |
| 171 | <p><a name="TLSShmcacheEmptyFile"> |
| 172 | <font color=red>Question</font>: I configured a <code>TLSSessionCache</code> file, but it is empty. Is <code>mod_tls_shmcache</code> not working properly?<br> |
| 173 | <font color=blue>Answer</font>: Yes, <code>mod_tls_shmcache</code> is working |
| 174 | properly. The actual cache of SSL/TLS session data is stored in shared memory, |
| 175 | not on the filesystem. Storing data in system shared memory requires a unique |
| 176 | key; the <code>mod_tls_shmcache</code> uses the configured file to create |
| 177 | this unique key. The module also uses the configured |
| 178 | <code>TLSSessionCache</code> file for locking, as when handling a |
| 179 | <code>ftpdctl</code> request to clear the cache. |
| 180 | |
| 181 | <p><a name="TLSShmcacheUndefinedSymbol"> |
| 182 | <font color=red>Question</font>: I am trying to use |
| 183 | <code>mod_tls_shmcache</code> as a shared module, but my <code>proftpd</code> |
| 184 | server fails to start up, failing with this error: |
| 185 | <pre> |
| 186 | proftpd: symbol lookup error: /usr/local/libexec/mod_tls_shmcache.so: undefined symbol: tls_sess_cache_register |
| 187 | </pre> |
| 188 | <font color=blue>Answer</font>: This happens when your configuration is |
| 189 | loading the <code>mod_tls_shmcache</code> module <i>before</i> the |
| 190 | <code>mod_tls</code> has been loaded. The fix, then, is to make sure |
| 191 | your config looks something like this: |
| 192 | <pre> |
| 193 | LoadModule mod_tls.c |
| 194 | LoadModule mod_tls_shmcache.c |
| 195 | </pre> |
| 196 | |
| 197 | <p> |
| 198 | <hr> |
| 199 | <font size=2><b><i> |
| 200 | © Copyright 2009-2015 TJ Saunders<br> |
| 201 | All Rights Reserved<br> |
| 202 | </i></b></font> |
| 203 | <hr> |
| 204 | |
| 205 | </body> |
| 206 | </html> |