[e7527b9] | 1 | % `mod_gnutls` Manual |
---|
[4ee45a1] | 2 | |
---|
| 3 | * * * * * |
---|
| 4 | |
---|
[bce7907] | 5 | `mod_gnutls` is a module for the Apache web server that provides HTTPS |
---|
| 6 | (HTTP over Transport Layer Security (TLS) or the older Secure Sockets |
---|
| 7 | Layer (SSL)) using the GnuTLS library. More information about the |
---|
| 8 | module can be found at [the project's website](https://mod.gnutls.org/). |
---|
[4ee45a1] | 9 | |
---|
| 10 | * * * * * |
---|
| 11 | |
---|
| 12 | Compilation & Installation |
---|
[2b16350] | 13 | ========================== |
---|
[4ee45a1] | 14 | |
---|
[e7527b9] | 15 | `mod_gnutls` uses the `./configure && make && make install` mechanism |
---|
| 16 | common to many Open Source programs. Most of the dirty work is |
---|
| 17 | handled by either `./configure` or Apache's `apxs` utility. If you have |
---|
| 18 | built Apache modules before, there shouldn't be any surprises for you. |
---|
| 19 | |
---|
| 20 | The interesting options you can pass to configure are: |
---|
| 21 | |
---|
| 22 | `--with-apxs=PATH` |
---|
| 23 | : This option is used to specify the location of the apxs utility that |
---|
| 24 | was installed as part of apache. Specify the location of the |
---|
| 25 | binary, not the directory it is located in. |
---|
| 26 | |
---|
| 27 | `--with-libgnutls=PATH` |
---|
| 28 | : Full path to the libgnutls-config program. |
---|
| 29 | |
---|
| 30 | `--with-apr-memcache=PREFIX` |
---|
| 31 | : Prefix to where apr\_memcache is installed. |
---|
| 32 | |
---|
| 33 | `--help` |
---|
| 34 | : Provides a list of all available configure options. |
---|
[4ee45a1] | 35 | |
---|
| 36 | * * * * * |
---|
| 37 | |
---|
| 38 | Integration |
---|
[2b16350] | 39 | =========== |
---|
[4ee45a1] | 40 | |
---|
[2b16350] | 41 | To activate `mod_gnutls` just add the following line to your httpd.conf |
---|
[4ee45a1] | 42 | and restart Apache: |
---|
| 43 | |
---|
[2b16350] | 44 | LoadModule gnutls_module modules/mod_gnutls.so |
---|
[4ee45a1] | 45 | |
---|
| 46 | * * * * * |
---|
| 47 | |
---|
[2b16350] | 48 | Configuration Directives |
---|
| 49 | ======================== |
---|
[4ee45a1] | 50 | |
---|
[2b16350] | 51 | `GnuTLSEnable` |
---|
| 52 | -------------- |
---|
[4ee45a1] | 53 | |
---|
[2b16350] | 54 | Enable GnuTLS for this virtual host |
---|
[4ee45a1] | 55 | |
---|
[2b16350] | 56 | GnuTLSEnable [on|off] |
---|
[4ee45a1] | 57 | |
---|
[2b16350] | 58 | Default: *off*\ |
---|
| 59 | Context: virtual host |
---|
[4ee45a1] | 60 | |
---|
[2b16350] | 61 | This directive enables SSL/TLS Encryption for a Virtual Host. |
---|
[4ee45a1] | 62 | |
---|
[2b16350] | 63 | `GnuTLSCache` |
---|
| 64 | ------------- |
---|
[4ee45a1] | 65 | |
---|
[2b16350] | 66 | Configure SSL Session Cache |
---|
[4ee45a1] | 67 | |
---|
[2b16350] | 68 | GnuTLSCache [dbm|gdbm|memcache|none] [PATH|SERVERLIST|-] |
---|
[4ee45a1] | 69 | |
---|
[2b16350] | 70 | Default: `GnuTLSCache none`\ |
---|
| 71 | Context: server config |
---|
[4ee45a1] | 72 | |
---|
[2b16350] | 73 | This directive configures the SSL Session Cache for `mod_gnutls`. |
---|
| 74 | This could be shared between machines of different architectures. |
---|
[4ee45a1] | 75 | |
---|
[2b16350] | 76 | `dbm` (Requires Berkeley DBM) |
---|
| 77 | : Uses the default Berkeley DB backend of APR DBM to cache SSL |
---|
| 78 | Sessions results. The argument is a relative or absolute path to |
---|
| 79 | be used as the DBM Cache file. This is compatible with most |
---|
| 80 | operating systems, but needs the Apache Runtime to be compiled |
---|
| 81 | with Berkeley DBM support. |
---|
[4ee45a1] | 82 | |
---|
[2b16350] | 83 | `gdbm` |
---|
| 84 | : Uses the GDBM backend of APR DBM to cache SSL Sessions results. |
---|
[4ee45a1] | 85 | |
---|
[2b16350] | 86 | The argument is a relative or absolute path to be used as the DBM Cache |
---|
| 87 | file. This is the recommended option. |
---|
[4ee45a1] | 88 | |
---|
[2b16350] | 89 | `memcache` |
---|
| 90 | : Uses a memcached server to cache the SSL Session. |
---|
[4ee45a1] | 91 | |
---|
[2b16350] | 92 | The argument is a space separated list of servers. If no port |
---|
| 93 | number is supplied, the default of 11211 is used. This can be |
---|
| 94 | used to share a session cache between all servers in a cluster. |
---|
[4ee45a1] | 95 | |
---|
[2b16350] | 96 | `none` |
---|
| 97 | : Turns off all caching of SSL Sessions. |
---|
[4ee45a1] | 98 | |
---|
[2b16350] | 99 | This can significantly reduce the performance of `mod_gnutls` since |
---|
| 100 | even followup connections by a client must renegotiate parameters |
---|
| 101 | instead of reusing old ones. This is the default, since it |
---|
| 102 | requires no configuration. |
---|
[4ee45a1] | 103 | |
---|
[2b16350] | 104 | `GnuTLSCacheTimeout` |
---|
| 105 | -------------------- |
---|
[4ee45a1] | 106 | |
---|
[2b16350] | 107 | Timeout for SSL Session Cache expiration |
---|
[4ee45a1] | 108 | |
---|
[2b16350] | 109 | GnuTLSCacheTimeout SECONDS |
---|
[4ee45a1] | 110 | |
---|
[2b16350] | 111 | Default: `GnuTLSCacheTimeout 300`\ |
---|
| 112 | Context: server config |
---|
[4ee45a1] | 113 | |
---|
[2b16350] | 114 | Sets the timeout for SSL Session Cache entries expiration. This |
---|
| 115 | directive is valid even if Session Tickets are used, and indicates the |
---|
| 116 | expiration time of the ticket in seconds. |
---|
[4ee45a1] | 117 | |
---|
[2b16350] | 118 | `GnuTLSSessionTickets` |
---|
| 119 | ---------------------- |
---|
[4ee45a1] | 120 | |
---|
[2b16350] | 121 | Enable Session Tickets for the server |
---|
[4ee45a1] | 122 | |
---|
[2b16350] | 123 | GnuTLSSessionTickets [on|off] |
---|
[4ee45a1] | 124 | |
---|
[2b16350] | 125 | Default: `off`\ |
---|
| 126 | Context: server config, virtual host |
---|
[4ee45a1] | 127 | |
---|
| 128 | To avoid storing data for TLS session resumption it is allowed to |
---|
[2b16350] | 129 | provide client with a ticket, to use on return. Use for servers with |
---|
| 130 | limited storage, and don't combine with GnuTLSCache. For a pool of |
---|
| 131 | servers this option is not recommended since the tickets are unique |
---|
| 132 | for the issuing server only. |
---|
[4ee45a1] | 133 | |
---|
| 134 | |
---|
[2b16350] | 135 | `GnuTLSCertificateFile` |
---|
| 136 | ----------------------- |
---|
[4ee45a1] | 137 | |
---|
[2b16350] | 138 | Set to the PEM Encoded Server Certificate |
---|
[4ee45a1] | 139 | |
---|
[2b16350] | 140 | GnuTLSCertificateFile FILEPATH |
---|
[4ee45a1] | 141 | |
---|
[2b16350] | 142 | Default: *none*\ |
---|
| 143 | Context: server config, virtual host |
---|
[4ee45a1] | 144 | |
---|
| 145 | Takes an absolute or relative path to a PEM-encoded X.509 certificate to |
---|
| 146 | use as this Server's End Entity (EE) certificate. If you need to supply |
---|
| 147 | certificates for intermediate Certificate Authorities (iCAs), they |
---|
| 148 | should be listed in sequence in the file, from EE to the iCA closest to |
---|
| 149 | the root CA. Optionally, you can also include the root CA's certificate |
---|
| 150 | as the last certificate in the list. |
---|
| 151 | |
---|
[2b16350] | 152 | `GnuTLSKeyFile` |
---|
| 153 | --------------- |
---|
[4ee45a1] | 154 | |
---|
[2b16350] | 155 | Set to the PEM Encoded Server Certificate |
---|
[4ee45a1] | 156 | |
---|
[2b16350] | 157 | GnuTLSCertificateFile FILEPATH |
---|
[4ee45a1] | 158 | |
---|
[2b16350] | 159 | Default: *none*\ |
---|
| 160 | Context: server config, virtual host |
---|
[4ee45a1] | 161 | |
---|
[2b16350] | 162 | Takes an absolute or relative path to the Server Private Key. This |
---|
| 163 | key cannot currently be password protected. |
---|
[4ee45a1] | 164 | |
---|
| 165 | **Security Warning:**\ |
---|
| 166 | This private key must be protected. It is read while Apache is still |
---|
| 167 | running as root, and does not need to be readable by the nobody or |
---|
| 168 | apache user. |
---|
| 169 | |
---|
[2b16350] | 170 | `GnuTLSPGPCertificateFile` |
---|
| 171 | -------------------------- |
---|
[4ee45a1] | 172 | |
---|
[2b16350] | 173 | Set to a base64 Encoded Server OpenPGP Certificate |
---|
[4ee45a1] | 174 | |
---|
[2b16350] | 175 | GnuTLSPGPCertificateFile FILEPATH |
---|
[4ee45a1] | 176 | |
---|
[2b16350] | 177 | Default: *none*\ |
---|
| 178 | Context: server config, virtual host |
---|
[4ee45a1] | 179 | |
---|
| 180 | Takes an absolute or relative path to a base64 Encoded OpenPGP |
---|
| 181 | Certificate to use as this Server's Certificate. |
---|
| 182 | |
---|
[2b16350] | 183 | `GnuTLSPGPKeyFile` |
---|
| 184 | ------------------ |
---|
[4ee45a1] | 185 | |
---|
[2b16350] | 186 | Set to the Server OpenPGP Secret Key |
---|
[4ee45a1] | 187 | |
---|
[2b16350] | 188 | GnuTLSPGPKeyFile FILEPATH |
---|
[4ee45a1] | 189 | |
---|
[2b16350] | 190 | Default: *none*\ |
---|
| 191 | Context: server config, virtual host |
---|
[4ee45a1] | 192 | |
---|
| 193 | Takes an absolute or relative path to the Server Private Key. This key |
---|
| 194 | cannot currently be password protected. |
---|
| 195 | |
---|
| 196 | **Security Warning:**\ |
---|
| 197 | This private key must be protected. It is read while Apache is still |
---|
| 198 | running as root, and does not need to be readable by the nobody or |
---|
| 199 | apache user. |
---|
| 200 | |
---|
[2b16350] | 201 | `GnuTLSClientVerify` |
---|
| 202 | -------------------- |
---|
[4ee45a1] | 203 | |
---|
| 204 | Enable Client Certificate Verification\ |
---|
| 205 | |
---|
[2b16350] | 206 | GnuTLSClientVerify [ignore|request|require] |
---|
[4ee45a1] | 207 | |
---|
[2b16350] | 208 | Default: `ignore`\ |
---|
| 209 | Context: server config, virtual host, directory, .htaccess |
---|
[4ee45a1] | 210 | |
---|
| 211 | This directive controls the use of SSL Client Certificate |
---|
[2b16350] | 212 | Authentication. If used in the .htaccess context, it can force TLS |
---|
| 213 | re-negotiation. |
---|
[4ee45a1] | 214 | |
---|
[2b16350] | 215 | `ignore` |
---|
| 216 | : `mod_gnutls` will ignore the contents of any SSL Client Certificates |
---|
| 217 | sent. It will not request that the client sends a certificate. |
---|
[4ee45a1] | 218 | |
---|
[2b16350] | 219 | `request` |
---|
| 220 | : The client certificate will be requested, but not required. |
---|
| 221 | The Certificate will be validated if sent. The output of the |
---|
| 222 | validation status will be stored in the `SSL_CLIENT_VERIFY` |
---|
| 223 | environment variable and can be `SUCCESS`, `FAILED` or `NONE`. |
---|
[4ee45a1] | 224 | |
---|
[2b16350] | 225 | `require` |
---|
| 226 | : A Client certificate will be required. Any requests without a valid |
---|
| 227 | client certificate will be denied. The `SSL_CLIENT_VERIFY` |
---|
| 228 | environment variable will only be set to `SUCCESS`. |
---|
[4ee45a1] | 229 | |
---|
[2b16350] | 230 | `GnuTLSClientCAFile` |
---|
| 231 | -------------------- |
---|
[4ee45a1] | 232 | |
---|
[2b16350] | 233 | Set to the PEM Encoded Certificate Authority Certificate |
---|
[4ee45a1] | 234 | |
---|
[2b16350] | 235 | GnuTLSClientCAFile FILEPATH |
---|
[4ee45a1] | 236 | |
---|
[2b16350] | 237 | Default: *none* |
---|
| 238 | Context: server config, virtual host |
---|
[4ee45a1] | 239 | |
---|
| 240 | Takes an absolute or relative path to a PEM Encoded Certificate to use |
---|
[2b16350] | 241 | as a Certificate Authority with Client Certificate Authentication. |
---|
| 242 | This file may contain a list of trusted authorities. |
---|
[4ee45a1] | 243 | |
---|
[2b16350] | 244 | `GnuTLSPGPKeyringFile` |
---|
| 245 | ---------------------- |
---|
[4ee45a1] | 246 | |
---|
[2b16350] | 247 | Set to a base64 Encoded key ring |
---|
[4ee45a1] | 248 | |
---|
[2b16350] | 249 | GnuTLSPGPKeyringFile FILEPATH |
---|
[4ee45a1] | 250 | |
---|
[2b16350] | 251 | Default: *none*\ |
---|
| 252 | Context: server config, virtual host |
---|
[4ee45a1] | 253 | |
---|
[2b16350] | 254 | Takes an absolute or relative path to a base64 Encoded Certificate |
---|
| 255 | list (key ring) to use as a means of verification of Client |
---|
| 256 | Certificates. This file should contain a list of trusted signers. |
---|
[4ee45a1] | 257 | |
---|
[2b16350] | 258 | `GnuTLSDHFile` |
---|
| 259 | -------------- |
---|
[4ee45a1] | 260 | |
---|
[2b16350] | 261 | Set to the PKCS \#3 encoded Diffie Hellman parameters |
---|
[4ee45a1] | 262 | |
---|
[2b16350] | 263 | GnuTLSDHFile FILEPATH |
---|
[4ee45a1] | 264 | |
---|
[2b16350] | 265 | Default: *none*\ |
---|
| 266 | Context: server config, virtual host |
---|
[4ee45a1] | 267 | |
---|
[2b16350] | 268 | Takes an absolute or relative path to a PKCS \#3 encoded DH |
---|
| 269 | parameters.Those are used when the DHE key exchange method is enabled. |
---|
| 270 | You can generate this file using `certtool --generate-dh-params --bits |
---|
| 271 | 2048`. If not set `mod_gnutls` will use the included parameters. |
---|
[4ee45a1] | 272 | |
---|
[2b16350] | 273 | `GnuTLSSRPPasswdFile` |
---|
| 274 | --------------------- |
---|
[4ee45a1] | 275 | |
---|
[2b16350] | 276 | Set to the SRP password file for SRP ciphersuites |
---|
[4ee45a1] | 277 | |
---|
[2b16350] | 278 | GnuTLSSRPPasswdFile FILEPATH |
---|
[4ee45a1] | 279 | |
---|
[2b16350] | 280 | Default: *none*\ |
---|
| 281 | Context: server config, virtual host |
---|
[4ee45a1] | 282 | |
---|
[2b16350] | 283 | Takes an absolute or relative path to an SRP password file. This is |
---|
| 284 | the same format as used in libsrp. You can generate such file using |
---|
| 285 | the command `srptool --passwd /etc/tpasswd --passwd-conf |
---|
| 286 | /etc/tpasswd.conf -u test` to set a password for user test. This |
---|
| 287 | password file holds the username, a password verifier and the |
---|
| 288 | dependency to the SRP parameters. |
---|
[4ee45a1] | 289 | |
---|
[2b16350] | 290 | `GnuTLSSRPPasswdConfFile` |
---|
| 291 | ------------------------- |
---|
[4ee45a1] | 292 | |
---|
[2b16350] | 293 | Set to the SRP password.conf file for SRP ciphersuites |
---|
[4ee45a1] | 294 | |
---|
[2b16350] | 295 | GnuTLSSRPPasswdConfFile FILEPATH |
---|
[4ee45a1] | 296 | |
---|
[2b16350] | 297 | Default: *none*\ |
---|
| 298 | Context: server config, virtual host |
---|
[4ee45a1] | 299 | |
---|
[2b16350] | 300 | Takes an absolute or relative path to an SRP password.conf file. This |
---|
| 301 | is the same format as used in `libsrp`. You can generate such file |
---|
| 302 | using the command `srptool --create-conf /etc/tpasswd.conf`. This |
---|
| 303 | file holds the SRP parameters and is associate with the password file |
---|
| 304 | (the verifiers depends on these parameters). |
---|
[4ee45a1] | 305 | |
---|
[2b16350] | 306 | `GnuTLSPriorities` |
---|
| 307 | ------------------ |
---|
[4ee45a1] | 308 | |
---|
[2b16350] | 309 | Set the allowed ciphers, key exchange algorithms, MACs and compression |
---|
| 310 | methods |
---|
[4ee45a1] | 311 | |
---|
[5409165] | 312 | GnuTLSPriorities NORMAL:+CIPHER_0:+CIPHER_1:...:+CIPHER_N |
---|
[4ee45a1] | 313 | |
---|
[2b16350] | 314 | Default: *none*\ |
---|
| 315 | Context: server config, virtual host |
---|
[4ee45a1] | 316 | |
---|
[2b16350] | 317 | Takes a semi-colon separated list of ciphers, key exchange methods |
---|
| 318 | Message authentication codes and compression methods to enable. |
---|
| 319 | The allowed keywords are specified in the `gnutls_priority_init()` |
---|
| 320 | function of GnuTLS. |
---|
[4ee45a1] | 321 | |
---|
[5409165] | 322 | Full details can be found at [the GnuTLS documentation](http://gnutls.org/manual/html_node/Priority-Strings.html#Priority-Strings). |
---|
[2b16350] | 323 | In brief you can specify a set of ciphersuites from the choices: |
---|
[4ee45a1] | 324 | |
---|
[2b16350] | 325 | `NONE` |
---|
| 326 | : The empty list. |
---|
[4ee45a1] | 327 | |
---|
[2b16350] | 328 | `EXPORT` |
---|
| 329 | : A list with all the supported cipher combinations |
---|
| 330 | including the `EXPORT` strength algorithms. |
---|
[4ee45a1] | 331 | |
---|
[2b16350] | 332 | `PERFORMANCE` |
---|
| 333 | : A list with all the secure cipher combinations sorted in terms of performance. |
---|
[4ee45a1] | 334 | |
---|
[2b16350] | 335 | `NORMAL` |
---|
| 336 | : A list with all the secure cipher combinations sorted |
---|
| 337 | with respect to security margin (subjective term). |
---|
[4ee45a1] | 338 | |
---|
[2b16350] | 339 | `SECURE` |
---|
| 340 | : A list with all the secure cipher combinations including |
---|
| 341 | the 256-bit ciphers sorted with respect to security margin. |
---|
[4ee45a1] | 342 | |
---|
[2b16350] | 343 | Additionally you can add or remove algorithms using the `+` and `!` |
---|
| 344 | prefixes respectively. |
---|
[4ee45a1] | 345 | |
---|
[2b16350] | 346 | For example, in order to disable the `ARCFOUR` cipher from the `NORMAL` set |
---|
| 347 | you can use the string `NORMAL:!ARCFOUR-128` |
---|
[4ee45a1] | 348 | |
---|
[2b16350] | 349 | Other options such as the protocol version and the compression method |
---|
| 350 | can be specified using the `VERS-` and `COMP-` prefixes. |
---|
[4ee45a1] | 351 | |
---|
[2b16350] | 352 | So in order to remove or add a specific TLS version from the `NORMAL` |
---|
| 353 | set, use `NORMAL:!VERS-SSL3.0`. And to enable zlib compression use |
---|
| 354 | `NORMAL:+COMP-DEFLATE`. |
---|
[4ee45a1] | 355 | |
---|
| 356 | |
---|
[2b16350] | 357 | However it is recommended not to add compression at this level. With |
---|
| 358 | the `NONE` set, in order to be usable, you have to specify a complete |
---|
| 359 | set of combinations of protocol versions, cipher algorithms |
---|
| 360 | (`AES-128-CBC`), key exchange algorithms (`RSA`), message |
---|
| 361 | authentication codes (`SHA1`) and compression methods (`COMP-NULL`). |
---|
[4ee45a1] | 362 | |
---|
[2b16350] | 363 | You can find a list of all supported Ciphers, Versions, MACs, etc. by |
---|
| 364 | running `gnutls-cli --list`. |
---|
[4ee45a1] | 365 | |
---|
[2b16350] | 366 | The special keyword `%COMPAT` will disable some security features such |
---|
[4ee45a1] | 367 | as protection against statistical attacks to ciphertext data in order to |
---|
| 368 | achieve maximum compatibility (some broken mobile clients need this). |
---|
| 369 | |
---|
[2b16350] | 370 | `GnuTLSExportCertificates` |
---|
| 371 | -------------------------- |
---|
[4ee45a1] | 372 | |
---|
[2b16350] | 373 | Export the PEM encoded certificates to CGIs |
---|
[4ee45a1] | 374 | |
---|
[999cdec] | 375 | GnuTLSExportCertificates [off|on|SIZE] |
---|
[4ee45a1] | 376 | |
---|
[2b16350] | 377 | Default: `off`\ |
---|
| 378 | Context: server config, virtual host |
---|
[4ee45a1] | 379 | |
---|
[999cdec] | 380 | This directive configures exporting the full certificates of the |
---|
| 381 | server and the client to CGI scripts via the `SSL_SERVER_CERT` and |
---|
| 382 | `SSL_CLIENT_CERT` environment variables. The exported certificates |
---|
| 383 | will be PEM-encoded (if X.509) or ASCII-armored (if OpenPGP) up to the |
---|
| 384 | size given. The type of the certificate will be exported in |
---|
| 385 | `SSL_SERVER_CERT_TYPE` and `SSL_CLIENT_CERT_TYPE`. |
---|
| 386 | |
---|
| 387 | SIZE should be an integer number of bytes, or may be written with a |
---|
| 388 | trailing `K` to indicate kibibytes. `off` means the same thing as |
---|
| 389 | `0`, in which case the certificates will not be exported to the |
---|
| 390 | environment. `on` is an alias for `16K`. If a non-zero size is |
---|
| 391 | specified for this directive, but a certificate is too large to fit in |
---|
| 392 | the buffer, then the corresponding environment variable will contain |
---|
| 393 | the fixed string `GNUTLS_CERTIFICATE_SIZE_LIMIT_EXCEEDED`. |
---|
| 394 | |
---|
[2b16350] | 395 | With GnuTLSExportCertificates enabled, `mod_gnutls` exports the same |
---|
| 396 | environment variables to the CGI process as `mod_ssl`. |
---|
[4ee45a1] | 397 | |
---|
| 398 | * * * * * |
---|
| 399 | |
---|
| 400 | Configuration Examples |
---|
[2b16350] | 401 | ====================== |
---|
[4ee45a1] | 402 | |
---|
[2b16350] | 403 | Simple Standard SSL Example |
---|
| 404 | --------------------------- |
---|
[4ee45a1] | 405 | |
---|
| 406 | The following is an example of standard SSL Hosting, using one IP |
---|
| 407 | Addresses for each virtual host |
---|
| 408 | |
---|
[2b16350] | 409 | # Load the module into Apache. |
---|
| 410 | LoadModule gnutls_module modules/mod_gnutls.so |
---|
| 411 | GnuTLSCache gdbm /var/cache/www-tls-cache |
---|
| 412 | GnuTLSCacheTimeout 500 |
---|
| 413 | # With normal SSL Websites, you need one IP Address per-site. |
---|
| 414 | Listen 1.2.3.1:443 |
---|
| 415 | Listen 1.2.3.2:443 |
---|
| 416 | Listen 1.2.3.3:443 |
---|
| 417 | Listen 1.2.3.4:443 |
---|
| 418 | <VirtualHost 1.2.3.1:443> |
---|
| 419 | GnuTLSEnable on |
---|
| 420 | GnuTLSPriorities NONE:+AES-128-CBC:+3DES-CBC:+ARCFOUR-128:+RSA:+DHE-RSA:+DHE-DSS:+SHA1:+MD5:+COMP-NULL |
---|
| 421 | DocumentRoot /www/site1.example.com/html |
---|
| 422 | ServerName site1.example.com:443 |
---|
| 423 | GnuTLSCertificateFile conf/ssl/site1.crt |
---|
| 424 | GnuTLSKeyFile conf/ss/site1.key |
---|
| 425 | </VirtualHost> |
---|
| 426 | <VirtualHost 1.2.3.2:443> |
---|
| 427 | # This virtual host enables SRP authentication |
---|
| 428 | GnuTLSEnable on |
---|
| 429 | GnuTLSPriorities NORMAL:+SRP |
---|
| 430 | DocumentRoot /www/site2.example.com/html |
---|
| 431 | ServerName site2.example.com:443 |
---|
| 432 | GnuTLSSRPPasswdFile conf/ssl/tpasswd.site2 |
---|
| 433 | GnuTLSSRPPasswdConfFile conf/ssl/tpasswd.site2.conf |
---|
| 434 | </VirtualHost> |
---|
| 435 | <VirtualHost 1.2.3.3:443> |
---|
| 436 | # This server enables SRP, OpenPGP and X.509 authentication. |
---|
| 437 | GnuTLSEnable on |
---|
| 438 | GnuTLSPriorities NORMAL:+SRP:+SRP-RSA:+SRP-DSS |
---|
| 439 | DocumentRoot /www/site3.example.com/html |
---|
| 440 | ServerName site3.example.com:443 |
---|
| 441 | GnuTLSCertificateFile conf/ssl/site3.crt |
---|
| 442 | GnuTLSKeyFile conf/ss/site3.key |
---|
| 443 | GnuTLSClientVerify ignore |
---|
| 444 | GnuTLSPGPCertificateFile conf/ss/site3.pub.asc |
---|
| 445 | GnuTLSPGPKeyFile conf/ss/site3.sec.asc |
---|
| 446 | GnuTLSSRPPasswdFile conf/ssl/tpasswd.site3 |
---|
| 447 | GnuTLSSRPPasswdConfFile conf/ssl/tpasswd.site3.conf |
---|
| 448 | </VirtualHost> |
---|
| 449 | <VirtualHost 1.2.3.4:443> |
---|
| 450 | GnuTLSEnable on |
---|
| 451 | # %COMPAT disables some security features to enable maximum compatibility with clients. |
---|
| 452 | GnuTLSPriorities NONE:+AES-128-CBC:+ARCFOUR-128:+RSA:+SHA1:+MD5:+COMP-NULL:%COMPAT |
---|
| 453 | DocumentRoot /www/site4.example.com/html |
---|
| 454 | ServerName site4.example.com:443 |
---|
| 455 | GnuTLSCertificateFile conf/ssl/site4.crt |
---|
| 456 | GnuTLSKeyFile conf/ss/site4.key |
---|
| 457 | </VirtualHost> |
---|
| 458 | |
---|
| 459 | Server Name Indication Example |
---|
| 460 | ------------------------------ |
---|
| 461 | |
---|
| 462 | `mod_gnutls` can also use "Server Name Indication", as specified in |
---|
| 463 | RFC 3546. This allows hosting many SSL Websites, with a Single IP |
---|
| 464 | Address. Currently all the recent browsers support this |
---|
| 465 | standard. Here is an example, using SNI: ` ` |
---|
| 466 | |
---|
| 467 | |
---|
| 468 | # Load the module into Apache. |
---|
| 469 | LoadModule gnutls_module modules/mod_gnutls.so |
---|
| 470 | # With normal SSL Websites, you need one IP Address per-site. |
---|
| 471 | Listen 1.2.3.1:443 |
---|
| 472 | # This could also be 'Listen *:443', |
---|
| 473 | # just like '*:80' is common for non-https |
---|
| 474 | # No caching. Enable session tickets. Timeout is still used for |
---|
| 475 | # ticket expiration. |
---|
| 476 | GnuTLSCacheTimeout 600 |
---|
| 477 | # This tells apache, that for this IP/Port combination, we want to use |
---|
| 478 | # Name Based Virtual Hosting. In the case of Server Name Indication, |
---|
| 479 | # it lets mod_gnutls pick the correct Server Certificate. |
---|
| 480 | NameVirtualHost 1.2.3.1:443 |
---|
| 481 | <VirtualHost 1.2.3.1:443> |
---|
| 482 | GnuTLSEnable on |
---|
| 483 | GnuTLSSessionTickets on |
---|
| 484 | GnuTLSPriorities NORMAL |
---|
| 485 | DocumentRoot /www/site1.example.com/html |
---|
| 486 | ServerName site1.example.com:443 |
---|
| 487 | GnuTLSCertificateFile conf/ssl/site1.crt |
---|
| 488 | GnuTLSKeyFile conf/ss/site1.key |
---|
| 489 | </VirtualHost> |
---|
| 490 | <VirtualHost 1.2.3.1:443> |
---|
| 491 | GnuTLSEnable on |
---|
| 492 | GnuTLSPriorities NORMAL |
---|
| 493 | DocumentRoot /www/site2.example.com/html |
---|
| 494 | ServerName site2.example.com:443 |
---|
| 495 | GnuTLSCertificateFile conf/ssl/site2.crt |
---|
| 496 | GnuTLSKeyFile conf/ss/site2.key |
---|
| 497 | </VirtualHost> |
---|
| 498 | <VirtualHost 1.2.3.1:443> |
---|
| 499 | GnuTLSEnable on |
---|
| 500 | GnuTLSPriorities NORMAL |
---|
| 501 | DocumentRoot /www/site3.example.com/html |
---|
| 502 | ServerName site3.example.com:443 |
---|
| 503 | GnuTLSCertificateFile conf/ssl/site3.crt |
---|
| 504 | GnuTLSKeyFile conf/ss/site3.key |
---|
| 505 | </VirtualHost> |
---|
| 506 | <VirtualHost 1.2.3.1:443> |
---|
| 507 | GnuTLSEnable on |
---|
| 508 | GnuTLSPriorities NORMAL |
---|
| 509 | DocumentRoot /www/site4.example.com/html |
---|
| 510 | ServerName site4.example.com:443 |
---|
| 511 | GnuTLSCertificateFile conf/ssl/site4.crt |
---|
| 512 | GnuTLSKeyFile conf/ss/site4.key |
---|
| 513 | </VirtualHost> |
---|
[4ee45a1] | 514 | |
---|
| 515 | |
---|
[2b16350] | 516 | * * * * * |
---|
[4ee45a1] | 517 | |
---|
[2b16350] | 518 | Performance Issues |
---|
| 519 | ================== |
---|
| 520 | |
---|
| 521 | `mod_gnutls` by default uses conservative settings for the server. |
---|
| 522 | You can fine tune the configuration to reduce the load on a busy |
---|
| 523 | server. The following examples do exactly this: |
---|
| 524 | |
---|
| 525 | |
---|
| 526 | # Load the module into Apache. |
---|
| 527 | LoadModule gnutls_module modules/mod_gnutls.so |
---|
| 528 | # Using 4 memcache servers to distribute the SSL Session Cache. |
---|
| 529 | GnuTLSCache memcache "mc1.example.com mc2.example.com mc3.example.com mc4.example.com" |
---|
| 530 | GnuTLSCacheTimeout 600 |
---|
| 531 | Listen 1.2.3.1:443 |
---|
| 532 | NameVirtualHost 1.2.3.1:443 |
---|
| 533 | <VirtualHost 1.2.3.1:443> |
---|
| 534 | GnuTLSEnable on |
---|
| 535 | # Here we disable the Perfect forward secrecy ciphersuites (DHE) |
---|
| 536 | # and disallow AES-256 since AES-128 is just fine. |
---|
| 537 | GnuTLSPriorities NORMAL:!DHE-RSA:!DHE-DSS:!AES-256-CBC:%COMPAT |
---|
| 538 | DocumentRoot /www/site1.example.com/html |
---|
| 539 | ServerName site1.example.com:443 |
---|
| 540 | GnuTLSCertificateFile conf/ssl/site1.crt |
---|
| 541 | GnuTLSKeyFile conf/ss/site1.key |
---|
| 542 | </VirtualHost> |
---|
| 543 | <VirtualHost 1.2.3.1:443> |
---|
| 544 | GnuTLSEnable on |
---|
| 545 | # Here we instead of disabling the DHE ciphersuites we use |
---|
| 546 | # Diffie Hellman parameters of smaller size than the default (2048 bits). |
---|
| 547 | # Using small numbers from 768 to 1024 bits should be ok once they are |
---|
| 548 | # regenerated every few hours. |
---|
| 549 | # Use "certtool --generate-dh-params --bits 1024" to get those |
---|
| 550 | GnuTLSDHFile /etc/apache2/dh.params |
---|
| 551 | GnuTLSPriorities NORMAL:!AES-256-CBC:%COMPAT |
---|
| 552 | DocumentRoot /www/site2.example.com/html |
---|
| 553 | ServerName site2.example.com:443 |
---|
| 554 | GnuTLSCertificateFile conf/ssl/site2.crt |
---|
| 555 | GnuTLSKeyFile conf/ss/site2.key |
---|
| 556 | </VirtualHost> |
---|
[4ee45a1] | 557 | |
---|
| 558 | * * * * * |
---|
| 559 | |
---|
[2b16350] | 560 | Environment Variables |
---|
| 561 | ===================== |
---|
[4ee45a1] | 562 | |
---|
[2b16350] | 563 | `mod_gnutls` exports the following environment variables to scripts. |
---|
| 564 | These are compatible with `mod_ssl`. |
---|
[4ee45a1] | 565 | |
---|
[2b16350] | 566 | `HTTPS` |
---|
| 567 | ------- |
---|
[4ee45a1] | 568 | |
---|
[2b16350] | 569 | Can be `on` or `off` |
---|
[4ee45a1] | 570 | |
---|
[2b16350] | 571 | `SSL_VERSION_LIBRARY` |
---|
| 572 | --------------------- |
---|
[4ee45a1] | 573 | |
---|
[2b16350] | 574 | The version of the GnuTLS library |
---|
[4ee45a1] | 575 | |
---|
[2b16350] | 576 | `SSL_VERSION_INTERFACE` |
---|
| 577 | ----------------------- |
---|
[4ee45a1] | 578 | |
---|
| 579 | The version of this module |
---|
| 580 | |
---|
[2b16350] | 581 | `SSL_PROTOCOL` |
---|
| 582 | -------------- |
---|
[4ee45a1] | 583 | |
---|
[2b16350] | 584 | The SSL or TLS protocol name (such as `TLS 1.0` etc.) |
---|
[4ee45a1] | 585 | |
---|
[2b16350] | 586 | `SSL_CIPHER` |
---|
| 587 | ------------ |
---|
[4ee45a1] | 588 | |
---|
| 589 | The SSL or TLS cipher suite name |
---|
| 590 | |
---|
[2b16350] | 591 | `SSL_COMPRESS_METHOD` |
---|
| 592 | --------------------- |
---|
[4ee45a1] | 593 | |
---|
[2b16350] | 594 | The negotiated compression method (`NULL` or `DEFLATE`) |
---|
[4ee45a1] | 595 | |
---|
[2b16350] | 596 | `SSL_SRP_USER` |
---|
| 597 | -------------- |
---|
[4ee45a1] | 598 | |
---|
| 599 | The SRP username used for authentication (only set when |
---|
[2b16350] | 600 | `GnuTLSSRPPasswdFile` and `GnuTLSSRPPasswdConfFile` are configured). |
---|
[4ee45a1] | 601 | |
---|
[2b16350] | 602 | `SSL_CIPHER_USEKEYSIZE` & `SSL_CIPHER_ALGKEYSIZE` |
---|
| 603 | ------------------------------------------------- |
---|
[4ee45a1] | 604 | |
---|
| 605 | The number if bits used in the used cipher algorithm. |
---|
| 606 | |
---|
| 607 | This does not fully reflect the security level since the size of |
---|
| 608 | RSA or DHE key exchange parameters affect the security level too. |
---|
| 609 | |
---|
[5674676] | 610 | `SSL_DH_PRIME_BITS` |
---|
| 611 | ------------------- |
---|
| 612 | |
---|
| 613 | The number if bits in the modulus for the DH group, if DHE or static |
---|
| 614 | DH is used. |
---|
| 615 | |
---|
| 616 | This will not be set if DH is not used. |
---|
| 617 | |
---|
[2b16350] | 618 | `SSL_CIPHER_EXPORT` |
---|
| 619 | ------------------- |
---|
[4ee45a1] | 620 | |
---|
[2b16350] | 621 | `True` or `False`. Whether the cipher suite negotiated is an export one. |
---|
[4ee45a1] | 622 | |
---|
[2b16350] | 623 | `SSL_SESSION_ID` |
---|
| 624 | ---------------- |
---|
[4ee45a1] | 625 | |
---|
| 626 | The session ID negotiated in this session. Can be the same during client |
---|
| 627 | reloads. |
---|
| 628 | |
---|
[2b16350] | 629 | `SSL_CLIENT_V_REMAIN` |
---|
| 630 | --------------------- |
---|
[4ee45a1] | 631 | |
---|
| 632 | The number of days until the client's certificate is expired. |
---|
| 633 | |
---|
[2b16350] | 634 | `SSL_CLIENT_V_START` |
---|
| 635 | -------------------- |
---|
[4ee45a1] | 636 | |
---|
| 637 | The activation time of client's certificate. |
---|
| 638 | |
---|
[2b16350] | 639 | `SSL_CLIENT_V_END` |
---|
| 640 | ------------------ |
---|
[4ee45a1] | 641 | |
---|
| 642 | The expiration time of client's certificate. |
---|
| 643 | |
---|
[2b16350] | 644 | `SSL_CLIENT_S_DN` |
---|
| 645 | ----------------- |
---|
[4ee45a1] | 646 | |
---|
| 647 | The distinguished name of client's certificate in RFC2253 format. |
---|
| 648 | |
---|
[2b16350] | 649 | `SSL_CLIENT_I_DN` |
---|
| 650 | ----------------- |
---|
[4ee45a1] | 651 | |
---|
| 652 | The SSL or TLS cipher suite name |
---|
| 653 | |
---|
[2b16350] | 654 | `SSL_CLIENT_S_AN%` |
---|
| 655 | ------------------ |
---|
[4ee45a1] | 656 | |
---|
[2b16350] | 657 | These will contain the alternative names of the client certificate (`%` is |
---|
[4ee45a1] | 658 | a number starting from zero). |
---|
| 659 | |
---|
[2b16350] | 660 | The values will be prepended by `DNSNAME:`, `RFC822NAME:` or `URI:` |
---|
[4ee45a1] | 661 | depending on the type. |
---|
| 662 | |
---|
[2b16350] | 663 | If it is not supported the value `UNSUPPORTED` will be set. |
---|
[4ee45a1] | 664 | |
---|
[2b16350] | 665 | `SSL_SERVER_M_SERIAL` |
---|
| 666 | --------------------- |
---|
[4ee45a1] | 667 | |
---|
| 668 | The serial number of the server's certificate. |
---|
| 669 | |
---|
[2b16350] | 670 | `SSL_SERVER_M_VERSION` |
---|
| 671 | ---------------------- |
---|
[4ee45a1] | 672 | |
---|
| 673 | The version of the server's certificate. |
---|
| 674 | |
---|
[2b16350] | 675 | `SSL_SERVER_A_SIG` |
---|
| 676 | ------------------ |
---|
[4ee45a1] | 677 | |
---|
| 678 | The algorithm used for the signature in server's certificate. |
---|
| 679 | |
---|
[2b16350] | 680 | `SSL_SERVER_A_KEY` |
---|
| 681 | ------------------ |
---|
[4ee45a1] | 682 | |
---|
| 683 | The public key algorithm in server's certificate. |
---|
| 684 | |
---|
[999cdec] | 685 | `SSL_SERVER_CERT` |
---|
[2b16350] | 686 | ------------------ |
---|
[4ee45a1] | 687 | |
---|
[999cdec] | 688 | The PEM-encoded (X.509) or ASCII-armored (OpenPGP) server certificate |
---|
| 689 | (see the `GnuTLSExportCertificates` directive). |
---|
[4ee45a1] | 690 | |
---|
[2b16350] | 691 | `SSL_SERVER_CERT_TYPE` |
---|
| 692 | ---------------------- |
---|
[4ee45a1] | 693 | |
---|
[2b16350] | 694 | The certificate type can be `X.509` or `OPENPGP`. |
---|
[ac32bb5] | 695 | |
---|
[999cdec] | 696 | `SSL_CLIENT_CERT` |
---|
| 697 | ------------------ |
---|
| 698 | |
---|
| 699 | The PEM-encoded (X.509) or ASCII-armored (OpenPGP) client certificate |
---|
| 700 | (see the `GnuTLSExportCertificates` directive). |
---|
| 701 | |
---|
[ac32bb5] | 702 | `SSL_CLIENT_CERT_TYPE` |
---|
| 703 | ---------------------- |
---|
| 704 | |
---|
| 705 | The certificate type can be `X.509` or `OPENPGP`. |
---|