home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 May / Gamestar_62_2004-05_dvd.iso / Programy / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252908_ssl_howto.html.en < prev    next >
Extensible Markup Language  |  2003-05-29  |  14KB  |  282 lines

  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="<-" alt="<-" src="../images/left.gif" /></a></div>
  18. <div id="path">
  19. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <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"> en </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 is 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.       <Directory /usr/local/apache2/htdocs><br />
  95.       # but finally deny all browsers which haven't upgraded<br />
  96.       SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128<br />
  97.       </Directory>
  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.       <Location /strong/area><br />
  115.       # but https://hostname/strong/area/ and below<br />
  116.       # requires strong ciphers<br />
  117.       SSLCipherSuite HIGH:MEDIUM<br />
  118.       </Location>
  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.     <Location /secure/area><br />
  162.     SSLVerifyClient require<br />
  163.     SSLVerifyDepth 1<br />
  164.     </Location><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. <Directory /usr/local/apache2/htdocs/secure/area>
  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. AuthBasicProvider    file
  196. AuthUserFile         /usr/local/apache2/conf/httpd.passwd
  197. require              valid-user
  198. </Directory></pre></div>
  199.  
  200.     <div class="example"><h3>httpd.passwd</h3><pre>
  201. /C=DE/L=Munich/O=Snake Oil, Ltd./OU=Staff/CN=Foo:xxj31ZMTZzkVA
  202. /C=US/L=S.F./O=Snake Oil, Ltd./OU=CA/CN=Bar:xxj31ZMTZzkVA
  203. /C=US/L=L.A./O=Snake Oil, Ltd./OU=Dev/CN=Quux:xxj31ZMTZzkVA</pre></div>
  204.  
  205.     <p>The second method:</p>
  206.  
  207.     <div class="example"><h3>httpd.conf</h3><pre>
  208. SSLVerifyClient      none
  209. <Directory /usr/local/apache2/htdocs/secure/area>
  210.  
  211.   SSLVerifyClient      require
  212.   SSLVerifyDepth       5
  213.   SSLCACertificateFile conf/ssl.crt/ca.crt
  214.   SSLCACertificatePath conf/ssl.crt
  215.   SSLOptions           +FakeBasicAuth
  216.   SSLRequireSSL
  217.   SSLRequire       %{SSL_CLIENT_S_DN_O}  eq "Snake Oil, Ltd." \
  218.                and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"}
  219. </Directory></pre></div>
  220.  
  221.  
  222. <h3><a name="intranet" id="intranet">How can I require HTTPS with strong ciphers and either basic
  223. authentication or client certificates for access to a subarea on the
  224. Intranet website for clients coming from the Internet but still allow
  225. plain HTTP access for clients on the Intranet?</a></h3>
  226.  
  227.    <p>Let us assume the Intranet can be distinguished through the IP
  228.    network 192.160.1.0/24 and the subarea on the Intranet website has
  229.    the URL <code>/subarea</code>. Then configure the following outside
  230.    your HTTPS virtual host (so it applies to both HTTPS and HTTP):</p>
  231.  
  232.     <div class="example"><h3>httpd.conf</h3><pre>
  233. SSLCACertificateFile conf/ssl.crt/company-ca.crt
  234.  
  235. <Directory /usr/local/apache2/htdocs>
  236. #   Outside the subarea only Intranet access is granted
  237. Order                deny,allow
  238. Deny                 from all
  239. Allow                from 192.168.1.0/24
  240. </Directory>
  241.  
  242. <Directory /usr/local/apache2/htdocs/subarea>
  243. #   Inside the subarea any Intranet access is allowed
  244. #   but from the Internet only HTTPS + Strong-Cipher + Password
  245. #   or the alternative HTTPS + Strong-Cipher + Client-Certificate
  246.  
  247. #   If HTTPS is used, make sure a strong cipher is used.
  248. #   Additionally allow client certs as alternative to basic auth.
  249. SSLVerifyClient      optional
  250. SSLVerifyDepth       1
  251. SSLOptions           +FakeBasicAuth +StrictRequire
  252. SSLRequire           %{SSL_CIPHER_USEKEYSIZE} >= 128
  253.  
  254. #   Force clients from the Internet to use HTTPS
  255. RewriteEngine        on
  256. RewriteCond          %{REMOTE_ADDR} !^192\.168\.1\.[0-9]+$
  257. RewriteCond          %{HTTPS} !=on
  258. RewriteRule          .* - [F]
  259.  
  260. #   Allow Network Access and/or Basic Auth
  261. Satisfy              any
  262.  
  263. #   Network Access Control
  264. Order                deny,allow
  265. Deny                 from all
  266. Allow                192.168.1.0/24
  267.  
  268. #   HTTP Basic Authentication
  269. AuthType             basic
  270. AuthName             "Protected Intranet Area"
  271. AuthBasicProvider    file
  272. AuthUserFile         conf/protected.passwd
  273. Require              valid-user
  274. </Directory></pre></div>
  275.  
  276. </div></div>
  277. <div class="bottomlang">
  278. <p><span>Available Languages: </span><a href="../en/ssl/ssl_howto.html" title="English"> en </a></p>
  279. </div><div id="footer">
  280. <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
  281. <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>
  282. </body></html>