ssl_faq.html.en
来自「Apache HTTP Server 是一个功能强大的灵活的与HTTP/1.1相」· EN 代码 · 共 1,017 行 · 第 1/4 页
EN
1,017 行
doesn't support SSL (on this port). Make sure you are connecting to a virtual server that supports SSL, which is probably the IP associated with your hostname, not localhost (127.0.0.1).</p><h3><a name="refused" id="refused">Why do I get ``Connection Refused'' messages when trying to access my freshlyinstalled Apache+mod_ssl server via HTTPS?</a></h3><p>There can be various reasons. Some of the common mistakes is that people start Apache with just <code>apachectl start</code> (or <code class="program"><a href="../programs/httpd.html">httpd</a></code>) instead of <code>apachectl startssl</code> (or <code>httpd -DSSL</code>. Or you're configuration is not correct. At least make sure that your <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directives match your <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code> directives. And if all fails, please do yourself a favor and start over with the default configuration mod_ssl provides you.</p><h3><a name="envvars" id="envvars">In my CGI programs and SSI scripts the various documented<code>SSL_XXX</code> variables do not exist. Why?</a></h3><p>Just make sure you have ``<code>SSLOptions +StdEnvVars</code>'' enabled for the context of your CGI/SSI requests.</p><h3><a name="relative" id="relative">How can I use relative hyperlinks to switch between HTTP andHTTPS?</a></h3> <p>Usually you have to use fully-qualified hyperlinks because you have to change the URL scheme. But with the help of some URL manipulations through mod_rewrite you can achieve the same effect while you still can use relative URLs:</p> <div class="example"><p><code> RewriteEngine on<br /> RewriteRule ^/(.*):SSL$ https://%{SERVER_NAME}/$1 [R,L]<br /> RewriteRule ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1 [R,L] </code></p></div> <p>This rewrite ruleset lets you use hyperlinks of the form <code><a href="document.html:SSL"></code></p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="aboutcerts" id="aboutcerts">About Certificates</a></h2><ul><li><a href="#keyscerts">What are Keys, CSRs and Certs?</a></li><li><a href="#startup">Difference on startup?</a></li><li><a href="#realcert">How to create a real cert?</a></li><li><a href="#ownca">How to create my own CA?</a></li><li><a href="#passphrase">How to change a pass phrase?</a></li><li><a href="#removepassphrase">How to remove a pass phrase?</a></li><li><a href="#verify">How to verify a key/cert pair?</a></li><li><a href="#badcert">Bad Certificate Error?</a></li><li><a href="#keysize">Why does a 2048-bit key not work?</a></li><li><a href="#hashsymlinks">Why is client auth broken?</a></li><li><a href="#pemder">How to convert from PEM to DER?</a></li><li><a href="#verisign">Verisign and the magic getca program?</a></li><li><a href="#sgc">Global IDs or SGC?</a></li><li><a href="#gid">Global IDs and Cert Chain?</a></li></ul><h3><a name="keyscerts" id="keyscerts">What are RSA Private Keys, CSRs and Certificates?</a></h3><p>The RSA private key file is a digital file that you can use to decrypt messages sent to you. It has a public component which you distribute (via your Certificate file) which allows people to encrypt those messages to you. A Certificate Signing Request (CSR) is a digital file which contains your public key and your name. You send the CSR to a Certifying Authority (CA) to be converted into a real Certificate. A Certificate contains your RSA public key, your name, the name of the CA, and is digitally signed by your CA. Browsers that know the CA can verify the signature on that Certificate, thereby obtaining your RSA public key. That enables them to send messages which only you can decrypt. See the <a href="ssl_intro.html">Introduction</a> chapter for a general description of the SSL protocol.</p><h3><a name="startup" id="startup">Seems like there is a difference on startup between the original Apache and an SSL-aware Apache?</a></h3><p>Yes, in general, starting Apache with a built-in mod_ssl is just like starting an unencumbered Apache, except for the fact that when you have a pass phrase on your SSL private key file. Then a startup dialog pops up asking you to enter the pass phrase.</p> <p>To type in the pass phrase manually when starting the server can be problematic, for instance when starting the server from the system boot scripts. As an alternative to this situation you can follow the steps below under ``How can I get rid of the pass-phrase dialog at Apache startup time?''.</p><h3><a name="realcert" id="realcert">Ok, I've got my server installed and want to create a real SSLserver Certificate for it. How do I do it?</a></h3><p>Here is a step-by-step description:</p> <ol> <li>Make sure OpenSSL is really installed and in your <code>PATH</code>. But some commands even work ok when you just run the ``<code>openssl</code>'' program from within the OpenSSL source tree as ``<code>./apps/openssl</code>''.<br /> <br /> </li> <li>Create a RSA private key for your Apache server (will be Triple-DES encrypted and PEM formatted):<br /> <br /> <code><strong>$ openssl genrsa -des3 -out server.key 1024</strong></code><br /> <br /> Please backup this <code>server.key</code> file and remember the pass-phrase you had to enter at a secure location. You can see the details of this RSA private key via the command:<br /> <br /> <code><strong>$ openssl rsa -noout -text -in server.key</strong></code><br /> <br /> And you could create a decrypted PEM version (not recommended) of this RSA private key via:<br /> <br /> <code><strong>$ openssl rsa -in server.key -out server.key.unsecure</strong></code><br /> <br /> </li> <li>Create a Certificate Signing Request (CSR) with the server RSA private key (output will be PEM formatted):<br /> <br /> <code><strong>$ openssl req -new -key server.key -out server.csr</strong></code><br /> <br /> Make sure you enter the FQDN ("Fully Qualified Domain Name") of the server when OpenSSL prompts you for the "CommonName", i.e. when you generate a CSR for a website which will be later accessed via <code>https://www.foo.dom/</code>, enter "www.foo.dom" here. You can see the details of this CSR via the command<br /> <br /> <code><strong>$ openssl req -noout -text -in server.csr</strong></code><br /> <br /> </li> <li>You now have to send this Certificate Signing Request (CSR) to a Certifying Authority (CA) for signing. The result is then a real Certificate which can be used for Apache. Here you have two options: First you can let the CSR sign by a commercial CA like Verisign or Thawte. Then you usually have to post the CSR into a web form, pay for the signing and await the signed Certificate you then can store into a server.crt file. For more information about commercial CAs have a look at the following locations:<br /> <br /> <ol> <li> Verisign<br /> <a href="http://digitalid.verisign.com/server/apacheNotice.htm"> http://digitalid.verisign.com/server/apacheNotice.htm </a> </li> <li> Thawte Consulting<br /> <a href="http://www.thawte.com/certs/server/request.html"> http://www.thawte.com/certs/server/request.html </a> </li> <li> CertiSign Certificadora Digital Ltda.<br /> <a href="http://www.certisign.com.br"> http://www.certisign.com.br </a> </li> <li> IKS GmbH<br /> <a href="http://www.iks-jena.de/produkte/ca/"> http://www.iks-jena.de/produkte/ca/ </a> </li> <li> Uptime Commerce Ltd.<br /> <a href="http://www.uptimecommerce.com"> http://www.uptimecommerce.com </a> </li> <li> BelSign NV/SA<br /> <a href="http://www.belsign.be"> http://www.belsign.be </a> </li> </ol> Second you can use your own CA and now have to sign the CSR yourself by this CA. Read the next answer in this FAQ on how to sign a CSR with your CA yourself. You can see the details of the received Certificate via the command:<br /> <br /> <code><strong>$ openssl x509 -noout -text -in server.crt</strong></code><br /> </li> <li>Now you have two files: <code>server.key</code> and <code>server.crt</code>. These now can be used as following inside your Apache's <code>httpd.conf</code> file: <pre> SSLCertificateFile /path/to/this/server.crt SSLCertificateKeyFile /path/to/this/server.key </pre> The <code>server.csr</code> file is no longer needed. </li> </ol><h3><a name="ownca" id="ownca">How can I create and use my own Certificate Authority (CA)?</a></h3> <p>The short answer is to use the <code>CA.sh</code> or <code>CA.pl</code> script provided by OpenSSL. The long and manual answer is this:</p> <ol> <li>Create a RSA private key for your CA (will be Triple-DES encrypted and PEM formatted):<br /> <br /> <code><strong>$ openssl genrsa -des3 -out ca.key 1024</strong></code><br /> <br /> Please backup this <code>ca.key</code> file and remember the pass-phrase you currently entered at a secure location. You can see the details of this RSA private key via the command<br /> <br /> <code><strong>$ openssl rsa -noout -text -in ca.key</strong></code><br /> <br /> And you can create a decrypted PEM version (not recommended) of this private key via:<br /> <br /> <code><strong>$ openssl rsa -in ca.key -out ca.key.unsecure</strong></code><br /> <br /> </li> <li>Create a self-signed CA Certificate (X509 structure) with the RSA key of the CA (output will be PEM formatted):<br /> <br /> <code><strong>$ openssl req -new -x509 -days 365 -key ca.key -out ca.crt</strong></code><br /> <br /> You can see the details of this Certificate via the command:<br /> <br /> <code><strong>$ openssl x509 -noout -text -in ca.crt</strong></code><br /> <br /> </li> <li>Prepare a script for signing which is needed because the ``<code>openssl ca</code>'' command has some strange requirements and the default OpenSSL config doesn't allow one easily to use ``<code>openssl ca</code>'' directly. So a script named <code>sign.sh</code> is distributed with the mod_ssl distribution (subdir <code>pkg.contrib/</code>). Use this script for signing. </li> <li>Now you can use this CA to sign server CSR's in order to create real SSL Certificates for use inside an Apache webserver (assuming you already have a <code>server.csr</code> at hand):<br /> <br /> <code><strong>$ ./sign.sh server.csr</strong></code><br /> <br /> This signs the server CSR and results in a <code>server.crt</code> file.<br /> </li> </ol>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?