ssl_faq.html.en
来自「Apache HTTP Server 是一个功能强大的灵活的与HTTP/1.1相」· EN 代码 · 共 1,017 行 · 第 1/4 页
EN
1,017 行
<h3><a name="passphrase" id="passphrase">How can I change the pass-phrase on my private key file?</a></h3><p>You simply have to read it with the old pass-phrase and write it again by specifying the new pass-phrase. You can accomplish this with the following commands:</p> <p><code><strong>$ openssl rsa -des3 -in server.key -out server.key.new</strong></code><br /> <code><strong>$ mv server.key.new server.key</strong></code><br /></p> <p>Here you're asked two times for a PEM pass-phrase. At the first prompt enter the old pass-phrase and at the second prompt enter the new pass-phrase.</p><h3><a name="removepassphrase" id="removepassphrase">How can I get rid of the pass-phrase dialog at Apache startup time?</a></h3><p>The reason why this dialog pops up at startup and every re-start is that the RSA private key inside your server.key file is stored in encrypted format for security reasons. The pass-phrase is needed to be able to read and parse this file. When you can be sure that your server is secure enough you perform two steps:</p> <ol> <li>Remove the encryption from the RSA private key (while preserving the original file):<br /> <br /> <code><strong>$ cp server.key server.key.org</strong></code><br /> <code><strong>$ openssl rsa -in server.key.org -out server.key</strong></code><br /> <br /> </li> <li>Make sure the server.key file is now only readable by root:<br /> <br /> <code><strong>$ chmod 400 server.key</strong></code><br /> <br /> </li> </ol> <p>Now <code>server.key</code> will contain an unencrypted copy of the key. If you point your server at this file it will not prompt you for a pass-phrase. HOWEVER, if anyone gets this key they will be able to impersonate you on the net. PLEASE make sure that the permissions on that file are really such that only root or the web server user can read it (preferably get your web server to start as root but run as another server, and have the key readable only by root).</p> <p>As an alternative approach you can use the ``<code>SSLPassPhraseDialog exec:/path/to/program</code>'' facility. But keep in mind that this is neither more nor less secure, of course.</p><h3><a name="verify" id="verify">How do I verify that a private key matches its Certificate?</a></h3><p>The private key contains a series of numbers. Two of those numbers form the "public key", the others are part of your "private key". The "public key" bits are also embedded in your Certificate (we get them from your CSR). To check that the public key in your cert matches the public portion of your private key, you need to view the cert and the key and compare the numbers. To view the Certificate and the key run the commands:</p> <p><code><strong>$ openssl x509 -noout -text -in server.crt</strong></code><br /> <code><strong>$ openssl rsa -noout -text -in server.key</strong></code></p> <p>The `modulus' and the `public exponent' portions in the key and the Certificate must match. But since the public exponent is usually 65537 and it's bothering comparing long modulus you can use the following approach:</p> <p><code><strong>$ openssl x509 -noout -modulus -in server.crt | openssl md5</strong></code><br /> <code><strong>$ openssl rsa -noout -modulus -in server.key | openssl md5</strong></code></p> <p>And then compare these really shorter numbers. With overwhelming probability they will differ if the keys are different. BTW, if I want to check to which key or certificate a particular CSR belongs you can compute</p> <p><code><strong>$ openssl req -noout -modulus -in server.csr | openssl md5</strong></code></p><h3><a name="badcert" id="badcert">What does it mean when my connections fail with an "alert bad certificate"error?</a></h3><p>Usually when you see errors like <code>OpenSSL: error:14094412: SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate</code> in the SSL logfile, this means that the browser was unable to handle the server certificate/private-key which perhaps contain a RSA-key not equal to 1024 bits. For instance Netscape Navigator 3.x is one of those browsers.</p><h3><a name="keysize" id="keysize">Why does my 2048-bit private key not work?</a></h3><p>The private key sizes for SSL must be either 512 or 1024 for compatibility with certain web browsers. A keysize of 1024 bits is recommended because keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.</p><h3><a name="hashsymlinks" id="hashsymlinks">Why is client authentication broken after upgrading fromSSLeay version 0.8 to 0.9?</a></h3><p>The CA certificates under the path you configured with <code>SSLCACertificatePath</code> are found by SSLeay through hash symlinks. These hash values are generated by the `<code>openssl x509 -noout -hash</code>' command. But the algorithm used to calculate the hash for a certificate has changed between SSLeay 0.8 and 0.9. So you have to remove all old hash symlinks and re-create new ones after upgrading. Use the <code>Makefile</code> mod_ssl placed into this directory.</p><h3><a name="pemder" id="pemder">How can I convert a certificate from PEM to DER format?</a></h3><p>The default certificate format for SSLeay/OpenSSL is PEM, which actually is Base64 encoded DER with header and footer lines. For some applications (e.g. Microsoft Internet Explorer) you need the certificate in plain DER format. You can convert a PEM file <code>cert.pem</code> into the corresponding DER file <code>cert.der</code> with the following command: <code><strong>$ openssl x509 -in cert.pem -out cert.der -outform DER</strong></code></p><h3><a name="verisign" id="verisign">I try to install a Verisign certificate. Why can't I find neither the<code>getca</code> nor <code>getverisign</code> programs Verisign mentions?</a></h3><p>This is because Verisign has never provided specific instructions for Apache+mod_ssl. Rather they tell you what you should do if you were using C2Net's Stronghold (a commercial Apache based server with SSL support). The only thing you have to do is to save the certificate into a file and give the name of that file to the <code>SSLCertificateFile</code> directive. Remember that you need to give the key file in as well (see <code>SSLCertificateKeyFile</code> directive). For a better CA-related overview on SSL certificate fiddling you can look at <a href="http://www.thawte.com/html/SUPPORT/server/softwaredocs/modssl.html">Thawte's mod_ssl instructions</a>.</p><h3><a name="sgc" id="sgc">Can I use the Server Gated Cryptography (SGC) facility (aka Verisign GlobalID) also with mod_ssl?</a></h3><p>Yes, mod_ssl since version 2.1 supports the SGC facility. You don't have to configure anything special for this, just use a Global ID as your server certificate. The <em>step up</em> of the clients are then automatically handled by mod_ssl under run-time. For details please read the <code>README.GlobalID</code> document in the mod_ssl distribution.</p><h3><a name="gid" id="gid">After I have installed my new Verisign Global ID server certificate, thebrowsers complain that they cannot verify the server certificate?</a></h3><p>That is because Verisign uses an intermediate CA certificate between the root CA certificate (which is installed in the browsers) and the server certificate (which you installed in the server). You should have received this additional CA certificate from Verisign. If not, complain to them. Then configure this certificate with the <code>SSLCertificateChainFile</code> directive in the server. This makes sure the intermediate CA certificate is send to the browser and this way fills the gap in the certificate chain.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="aboutssl" id="aboutssl">About SSL Protocol</a></h2><ul><li><a href="#random">Random SSL errors under heavy load?</a></li><li><a href="#load">Why has the server a higher load?</a></li><li><a href="#establishing">Why are connections horribly slow?</a></li><li><a href="#ciphers">Which ciphers are supported?</a></li><li><a href="#adh">How to use Anonymous-DH ciphers</a></li><li><a href="#sharedciphers">Why do I get 'no shared ciphers'?</a></li><li><a href="#vhosts">HTTPS and name-based vhosts</a></li><li><a href="#vhosts2">Why is it not possible to use Name-Based VirtualHosting to identify different SSL virtual hosts?</a></li><li><a href="#lockicon">The lock icon in Netscape locks very late</a></li><li><a href="#msie">Why do I get I/O errors with MSIE clients?</a></li><li><a href="#nn">Why do I get I/O errors with NS clients?</a></li></ul><h3><a name="random" id="random">Why do I get lots of random SSL protocol errors under heavy server load?</a></h3><p>There can be a number of reasons for this, but the main one is problems with the SSL session Cache specified by the <code class="directive"><a href="../mod/mod_ssl.html#sslsessioncache">SSLSessionCache</a></code> directive. The DBM session cache is most likely the source of the problem, so trying the SHM session cache or no cache at all may help.</p><h3><a name="load" id="load">Why has my webserver a higher load now that I run SSL there?</a></h3><p>Because SSL uses strong cryptographic encryption and this needs a lot of number crunching. And because when you request a webpage via HTTPS even the images are transferred encrypted. So, when you have a lot of HTTPS traffic the load increases.</p><h3><a name="establishing" id="establishing">Often HTTPS connections to my server require up to 30 seconds for establishingthe connection, although sometimes it works faster?</a></h3><p>Usually this is caused by using a <code>/dev/random</code> device for <code>SSLRandomSeed</code> which is blocking in read(2) calls if not enough entropy is available. Read more about this problem in the reference chapter under <code>SSLRandomSeed</code>.</p><h3><a name="ciphers" id="ciphers">What SSL Ciphers are supported by mod_ssl?</a></h3><p>Usually just all SSL ciphers which are supported by the version of OpenSSL in use (can depend on the way you built OpenSSL). Typically this at least includes the following:</p> <ol> <li>RC4 with MD5</li> <li>RC4 with MD5 (export version restricted to 40-bit key)</li> <li>RC2 with MD5</li> <li>RC2 with MD5 (export version restricted to 40-bit key)</li> <li>IDEA with MD5</li> <li>DES with MD5</li> <li>Triple-DES with MD5</li> </ol> <p>To determine the actual list of supported ciphers you can run the following command:</p> <div class="example"><p><code>$ openssl ciphers -v</code></p></div><h3><a name="adh" id="adh">I want to use Anonymous Diffie-Hellman (ADH) ciphers, but I always get ``noshared cipher'' errors?</a></h3><p>In order to use Anonymous Diffie-Hellman (ADH) ciphers, it is not enough to just put ``<code>ADH</code>'' into your <code>SSLCipherSuite</code>. Additionally you have to build OpenSSL with ``<code>-DSSL_ALLOW_ADH</code>''. Because per default OpenSSL does not allow ADH ciphers for security reasons. So if you are actually enabling these ciphers make sure you are informed about the side-effects.</p><h3><a name="sharedciphers" id="sharedciphers">I always just get a 'no shared ciphers' error ifI try to connect to my freshly installed server?</a></h3><p>Either you have messed up your <code>SSLCipherSuite</code> directive (compare it with the pre-configured example in <code>httpd.conf-dist</code>) or you have chosen the DSA/DH algorithms instead of RSA when you generated your private key and ignored or overlooked the warnings. If you have chosen DSA/DH, then your server no longer speaks RSA-based SSL ciphers (at least not until you also configure an additional RSA-based certificate/key pair). But current browsers like NS or IE only speak RSA ciphers. The result is the "no shared ciphers" error. To fix this, regenerate your server certificate/key pair and this time choose the RSA algorithm.</p><h3><a name="vhosts" id="vhosts">Why can't I use SSL with name-based/non-IP-based virtual hosts?</a></h3><p>The reason is very technical. Actually it's some sort of a chicken and egg problem: The SSL protocol layer stays below the HTTP protocol layer and encapsulates HTTP. When an SSL connection (HTTPS) is established Apache/mod_ssl has to negotiate the SSL protocol parameters with the client. For this mod_ssl has to consult the configuration of the virtual server (for instance it has to look for the cipher suite, the server certificate, etc.). But in order to dispatch to the correct virtual server Apache has to know the <code>Host</code> HTTP header field. For this the HTTP request header has to be read. This cannot be done before the SSL handshake is finished. But the information is already needed at the SSL handshake phase. Bingo!</p><h3><a name="vhosts2" id="vhosts2">Why is it not possible to use Name-BasedVirtual Hosting to identify different SSL virtual hosts?</a></h3> <p>Name-Based Virtual Hosting is a very popular method of identifying
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?