bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / apache2 / manual / ssl / ssl_howto.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>SSL/TLS Strong Encryption: How-To - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.0</p>
16 <img alt="" src="../images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.0</a> &gt; <a href="./">SSL/TLS</a></div><div id="page-content"><div id="preamble"><h1>SSL/TLS Strong Encryption: How-To</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="../en/ssl/ssl_howto.html" title="English">&nbsp;en&nbsp;</a></p>
22 </div>
23
24 <blockquote>
25 <p>The solution of this problem is trivial
26 and is left as an exercise for the reader.</p>
27
28 <p class="cite">-- <cite>Standard textbook cookie</cite></p>
29 </blockquote>
30
31 <p>How to solve particular security constraints for an SSL-aware
32 webserver is not always obvious because of the coherences between SSL,
33 HTTP and Apache's way of processing requests. This chapter gives
34 instructions on how to solve such typical situations. Treat it as a first
35 step to find out the final solution, but always try to understand the 
36 stuff before you use it. Nothing is worse than using a security solution
37 without knowing its restrictions and coherences.</p>
38 </div>
39 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#ciphersuites">Cipher Suites and Enforced Strong Security</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#accesscontrol">Client Authentication and Access Control</a></li>
41 </ul></div>
42 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
43 <div class="section">
44 <h2><a name="ciphersuites" id="ciphersuites">Cipher Suites and Enforced Strong Security</a></h2>
45
46 <ul>
47 <li><a href="#realssl">SSLv2 only server</a></li>
48 <li><a href="#onlystrong">strong encryption only server</a></li>
49 <li><a href="#upgradeenc">server gated cryptography</a></li>
50 <li><a href="#strongurl">stronger per-directory requirements</a></li>
51 </ul>
52
53 <h3><a name="realssl" id="realssl">How can I create a real SSLv2-only server?</a></h3>
54
55     <p>The following creates an SSL server which speaks only the SSLv2 protocol and
56     its ciphers.</p>
57
58     <div class="example"><h3>httpd.conf</h3><p><code>
59       SSLProtocol -all +SSLv2<br />
60       SSLCipherSuite SSLv2:+HIGH:+MEDIUM:+LOW:+EXP<br />
61     </code></p></div>
62
63
64 <h3><a name="onlystrong" id="onlystrong">How can I create an SSL server which accepts strong encryption
65 only?</a></h3>
66
67     <p>The following enables only the seven strongest ciphers:</p>
68     <div class="example"><h3>httpd.conf</h3><p><code>
69       SSLProtocol all<br />
70       SSLCipherSuite HIGH:MEDIUM<br />
71     </code></p></div>
72
73
74 <h3><a name="upgradeenc" id="upgradeenc">How can I create an SSL server which accepts strong encryption
75 only, but allows export browsers to upgrade to stronger encryption?</a></h3>
76
77     <p>This facility is called Server Gated Cryptography (SGC) and details
78     you can find in the <code>README.GlobalID</code> document in the
79     mod_ssl distribution. In short: The server has a Global ID server
80     certificate, signed by a special CA certificate from Verisign which
81     enables strong encryption in export browsers. This works as following:
82     The browser connects with an export cipher, the server sends its Global
83     ID certificate, the browser verifies it and subsequently upgrades the
84     cipher suite before any HTTP communication takes place. The question
85     now is: How can we allow this upgrade, but enforce strong encryption.
86     Or in other words: Browser either have to initially connect with
87     strong encryption or have to upgrade to strong encryption, but are
88     not allowed to keep the export ciphers. The following does the trick:</p>
89     <div class="example"><h3>httpd.conf</h3><p><code>
90       # allow all ciphers for the initial handshake,<br />
91       # so export browsers can upgrade via SGC facility<br />
92       SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL<br />
93       <br />
94       &lt;Directory /usr/local/apache2/htdocs&gt;<br />
95       # but finally deny all browsers which haven't upgraded<br />
96       SSLRequire %{SSL_CIPHER_USEKEYSIZE} &gt;= 128<br />
97       &lt;/Directory&gt;
98     </code></p></div>
99
100
101 <h3><a name="strongurl" id="strongurl">How can I create an SSL server which accepts all types of ciphers
102 in general, but requires a strong ciphers for access to a particular
103 URL?</a></h3>
104
105     <p>Obviously you cannot just use a server-wide <code class="directive"><a href="../mod/mod_ssl.html#sslciphersuite">SSLCipherSuite</a></code> which restricts the
106     ciphers to the strong variants. But mod_ssl allows you to reconfigure
107     the cipher suite in per-directory context and automatically forces
108     a renegotiation of the SSL parameters to meet the new configuration.
109     So, the solution is:</p>
110     <div class="example"><p><code>
111       # be liberal in general<br />
112       SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL<br />
113       <br />
114       &lt;Location /strong/area&gt;<br />
115       # but https://hostname/strong/area/ and below<br />
116       # requires strong ciphers<br />
117       SSLCipherSuite HIGH:MEDIUM<br />
118       &lt;/Location&gt;
119     </code></p></div>
120
121 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
122 <div class="section">
123 <h2><a name="accesscontrol" id="accesscontrol">Client Authentication and Access Control</a></h2>
124
125 <ul>
126 <li><a href="#allclients">simple certificate-based client authentication</a></li>
127 <li><a href="#arbitraryclients">selective certificate-based client authentication</a></li>
128 <li><a href="#certauthenticate">particular certificate-based client authentication</a></li>
129 <li><a href="#intranet">intranet vs. internet authentication</a></li>
130 </ul>
131
132 <h3><a name="allclients" id="allclients">How can I authenticate clients based on certificates when I know
133 all my clients?</a></h3>
134
135     <p>When you know your user community (i.e. a closed user group
136     situation), as it's the case for instance in an Intranet, you can
137     use plain certificate authentication. All you have to do is to
138     create client certificates signed by your own CA certificate
139     <code>ca.crt</code> and then verify the clients against this
140     certificate.</p>
141     <div class="example"><h3>httpd.conf</h3><p><code>
142       # require a client certificate which has to be directly<br />
143       # signed by our CA certificate in ca.crt<br />
144       SSLVerifyClient require<br />
145       SSLVerifyDepth 1<br />
146       SSLCACertificateFile conf/ssl.crt/ca.crt
147     </code></p></div>
148
149
150 <h3><a name="arbitraryclients" id="arbitraryclients">How can I authenticate my clients for a particular URL based on
151 certificates but still allow arbitrary clients to access the remaining
152 parts of the server?</a></h3>
153
154     <p>For this we again use the per-directory reconfiguration feature
155     of <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>:</p>
156
157     <div class="example"><h3>httpd.conf</h3><p><code>
158     SSLVerifyClient none<br />
159     SSLCACertificateFile conf/ssl.crt/ca.crt<br />
160     <br />
161     &lt;Location /secure/area&gt;<br />
162     SSLVerifyClient require<br />
163     SSLVerifyDepth 1<br />
164     &lt;/Location&gt;<br />
165     </code></p></div>
166
167
168 <h3><a name="certauthenticate" id="certauthenticate">How can I authenticate only particular clients for a some URLs based
169 on certificates but still allow arbitrary clients to access the remaining
170 parts of the server?</a></h3>
171
172     <p>The key is to check for various ingredients of the client certificate.
173     Usually this means to check the whole or part of the Distinguished
174     Name (DN) of the Subject. For this two methods exists: The <code class="module"><a href="../mod/mod_auth.html">mod_auth</a></code> based variant and the <code class="directive"><a href="../mod/mod_ssl.html#sslrequire">SSLRequire</a></code> variant. The first method is
175     good when the clients are of totally different type, i.e. when their
176     DNs have no common fields (usually the organisation, etc.). In this
177     case you've to establish a password database containing <em>all</em>
178     clients. The second method is better when your clients are all part of
179     a common hierarchy which is encoded into the DN. Then you can match
180     them more easily.</p>
181
182     <p>The first method:</p>
183     <div class="example"><h3>httpd.conf</h3><pre>
184 SSLVerifyClient      none
185 &lt;Directory /usr/local/apache2/htdocs/secure/area&gt;
186
187 SSLVerifyClient      require
188 SSLVerifyDepth       5
189 SSLCACertificateFile conf/ssl.crt/ca.crt
190 SSLCACertificatePath conf/ssl.crt
191 SSLOptions           +FakeBasicAuth
192 SSLRequireSSL
193 AuthName             "Snake Oil Authentication"
194 AuthType             Basic
195 AuthUserFile         /usr/local/apache2/conf/httpd.passwd
196 require              valid-user
197 &lt;/Directory&gt;</pre></div>
198     
199     <p>The password used in this example is the DES encrypted string "password".
200     See the <code class="directive"><a href="../mod/mod_ssl.html#ssloptions">SSLOptions</a></code> docs for more 
201     information.</p>
202     
203     <div class="example"><h3>httpd.passwd</h3><pre>
204 /C=DE/L=Munich/O=Snake Oil, Ltd./OU=Staff/CN=Foo:xxj31ZMTZzkVA
205 /C=US/L=S.F./O=Snake Oil, Ltd./OU=CA/CN=Bar:xxj31ZMTZzkVA
206 /C=US/L=L.A./O=Snake Oil, Ltd./OU=Dev/CN=Quux:xxj31ZMTZzkVA</pre></div>
207
208     <p>The second method:</p>
209
210     <div class="example"><h3>httpd.conf</h3><pre>
211 SSLVerifyClient      none
212 &lt;Directory /usr/local/apache2/htdocs/secure/area&gt;
213
214   SSLVerifyClient      require
215   SSLVerifyDepth       5
216   SSLCACertificateFile conf/ssl.crt/ca.crt
217   SSLCACertificatePath conf/ssl.crt
218   SSLOptions           +FakeBasicAuth
219   SSLRequireSSL
220   SSLRequire       %{SSL_CLIENT_S_DN_O}  eq "Snake Oil, Ltd." \
221                and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"}
222 &lt;/Directory&gt;</pre></div>
223
224
225 <h3><a name="intranet" id="intranet">How can I require HTTPS with strong ciphers and either basic
226 authentication or client certificates for access to a subarea on the
227 Intranet website for clients coming from the Internet but still allow
228 plain HTTP access for clients on the Intranet?</a></h3>
229
230    <p>Let us assume the Intranet can be distinguished through the IP
231    network 192.168.1.0/24 and the subarea on the Intranet website has
232    the URL <code>/subarea</code>. Then configure the following outside
233    your HTTPS virtual host (so it applies to both HTTPS and HTTP):</p>
234
235     <div class="example"><h3>httpd.conf</h3><pre>
236 SSLCACertificateFile conf/ssl.crt/company-ca.crt
237
238 &lt;Directory /usr/local/apache2/htdocs&gt;
239 #   Outside the subarea only Intranet access is granted
240 Order                deny,allow
241 Deny                 from all
242 Allow                from 192.168.1.0/24
243 &lt;/Directory&gt;
244
245 &lt;Directory /usr/local/apache2/htdocs/subarea&gt;
246 #   Inside the subarea any Intranet access is allowed
247 #   but from the Internet only HTTPS + Strong-Cipher + Password
248 #   or the alternative HTTPS + Strong-Cipher + Client-Certificate
249
250 #   If HTTPS is used, make sure a strong cipher is used.
251 #   Additionally allow client certs as alternative to basic auth.
252 SSLVerifyClient      optional
253 SSLVerifyDepth       1
254 SSLOptions           +FakeBasicAuth +StrictRequire
255 SSLRequire           %{SSL_CIPHER_USEKEYSIZE} &gt;= 128
256
257 #   Force clients from the Internet to use HTTPS
258 RewriteEngine        on
259 RewriteCond          %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$
260 RewriteCond          %{HTTPS} !=on
261 RewriteRule          .* - [F]
262
263 #   Allow Network Access and/or Basic Auth
264 Satisfy              any
265
266 #   Network Access Control
267 Order                deny,allow
268 Deny                 from all
269 Allow                192.168.1.0/24
270
271 #   HTTP Basic Authentication
272 AuthType             basic
273 AuthName             "Protected Intranet Area"
274 AuthUserFile         conf/protected.passwd
275 Require              valid-user
276 &lt;/Directory&gt;</pre></div>
277
278 </div></div>
279 <div class="bottomlang">
280 <p><span>Available Languages: </span><a href="../en/ssl/ssl_howto.html" title="English">&nbsp;en&nbsp;</a></p>
281 </div><div id="footer">
282 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
283 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
284 </body></html>