source: mod_gnutls/doc/mod_gnutls_manual.mdwn @ 1a3068c

debian/masterproxy-ticket
Last change on this file since 1a3068c was 1a3068c, checked in by Fiona Klute <fiona.klute@…>, 2 years ago

Update documentation on OCSP stapling and the certificate file

  • Property mode set to 100644
File size: 29.5 KB
Line 
1% `mod_gnutls` Manual
2
3* * * * *
4
5`mod_gnutls` is a module for the Apache web server that provides HTTPS
6(HTTP over Transport Layer Security (TLS)) using the GnuTLS library.
7More information about the module can be found at
8[the project's website](https://mod.gnutls.org/).
9
10* * * * *
11
12Compilation & Installation
13==========================
14
15`mod_gnutls` uses the `./configure && make && make install` mechanism
16common to many Open Source programs.  Most of the dirty work is
17handled by either `./configure` or Apache's `apxs` utility. If you have
18built Apache modules before, there shouldn't be any surprises for you.
19
20The 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-apu-config=PATH`
28:   Path to APR Utility Library config tool (`apu-1-config`)
29
30`--help`
31:   Provides a list of all available configure options.
32
33It is recommended to run `make check` before installation. If your
34system doesn't have a loopback device with IPv6 and IPv4 support or
35`localhost` does not resolve to at least one of `[::1]` and
36`127.0.0.1`, you may have to set the `TEST_HOST` or `TEST_IP`
37environment variables when running `./configure` to make the test
38suite work correctly.
39
40* * * * *
41
42Integration
43===========
44
45To activate `mod_gnutls` just add the following line to your httpd.conf
46and restart Apache:
47
48    LoadModule gnutls_module modules/mod_gnutls.so
49
50* * * * *
51
52Configuration Directives
53========================
54
55General Options
56---------------
57
58### GnuTLSEnable
59
60Enable GnuTLS for this virtual host
61
62    GnuTLSEnable [on|off]
63
64Default: *off*\
65Context: virtual host
66
67This directive enables SSL/TLS Encryption for a Virtual Host.
68
69### GnuTLSCache
70
71Configure TLS Session Cache
72
73    GnuTLSCache (shmcb|dbm|memcache|...|none)[:PARAMETERS]
74
75Default: `GnuTLSCache none`\
76Context: server config
77
78This directive configures the TLS Session Cache for `mod_gnutls`. This
79could be shared between machines of different architectures. If the
80selected cache implementation is not thread-safe, access is serialized
81using the `gnutls-cache` mutex.
82
83Which cache implementations are available depends on your Apache
84installation and configuration, `mod_gnutls` can use any socache
85provider. In general you will need to load a `mod_socache_PROVIDER`
86module. Common options are described below, please check the Apache
87HTTPD documentation for details on available providers and their
88configuration.
89
90`shmcb`
91:   Uses a shared memory segment. This is a high performance local
92    cache. The parameter is a relative or absolute path to be used if
93    the local shared memory implementation requires one, followed by
94    the cache size in bytes enclosed in parentheses.
95
96    Example: `shmcb:cache/gnutls_cache(65536)`
97
98`dbm`
99:   Uses a DBM cache file. The parameter is a relative or absolute
100    path to be used as the DBM cache file.
101
102    Example: `dbm:cache/gnutls_cache`
103
104`memcache`
105:   Uses memcached server(s) to cache TLS session data. The parameter
106    is a comma separated list of servers (host:port). This can be used
107    to share a session cache between all servers in a cluster.
108
109    Example: `memcache:memcache.example.com:12345,memcache2.example.com:12345`
110
111`none`
112:   Turns off all caching of TLS sessions.
113
114    This can significantly reduce the performance of `mod_gnutls`
115    since even followup connections by a client must renegotiate
116    parameters instead of reusing old ones. This is the default, since
117    it requires no configuration.
118
119    Session tickets are an alternative to using a session cache,
120    please see `GnuTLSSessionTickets`. Note that for TLS 1.3 GnuTLS
121    supports resumption using session tickets only as of version
122    3.6.4.
123
124### GnuTLSCacheTimeout
125
126Timeout for TLS Session Cache expiration
127
128    GnuTLSCacheTimeout SECONDS
129
130Default: `GnuTLSCacheTimeout 300`\
131Context: server config, virtual host
132
133Sets the expiration timeout for cached TLS sessions.
134
135### GnuTLSSessionTickets
136
137Enable Session Tickets for the server
138
139    GnuTLSSessionTickets [on|off]
140
141Default: `on` with GnuTLS 3.6.4 and newer, `off` otherwise\
142Context: server config, virtual host
143
144Session tickets allow TLS session resumption without session state
145stored on the server, using encrypted tickets provided to the clients
146instead. Tickets are an alternative to using a session cache, and
147currently the only session resumption mechanism in TLS 1.3. For a pool
148of servers this option is not recommended since the tickets are bound
149to the issuing server only.
150
151If this option is set in the global configuration, virtual hosts
152without a `GnuTLSSessionTickets` setting will use the global setting.
153
154*Warning:* With GnuTLS version before 3.6.4 the master key that
155protects the tickets is generated only on server start, and there is
156no mechanism to roll over the key. If session tickets are enabled it
157is highly recommended to restart the server regularly to protect past
158sessions in case an attacker gains access to server memory. GnuTLS
1593.6.4 introduced an automatic TOTP-based key rollover, so this warning
160does not apply any more and tickets are enabled by default.
161
162### GnuTLSClientVerify
163
164Enable Client Certificate Verification
165
166    GnuTLSClientVerify [ignore|request|require]
167
168Default: `ignore`\
169Context: server config, virtual host, directory, .htaccess
170
171This directive controls the use of TLS Client Certificate
172Authentication. If used in the .htaccess context, it can force TLS
173re-negotiation.
174
175`ignore`
176:   `mod_gnutls` will ignore the contents of any TLS Client Certificates
177    sent. It will not request that the client sends a certificate.
178
179`request`
180:   The client certificate will be requested, but not required.
181    The Certificate will be validated if sent.  The output of the
182    validation status will be stored in the `SSL_CLIENT_VERIFY`
183    environment variable and can be `SUCCESS`, `FAILED` or `NONE`.
184
185`require`
186:   A Client certificate will be required. Any requests without a valid
187    client certificate will be denied.  The `SSL_CLIENT_VERIFY`
188    environment variable will only be set to `SUCCESS`.
189
190### GnuTLSDHFile
191
192Use the provided PKCS \#3 encoded Diffie-Hellman parameters
193
194    GnuTLSDHFile FILEPATH
195
196Default: *none*\
197Context: server config, virtual host
198
199By default, `mod_gnutls` uses the DH parameters included with GnuTLS
200corresponding to the security level of the configured private keys if
201compiled with GnuTLS 3.5.6 or newer, and the ffdhe2048 DH group as
202defined in RFC 7919, Appendix A.1 otherwise.
203
204If you need to use different DH parameters, you can provide a PEM file
205containing them in PKCS \#3 encoding using this option. Please see the
206"[Parameter
207generation](https://gnutls.org/manual/html_node/Parameter-generation.html)"
208section of the GnuTLS documentation for a short discussion of the
209security implications.
210
211### GnuTLSPriorities
212
213Set the allowed protocol versions, ciphers, key exchange algorithms,
214MACs and compression methods
215
216    GnuTLSPriorities NORMAL:+CIPHER_0:+CIPHER_1:...:+CIPHER_N
217
218Default: `NORMAL`\
219Context: server config, virtual host
220
221Sets the allowed protocol version(s), ciphers, key exchange methods,
222message authentication codes, and other TLS parameters for the server.
223The parameter is a GnuTLS priority string as described in the
224[the GnuTLS documentation](https://gnutls.org/manual/html_node/Priority-Strings.html).
225
226For example, to disable TLS 1.0 use `NORMAL:-VERS-TLS1.0`.
227
228### GnuTLSP11Module
229
230Load this PKCS #11 module.
231
232    GnuTLSP11Module PATH_TO_LIBRARY
233
234Default: *none*\
235Context: server config
236
237Load this PKCS #11 provider module, instead of the system
238defaults. May occur multiple times to load multiple modules.
239
240### GnuTLSPIN
241
242Set the PIN to be used to access encrypted key files or PKCS #11 objects.
243
244    GnuTLSPIN XXXXXX
245
246Default: *none*\
247Context: server config, virtual host
248
249Takes a string to be used as a PIN for the protected objects in
250a security module, or as a key to be used to decrypt PKCS #8, PKCS #12,
251or openssl encrypted keys.
252
253### GnuTLSSRKPIN
254
255Set the SRK PIN to be used to access the TPM.
256
257    GnuTLSSRKPIN XXXXXX
258
259Default: *none*\
260Context: server config, virtual host
261
262Takes a string to be used as a PIN for the protected objects in
263the TPM module.
264
265### GnuTLSExportCertificates
266
267Export the PEM encoded certificates to CGIs
268
269    GnuTLSExportCertificates [off|on|SIZE]
270
271Default: `off`\
272Context: server config, virtual host
273
274This directive configures exporting the full certificates of the
275server and the client to CGI scripts via the `SSL_SERVER_CERT` and
276`SSL_CLIENT_CERT` environment variables. The exported certificates
277will be PEM-encoded, limited to the given size. The type of the
278certificate will be exported in `SSL_SERVER_CERT_TYPE` and
279`SSL_CLIENT_CERT_TYPE`.
280
281SIZE should be an integer number of bytes, or may be written with a
282trailing `K` to indicate kibibytes.  `off` means the same thing as
283`0`, in which case the certificates will not be exported to the
284environment. `on` is an alias for `16K`. If a non-zero size is
285specified for this directive, but a certificate is too large to fit in
286the buffer, then the corresponding environment variable will contain
287the fixed string `GNUTLS_CERTIFICATE_SIZE_LIMIT_EXCEEDED`.
288
289With GnuTLSExportCertificates enabled, `mod_gnutls` exports the same
290environment variables to the CGI process as `mod_ssl`.
291
292X.509 Certificate Authentication
293--------------------------------
294
295### GnuTLSCertificateFile
296
297Set the PEM encoded server certificate or certificate chain
298
299    GnuTLSCertificateFile FILEPATH
300
301Default: *none*\
302Context: server config, virtual host
303
304FILEPATH is an absolute or relative path to a file containing the
305PEM-encoded X.509 certificate to use as this Server's End Entity (EE)
306certificate, and optionally those of the issuing Certificate
307Authorities (CAs). If the file contains multiple certificates they
308should be ordered from EE to the CA closest to the root CA (or the
309root CA itself).
310
311Including at least the immediately issuing CA is highly recommended
312because it is required for OCSP stapling.
313
314Since version 0.7 this can be a PKCS #11 URL instead of a file.
315
316On Linux and other Unix-like systems you can create the file with a
317command like this (assuming "CA 1" issued the server certificate and
318has been issued by "Root CA" itself):
319
320        $ cat server.pem ca-1.pem root-ca.pem >server-chain.pem
321
322### GnuTLSKeyFile
323
324Set to the PEM Encoded Server Private Key
325
326    GnuTLSKeyFile FILEPATH
327
328Default: *none*\
329Context: server config, virtual host
330
331Takes an absolute or relative path to the Server Private Key. Set
332`GnuTLSPIN` if the key file is encrypted.
333
334Since version 0.7 this can be a PKCS #11 URL.
335
336**Security Warning:**\
337This private key must be protected. It is read while Apache is still
338running as root, and does not need to be readable by the nobody or
339apache user.
340
341### GnuTLSClientCAFile
342
343Set the PEM encoded Certificate Authority list to use for X.509 base
344client authentication
345
346    GnuTLSClientCAFile FILEPATH
347
348Default: *none*
349Context: server config, virtual host
350
351Takes an absolute or relative path to a PEM Encoded Certificate to use
352as a Certificate Authority with Client Certificate Authentication.
353This file may contain a list of trusted authorities.
354
355SRP Authentication
356------------------
357
358### GnuTLSSRPPasswdFile
359
360Set to the SRP password file for SRP ciphersuites
361
362    GnuTLSSRPPasswdFile FILEPATH
363
364Default: *none*\
365Context: server config, virtual host
366
367Takes an absolute or relative path to an SRP password file. This is
368the same format as used in libsrp.  You can generate such file using
369the command `srptool --passwd /etc/tpasswd --passwd-conf
370/etc/tpasswd.conf -u test` to set a password for user test.  This
371password file holds the username, a password verifier and the
372dependency to the SRP parameters.
373
374### GnuTLSSRPPasswdConfFile
375
376Set to the SRP password.conf file for SRP ciphersuites
377
378    GnuTLSSRPPasswdConfFile FILEPATH
379
380Default: *none*\
381Context: server config, virtual host
382
383Takes an absolute or relative path to an SRP password.conf file. This
384is the same format as used in `libsrp`.  You can generate such file
385using the command `srptool --create-conf /etc/tpasswd.conf`.  This
386file holds the SRP parameters and is associate with the password file
387(the verifiers depends on these parameters).
388
389TLS Proxy Configuration
390-----------------------
391
392### GnuTLSProxyEngine
393
394Enable TLS proxy connections for this virtual host
395
396    GnuTLSProxyEngine [on|off]
397
398Default: *off*\
399Context: virtual host
400
401This directive enables support for TLS proxy connections for a virtual
402host.
403
404### GnuTLSProxyCAFile
405
406Set to the PEM encoded Certificate Authority Certificate
407
408    GnuTLSProxyCAFile FILEPATH
409
410Default: *none*\
411Context: server config, virtual host
412
413Takes an absolute or relative path to a PEM encoded certificate to use
414as a Certificate Authority when verifying certificates provided by
415proxy back end servers. This file may contain a list of trusted
416authorities. If not set, verification of TLS back end servers will
417always fail due to lack of a trusted CA.
418
419### GnuTLSProxyCRLFile
420
421Set to the PEM encoded Certificate Revocation List
422
423    GnuTLSProxyCRLFile FILEPATH
424
425Default: *none*\
426Context: server config, virtual host
427
428Takes an absolute or relative path to a PEM encoded Certificate
429Revocation List to use when verifying certificates provided by proxy
430back end servers. The file may contain a list of CRLs.
431
432### GnuTLSProxyCertificateFile
433
434Set to the PEM encoded Client Certificate
435
436    GnuTLSProxyCertificateFile FILEPATH
437
438Default: *none*\
439Context: server config, virtual host
440
441Takes an absolute or relative path to a PEM encoded X.509 certificate
442to use as this Server's End Entity (EE) client certificate for TLS
443client authentication in proxy TLS connections. If you need to supply
444certificates for intermediate Certificate Authorities (iCAs), they
445should be listed in sequence in the file, from EE to the iCA closest
446to the root CA. Optionally, you can also include the root CA's
447certificate as the last certificate in the list.
448
449If not set, TLS client authentication will be disabled for TLS proxy
450connections. If set, `GnuTLSProxyKeyFile` must be set as well to
451provide the matching private key.
452
453### GnuTLSProxyKeyFile
454
455Set to the PEM encoded Private Key
456
457    GnuTLSProxyKeyFile FILEPATH
458
459Default: *none*\
460Context: server config, virtual host
461
462Takes an absolute or relative path to the Private Key matching the
463certificate configured using the `GnuTLSProxyCertificateFile`
464directive. This key cannot currently be password protected.
465
466**Security Warning:**\
467This private key must be protected. It is read while Apache is still
468running as root, and does not need to be readable by the nobody or
469apache user.
470
471### GnuTLSProxyPriorities
472
473Set the allowed ciphers, key exchange algorithms, MACs and compression
474methods for proxy connections
475
476    GnuTLSProxyPriorities NORMAL:+CIPHER_0:+CIPHER_1:...:+CIPHER_N
477
478Default: `NORMAL`\
479Context: server config, virtual host
480
481Sets the allowed protocol version(s), ciphers, key exchange methods,
482message authentication codes, and other TLS parameters for TLS proxy
483connections. Like for `GnuTLSPriorities` the parameter is a GnuTLS
484priority string as described in the
485[the GnuTLS documentation](https://gnutls.org/manual/html_node/Priority-Strings.html).
486
487OCSP Stapling Configuration
488---------------------------
489
490### GnuTLSOCSPStapling
491
492Enable OCSP stapling for this (virtual) host.
493
494    GnuTLSOCSPStapling [On|Off]
495
496Default: *on* if requirements are met, *off* otherwise\
497Context: server config, virtual host
498
499OCSP stapling, formally known as the TLS Certificate Status Request
500extension, allows the server to provide the client with a cached OCSP
501response for its certificate during the handshake. With OCSP stapling
502the client does not have to send an OCSP request to the issuer CA to
503check the certificate status, which offers privacy and performance
504advantages, and avoids the security issue of how to handle errors that
505prevent the client from getting a response.
506
507Using OCSP stapling has a few requirements:
508
509* `GnuTLSCertificateFile` must contain the issuer CA certificate in
510  addition to the server certificate so responses can be verified.
511* The server certificate must either contain an OCSP access URI using
512  HTTP, or `GnuTLSOCSPResponseFile` must be set.
513* Caching OCSP responses requires a cache to store responses. If
514  `mod_socache_shmcb` is loaded `mod_gnutls` can set up the cache
515  automatically without additional configuration, see
516  `GnuTLSOCSPCache`.
517
518Stapling is activated by default if these requirements are met. If
519`GnuTLSOCSPStapling` is explicitly set to `on` unmet requirements are
520an error.
521
522OCSP cache updates are serialized using the `gnutls-ocsp` mutex.
523
524### GnuTLSOCSPCache
525
526OCSP stapling cache configuration
527
528        GnuTLSOCSPCache (shmcb|memcache|...|none)[:PARAMETERS]
529
530Default: `shmcb:gnutls_ocsp_cache`\
531Context: server config
532
533This directive configures the OCSP stapling cache, and uses the same
534syntax as `GnuTLSOCSPCache`. Please check there for details.
535
536The default should be reasonable for most servers and requires
537`mod_socache_shmcb` to be loaded. Servers with very many virtual hosts
538may need to increase the default cache size via the parameters string,
539those with few virtual hosts and constrains could save a few KB by
540reducing it. Note that `mod_socache_dbm` has a size constraint for
541entries that is generally too small for OCSP responses.
542
543If the selected cache implementation is not thread-safe, access
544is serialized using the `gnutls-ocsp-cache` mutex.
545
546### GnuTLSOCSPAutoRefresh
547
548Regularly refresh cached OCSP response independent of TLS handshakes?
549
550    GnuTLSOCSPAutoRefresh [On|Off]
551
552Default: *on*\
553Context: server config, virtual host
554
555By default `mod_gnutls` will regularly refresh the cached OCSP
556response for hosts that have OCSP stapling enabled, regardless of
557whether it is used. This has advantages over updating the OCSP
558response only if a TLS handshake needs it:
559
560* Updating the cached response before it expires can hide short
561  unavailability of the OCSP responder, if a repeated request is
562  successful before the cache expires (see below).
563
564* Handshakes are not slowed down by fetching responses.
565
566The interval to the next request is determined as follows: After a
567successful OCSP request the next one is scheduled for a random period
568between `GnuTLSOCSPFuzzTime` and half of it before
569`GnuTLSOCSPCacheTimeout` expires. For example, if the cache timeout is
5703600 seconds and the fuzz time 600 seconds, the next request will be
571sent after 3000 to 3300 seconds. If the validity period of the
572response expires before then, the selected interval is halved until it
573is smaller than the time until expiry. If an OCSP request fails, it is
574retried after `GnuTLSOCSPFailureTimeout`.
575
576Regularly updating the OCSP cache requires `mod_watchdog`,
577`mod_gnutls` will fall back to updating the OCSP cache during
578handshakes if `mod_watchdog` is not available or this option is set to
579`Off`.
580
581### GnuTLSOCSPCheckNonce
582
583Check the nonce in OCSP responses?
584
585    GnuTLSOCSPCheckNonce [On|Off]
586
587Default: *on*\
588Context: server config, virtual host
589
590Some CAs refuse to send nonces in their OCSP responses, probably
591because that way they can cache responses. If your CA is one of them
592you can use this flag to disable nonce verification. Note that
593`mod_gnutls` will _send_ a nonce either way.
594
595### GnuTLSOCSPResponseFile
596
597Read the OCSP response for stapling from this file instead of sending
598a request over HTTP.
599
600    GnuTLSOCSPResponseFile /path/to/response.der
601
602Default: *empty*\
603Context: server config, virtual host
604
605The response file must be updated externally, for example using a cron
606job. This option is an alternative to the server fetching OCSP
607responses over HTTP. Reasons to use this option include:
608
609* Performing OCSP requests separate from the web server, to prevent slow
610  responses from stalling handshakes.
611* The issuer CA uses an access method other than HTTP.
612* Testing
613
614You can use a GnuTLS `ocsptool` command like the following to create
615and update the response file:
616
617    ocsptool --ask --nonce --load-issuer ca_cert.pem \
618        --load-cert server_cert.pem --outfile ocsp_response.der
619
620Additional error checking is highly recommended. You may have to
621remove the `--nonce` option if the OCSP responder of your CA does not
622support nonces.
623
624### GnuTLSOCSPCacheTimeout
625
626Cache timeout for OCSP responses
627
628    GnuTLSOCSPCacheTimeout SECONDS
629
630Default: *3600*\
631Context: server config, virtual host
632
633Cached OCSP responses will be refreshed after the configured number of
634seconds. How long this timeout should reasonably be depends on your
635CA, namely how often its OCSP responder is updated and how long
636responses are valid. Note that a response will not be cached beyond
637its lifetime as denoted in the `nextUpdate` field of the response.
638
639### GnuTLSOCSPFailureTimeout
640
641Wait this many seconds before retrying a failed OCSP request.
642
643    GnuTLSOCSPFailureTimeout SECONDS
644
645Default: *300*\
646Context: server config, virtual host
647
648Retries of failed OCSP requests must be rate limited to avoid
649overloading both the server using mod_gnutls and the CA's OCSP
650responder. A shorter value increases the load on both sides, a longer
651one means that stapling will remain disabled for longer after a failed
652request.
653
654### GnuTLSOCSPFuzzTime
655
656Update the cached OCSP response up to this time before the cache expires
657
658    GnuTLSOCSPFuzzTime SECONDS
659
660Default: *larger of GnuTLSOCSPCacheTimeout / 8 and GnuTLSOCSPFailureTimeout \* 2*\
661Context: server config, virtual host
662
663Refreshing the cached response before it expires hides short OCSP
664responder unavailability. See `GnuTLSOCSPAutoRefresh` for how this
665value is used, using at least twice `GnuTLSOCSPFailureTimeout` is
666recommended.
667
668### GnuTLSOCSPSocketTimeout
669
670Timeout for TCP sockets used to send OCSP requests
671
672    GnuTLSOCSPFailureTimeout SECONDS
673
674Default: *6*\
675Context: server config, virtual host
676
677Stalled OCSP requests must time out after a while to prevent stalling
678the server too much. However, if the timeout is too short requests may
679fail with a slow OCSP responder or high latency network
680connection. This parameter allows you to adjust the timeout if
681necessary.
682
683Note that this is not an upper limit for the completion of an OCSP
684request but a socket timeout. The connection will time out if there is
685no activity (successful send or receive) at all for the configured
686time.
687
688* * * * *
689
690Configuration Examples
691======================
692
693Simple Standard TLS Example
694---------------------------
695
696The following is an example of simple TLS hosting, using one IP
697Addresses for each virtual host.
698
699     # Load the module into Apache.
700     LoadModule gnutls_module modules/mod_gnutls.so
701     GnuTLSCache dbm:/var/cache/www-tls-cache
702     GnuTLSCacheTimeout 500
703
704     # Without SNI you need one IP Address per-site.
705     Listen 192.0.2.1:443
706     Listen 192.0.2.2:443
707     Listen 192.0.2.3:443
708     Listen 192.0.2.4:443
709
710     <VirtualHost 192.0.2.1:443>
711         GnuTLSEnable on
712         GnuTLSPriorities SECURE128
713         DocumentRoot /www/site1.example.com/html
714         ServerName site1.example.com:443
715         GnuTLSCertificateFile conf/tls/site1.crt
716         GnuTLSKeyFile conf/tls/site1.key
717     </VirtualHost>
718
719     <VirtualHost 192.0.2.2:443>
720         # This virtual host enables SRP authentication
721         GnuTLSEnable on
722         GnuTLSPriorities NORMAL:+SRP
723         DocumentRoot /www/site2.example.com/html
724         ServerName site2.example.com:443
725         GnuTLSSRPPasswdFile conf/tls/tpasswd.site2
726         GnuTLSSRPPasswdConfFile conf/tls/tpasswd.site2.conf
727     </VirtualHost>
728
729     <VirtualHost 192.0.2.3:443>
730         # This server enables SRP and X.509 authentication.
731         GnuTLSEnable on
732         GnuTLSPriorities NORMAL:+SRP:+SRP-RSA:+SRP-DSS
733         DocumentRoot /www/site3.example.com/html
734         ServerName site3.example.com:443
735         GnuTLSCertificateFile conf/tls/site3.crt
736         GnuTLSKeyFile conf/tls/site3.key
737         GnuTLSClientVerify ignore
738         GnuTLSSRPPasswdFile conf/tls/tpasswd.site3
739         GnuTLSSRPPasswdConfFile conf/tls/tpasswd.site3.conf
740     </VirtualHost>
741
742     <VirtualHost 192.0.2.4:443>
743         GnuTLSEnable on
744         # %COMPAT disables some security features to enable maximum
745         # compatibility with clients. Don't use this if you need strong
746         # security.
747         GnuTLSPriorities NORMAL:%COMPAT
748         DocumentRoot /www/site4.example.com/html
749         ServerName site4.example.com:443
750         GnuTLSCertificateFile conf/tls/site4.crt
751         GnuTLSKeyFile conf/tls/site4.key
752     </VirtualHost>
753
754Server Name Indication Example
755------------------------------
756
757`mod_gnutls` supports "Server Name Indication", as specified in
758[RFC 6066, Section 3](https://tools.ietf.org/html/rfc6066#section-3). This
759allows hosting many TLS websites with a single IP address. All recent
760browsers support this standard. Here is an example using SNI:
761
762     # Load the module into Apache.
763     LoadModule gnutls_module modules/mod_gnutls.so
764
765     # SNI allows hosting multiple sites using one IP address. This
766     # could also be 'Listen *:443', just like '*:80' is common for
767     # non-HTTPS
768     Listen 198.51.100.1:443
769
770     <VirtualHost _default_:443>
771         GnuTLSEnable on
772         GnuTLSSessionTickets on
773         DocumentRoot /www/site1.example.com/html
774         ServerName site1.example.com:443
775         GnuTLSCertificateFile conf/tls/site1.crt
776         GnuTLSKeyFile conf/tls/site1.key
777     </VirtualHost>
778
779     <VirtualHost _default_:443>
780         GnuTLSEnable on
781         DocumentRoot /www/site2.example.com/html
782         ServerName site2.example.com:443
783         GnuTLSCertificateFile conf/tls/site2.crt
784         GnuTLSKeyFile conf/tls/site2.key
785     </VirtualHost>
786
787     <VirtualHost _default_:443>
788         GnuTLSEnable on
789         DocumentRoot /www/site3.example.com/html
790         ServerName site3.example.com:443
791         GnuTLSCertificateFile conf/tls/site3.crt
792         GnuTLSKeyFile conf/tls/site3.key
793     </VirtualHost>
794
795     <VirtualHost _default_:443>
796         GnuTLSEnable on
797         DocumentRoot /www/site4.example.com/html
798         ServerName site4.example.com:443
799         GnuTLSCertificateFile conf/tls/site4.crt
800         GnuTLSKeyFile conf/tls/site4.key
801     </VirtualHost>
802
803OCSP Stapling Example
804---------------------
805
806This example uses an X.509 server certificate. The server will fetch
807OCSP responses from the responder listed in the certificate and store
808them im a memcached cache shared with another server.
809
810     # Load the module into Apache.
811     LoadModule gnutls_module modules/mod_gnutls.so
812     GnuTLSCache memcache:192.0.2.1:11211,192.0.2.2:11211
813     GnuTLSCacheTimeout 600
814
815     Listen 192.0.2.1:443
816
817     <VirtualHost _default_:443>
818         GnuTLSEnable          On
819         DocumentRoot          /www/site1.example.com/html
820         ServerName            site1.example.com:443
821         GnuTLSCertificateFile conf/tls/site1.crt
822         GnuTLSKeyFile         conf/tls/site1.key
823         GnuTLSOCSPStapling    On
824     </VirtualHost>
825
826* * * * *
827
828Environment Variables
829=====================
830
831`mod_gnutls` exports the following environment variables to scripts.
832These are compatible with `mod_ssl`.
833
834`HTTPS`
835-------
836
837Can be `on` or `off`
838
839`SSL_VERSION_LIBRARY`
840---------------------
841
842The version of the GnuTLS library
843
844`SSL_VERSION_INTERFACE`
845-----------------------
846
847The version of this module
848
849`SSL_PROTOCOL`
850--------------
851
852The SSL or TLS protocol name (such as `TLS 1.0` etc.)
853
854`SSL_CIPHER`
855------------
856
857The SSL or TLS cipher suite name
858
859`SSL_COMPRESS_METHOD`
860---------------------
861
862The negotiated compression method (`NULL` or `DEFLATE`)
863
864`SSL_SRP_USER`
865--------------
866
867The SRP username used for authentication (only set when
868`GnuTLSSRPPasswdFile` and `GnuTLSSRPPasswdConfFile` are configured).
869
870`SSL_CIPHER_USEKEYSIZE` & `SSL_CIPHER_ALGKEYSIZE`
871-------------------------------------------------
872
873The number if bits used in the used cipher algorithm.
874
875This does not fully reflect the security level since the size of
876RSA or DHE key exchange parameters affect the security level too.
877
878`SSL_DH_PRIME_BITS`
879-------------------
880
881The number if bits in the modulus for the DH group, if DHE or static
882DH is used.
883
884This will not be set if DH is not used.
885
886`SSL_CIPHER_EXPORT`
887-------------------
888
889`True` or `False`. Whether the cipher suite negotiated is an export one.
890
891`SSL_SESSION_ID`
892----------------
893
894The session ID negotiated in this session. Can be the same during client
895reloads.
896
897`SSL_CLIENT_V_REMAIN`
898---------------------
899
900The number of days until the client's certificate is expired.
901
902`SSL_CLIENT_V_START`
903--------------------
904
905The activation time of client's certificate.
906
907`SSL_CLIENT_V_END`
908------------------
909
910The expiration time of client's certificate.
911
912`SSL_CLIENT_S_DN`
913-----------------
914
915The distinguished name of client's certificate in RFC2253 format.
916
917`SSL_CLIENT_I_DN`
918-----------------
919
920The distinguished name of the issuer of the client's certificate in
921RFC2253 format.
922
923`SSL_CLIENT_S_AN%`
924------------------
925
926These will contain the alternative names of the client certificate (`%` is
927a number starting from zero).
928
929The values will be prepended by `DNSNAME:`, `RFC822NAME:` or `URI:`
930depending on the type.
931
932If it is not supported the value `UNSUPPORTED` will be set.
933
934`SSL_SERVER_M_SERIAL`
935---------------------
936
937The serial number of the server's certificate.
938
939`SSL_SERVER_M_VERSION`
940----------------------
941
942The version of the server's certificate.
943
944`SSL_SERVER_A_SIG`
945------------------
946
947The algorithm used for the signature in server's certificate.
948
949`SSL_SERVER_A_KEY`
950------------------
951
952The public key algorithm in server's certificate.
953
954`SSL_SERVER_CERT`
955------------------
956
957The PEM-encoded (X.509) server certificate (see the
958`GnuTLSExportCertificates` directive).
959
960`SSL_SERVER_CERT_TYPE`
961----------------------
962
963The certificate type will be `X.509`.
964
965`SSL_CLIENT_CERT`
966------------------
967
968PEM-encoded (X.509) client certificate, if any (see the
969`GnuTLSExportCertificates` directive).
970
971`SSL_CLIENT_CERT_TYPE`
972----------------------
973
974The certificate type will be `X.509`, if any.
Note: See TracBrowser for help on using the repository browser.