Logoj0ke.net Open Build Service > Projects > Apache > apache2 > apache2-vhost-ssl.template
Sign Up | Log In

File apache2-vhost-ssl.template of Package apache2

 
1
# Template for a VirtualHost with SSL
2
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf.
3
# Files must have the .conf suffix to be loaded.
4
#
5
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
6
# about virtual hosts.
7
8
# NameVirtualHost statements should be added to /etc/apache2/listen.conf.
9
10
#
11
# This is the Apache server configuration file providing SSL support.
12
# It contains the configuration directives to instruct the server how to
13
# serve pages over an https connection. For detailing information about these 
14
# directives see <URL:http://httpd.apache.org/docs-2.2/mod/mod_ssl.html>
15
#
16
#   For the moment, see <URL:http://www.modssl.org/docs/> for this info. 
17
#   The documents are still being prepared from material donated by the
18
#   modssl project.
19
# 
20
# Do NOT simply read the instructions in here without understanding
21
# what they do.  They're here only as hints or reminders.  If you are unsure
22
# consult the online docs. You have been warned.  
23
#
24
25
#   Until documentation is completed, please check http://www.modssl.org/
26
#   for additional config examples and module docmentation.  Directives
27
#   and features of mod_ssl are largely unchanged from the mod_ssl project
28
#   for Apache 1.3.
29
30
<IfDefine SSL>
31
<IfDefine !NOSSL>
32
33
##
34
## SSL Virtual Host Context
35
##
36
37
<VirtualHost _default_:443>
38
39
    #  General setup for the virtual host
40
    DocumentRoot "/srv/www/htdocs"
41
    #ServerName www.example.com:443
42
    #ServerAdmin webmaster@example.com
43
    ErrorLog /var/log/apache2/error_log
44
    TransferLog /var/log/apache2/access_log
45
46
    #   SSL Engine Switch:
47
    #   Enable/Disable SSL for this virtual host.
48
    SSLEngine on
49
50
    #   SSL Cipher Suite:
51
    #   List the ciphers that the client is permitted to negotiate.
52
    #   See the mod_ssl documentation for a complete list.
53
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
54
55
    #   Server Certificate:
56
    #   Point SSLCertificateFile at a PEM encoded certificate.  If
57
    #   the certificate is encrypted, then you will be prompted for a
58
    #   pass phrase.  Note that a kill -HUP will prompt again.  Keep
59
    #   in mind that if you have both an RSA and a DSA certificate you
60
    #   can configure both in parallel (to also allow the use of DSA
61
    #   ciphers, etc.)
62
    SSLCertificateFile /etc/apache2/ssl.crt/server.crt
63
    #SSLCertificateFile /etc/apache2/ssl.crt/server-dsa.crt
64
65
    #   Server Private Key:
66
    #   If the key is not combined with the certificate, use this
67
    #   directive to point at the key file.  Keep in mind that if
68
    #   you've both a RSA and a DSA private key you can configure
69
    #   both in parallel (to also allow the use of DSA ciphers, etc.)
70
    SSLCertificateKeyFile /etc/apache2/ssl.key/server.key
71
    #SSLCertificateKeyFile /etc/apache2/ssl.key/server-dsa.key
72
73
    #   Server Certificate Chain:
74
    #   Point SSLCertificateChainFile at a file containing the
75
    #   concatenation of PEM encoded CA certificates which form the
76
    #   certificate chain for the server certificate. Alternatively
77
    #   the referenced file can be the same as SSLCertificateFile
78
    #   when the CA certificates are directly appended to the server
79
    #   certificate for convinience.
80
    #SSLCertificateChainFile /etc/apache2/ssl.crt/ca.crt
81
82
    #   Certificate Authority (CA):
83
    #   Set the CA certificate verification path where to find CA
84
    #   certificates for client authentication or alternatively one
85
    #   huge file containing all of them (file must be PEM encoded)
86
    #   Note: Inside SSLCACertificatePath you need hash symlinks
87
    #         to point to the certificate files. Use the provided
88
    #         Makefile to update the hash symlinks after changes.
89
    #SSLCACertificatePath /etc/apache2/ssl.crt
90
    #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
91
92
    #   Certificate Revocation Lists (CRL):
93
    #   Set the CA revocation path where to find CA CRLs for client
94
    #   authentication or alternatively one huge file containing all
95
    #   of them (file must be PEM encoded)
96
    #   Note: Inside SSLCARevocationPath you need hash symlinks
97
    #         to point to the certificate files. Use the provided
98
    #         Makefile to update the hash symlinks after changes.
99
    #SSLCARevocationPath /etc/apache2/ssl.crl
100
    #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
101
102
    #   Client Authentication (Type):
103
    #   Client certificate verification type and depth.  Types are
104
    #   none, optional, require and optional_no_ca.  Depth is a
105
    #   number which specifies how deeply to verify the certificate
106
    #   issuer chain before deciding the certificate is not valid.
107
    #SSLVerifyClient require
108
    #SSLVerifyDepth  10
109
110
    #   Access Control:
111
    #   With SSLRequire you can do per-directory access control based
112
    #   on arbitrary complex boolean expressions containing server
113
    #   variable checks and other lookup directives.  The syntax is a
114
    #   mixture between C and Perl.  See the mod_ssl documentation
115
    #   for more details.
116
    #<Location />
117
    #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
118
    #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
119
    #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
120
    #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
121
    #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
122
    #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
123
    #</Location>
124
125
    #   SSL Engine Options:
126
    #   Set various options for the SSL engine.
127
    #   o FakeBasicAuth:
128
    #     Translate the client X.509 into a Basic Authorisation.  This means that
129
    #     the standard Auth/DBMAuth methods can be used for access control.  The
130
    #     user name is the `one line' version of the client's X.509 certificate.
131
    #     Note that no password is obtained from the user. Every entry in the user
132
    #     file needs this password: `xxj31ZMTZzkVA'.
133
    #   o ExportCertData:
134
    #     This exports two additional environment variables: SSL_CLIENT_CERT and
135
    #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
136
    #     server (always existing) and the client (only existing when client
137
    #     authentication is used). This can be used to import the certificates
138
    #     into CGI scripts.
139
    #   o StdEnvVars:
140
    #     This exports the standard SSL/TLS related `SSL_*' environment variables.
141
    #     Per default this exportation is switched off for performance reasons,
142
    #     because the extraction step is an expensive operation and is usually
143
    #     useless for serving static content. So one usually enables the
144
    #     exportation for CGI and SSI requests only.
145
    #   o CompatEnvVars:
146
    #     This exports obsolete environment variables for backward compatibility
147
    #     to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this
148
    #     to provide compatibility to existing CGI scripts.
149
    #   o StrictRequire:
150
    #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
151
    #     under a "Satisfy any" situation, i.e. when it applies access is denied
152
    #     and no other module can change it.
153
    #   o OptRenegotiate:
154
    #     This enables optimized SSL connection renegotiation handling when SSL
155
    #     directives are used in per-directory context. 
156
    #SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
157
    <Files ~ "\.(cgi|shtml|phtml|php3?)$">
158
        SSLOptions +StdEnvVars
159
    </Files>
160
    <Directory "/srv/www/cgi-bin">
161
        SSLOptions +StdEnvVars
162
    </Directory>
163
164
    #   SSL Protocol Adjustments:
165
    #   The safe and default but still SSL/TLS standard compliant shutdown
166
    #   approach is that mod_ssl sends the close notify alert but doesn't wait for
167
    #   the close notify alert from client. When you need a different shutdown
168
    #   approach you can use one of the following variables:
169
    #   o ssl-unclean-shutdown:
170
    #     This forces an unclean shutdown when the connection is closed, i.e. no
171
    #     SSL close notify alert is send or allowed to received.  This violates
172
    #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
173
    #     this when you receive I/O errors because of the standard approach where
174
    #     mod_ssl sends the close notify alert.
175
    #   o ssl-accurate-shutdown:
176
    #     This forces an accurate shutdown when the connection is closed, i.e. a
177
    #     SSL close notify alert is send and mod_ssl waits for the close notify
178
    #     alert of the client. This is 100% SSL/TLS standard compliant, but in
179
    #     practice often causes hanging connections with brain-dead browsers. Use
180
    #     this only for browsers where you know that their SSL implementation
181
    #     works correctly. 
182
    #   Notice: Most problems of broken clients are also related to the HTTP
183
    #   keep-alive facility, so you usually additionally want to disable
184
    #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
185
    #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
186
    #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
187
    #   "force-response-1.0" for this.
188
    SetEnvIf User-Agent ".*MSIE.*" \
189
         nokeepalive ssl-unclean-shutdown \
190
         downgrade-1.0 force-response-1.0
191
192
    #   Per-Server Logging:
193
    #   The home of a custom SSL log file. Use this when you want a
194
    #   compact non-error SSL logfile on a virtual host basis.
195
    CustomLog /var/log/apache2/ssl_request_log   ssl_combined
196
197
</VirtualHost>                                  
198
199
</IfDefine>
200
</IfDefine>
201
202