|
To Whom It May Concern: This page is blatantly kyped from its originating location strictly to make sure it doesn't disapear off the web. I have found that these instructions work, and don't care to have to deal with drudging through all the other howto's to find another that does. With the exception of this note, the entire document is "as found" with all accredations still in place. Following is a step-by-step guide to creating a self-signed server certificate with openssl on linux. Solaris 2.10 issues are discussed briefly as well. Some of the finer points will vary based on your linux distribution, but this document will explain what goes on at each step. Making a self-signed certificate will cause the client browser to prompt with a message whether you want to trust the certificate signing authority (yourself). But it'll save you a few hundred dollars that would otherwise go to a recognized signing authority. The message "web site certified by an unknown authority... accept?" may be a business liability for general public usage (although it's easy enough for a client to accept the certificate permanently). In that case, you may find yourself spending the money to have a widely recognized signing authority do this instead: paying for name recognition. But if you're on a budget, have a special need or small audience, signing it yourself might make sense. Note that these instructions create a Certificate Authority (CA). It's possible to one time self-sign a certificate without going through that trouble (no CA is involved). But making your own CA allows you to sign multiple server certificates using the same CA. Note also that web browsers will prompt whether you want to trust your homemade Certificate Authority for a particular session, permanently, or whether to reject it. Permanently accepting the CA will cause it to be stored by your browser, and you'll not be continually prompted with the "accept?" prompt for server keys signed by it. |
|
cd /usr/share/doc/packages/mod_ssl ./certificate.sh Follow the steps of the script, and just go with default values for everything since we'll replace it all in later steps. |
|
cd /etc/init.d ./apache stop ./apache restart |
|
openssl genrsa -des3 -out ca.key 4096 openssl req -new -x509 -days 365 -key ca.key -out ca.crt |
|
openssl genrsa -des3 -out server.key 4096 openssl req -new -key server.key -out server.csr |
|
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt |
| echo "01" >ca.srl |
|
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -out server.crt |
|
openssl rsa -noout -text -in server.key openssl req -noout -text -in server.csr openssl rsa -noout -text -in ca.key openssl x509 -noout -text -in ca.crt |
|
openssl rsa -in server.key -out server.key.insecure mv server.key server.key.secure mv server.key.insecure server.key |
|
cp server.key /etc/httpd/ssl.key cp server.crt /etc/httpd/ssl.crt cp server.csr /etc/httpd/ssl.csr |
|
ServerName xxx.xxx.xxx.xxx (Note: You should use the same server name or IP as the Common Name (CN) you picked while generating the server csr in one of the earlier steps. This will prevent client browsers from generating a message like "domain mismatch" when you first visit the site.) Red Hat and SuSE at this point should already be loading the ssl module, have the engine turned on, and be listening to 443. But you should double-check and examine the next settings detailed below as well. Red Hat 9+ LoadModule ssl_module modules/mod_ssl.so SuSE 8.x You might see something like this: Include /etc/httpd/suse_loadmodule.conf And in suse_loadmodule.conf you might see this: LoadModule ssl_module /usr/lib/apache/libssl.so Listen xxx.xxx.xxx.xxx:443 (Note: Replace the x's with your IP or DNS name. You can listen to a different port, although 443 is standard for https.) SSLEngine on SSLCertificateFile /etc/httpd/ssl.crt/server.crt SSLCertificateKeyFile /etc/httpd/ssl.key/server.key (Note: Of course you can select different directory locations for the .crt and .key files. Just make sure you reference the proper location where you placed them in an earlier step, and that you manage their permissions very carefully.) Most likely some other various tweaks. For example, you might want to create a separate directory from which to serve ssl web pages. What's nice about this is that you'll never inadvertently serve a sensitive page through port 80 so long as you develop in two separate places. Perhaps /var/www/html for basic port 80 stuff, and /var/www-ssl/html for port 443 or SSL delivered pages, or under /srv/... as typical under some SuSE distros. An example from Red Hat: <VirtualHost _default_:443> # General setup for the virtual host; inherited from global configuration. DocumentRoot "/var/www-ssl/html" (Note: Since Red Hat and other distros out-of-box may not have a /var/www-ssl or /var/www-ssl/html directory, you'll need to mkdir to create them as needed.) |
|
cd /etc/init.d ./apache2 restart |