Creating an SSL Certificate using OpenSSL

Posted Sun, 20 Nov 2005

I just wanted to post some quick instructions on creating a self signed certificate that you can install into Apache 2 for use with mod_ssl. It seems that these instructions are hard to come by, and I thought it would be useful to just show how to do it without the messy explanations:

mkdir ~/sslcert
cd ~/sslcert

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

server.key and server.crt are now your private key and self-signed public certificate pair. If you install them into Apache2, you'll notice that you're now prompted for your certificate password everytime you start the server. This is because your private key is stored in an encrypted format for security. It's recommended that you leave it this way, but if you really hate that password prompt starting apache, here's how you can decrypt your private key file:

cd ~/sslcert
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key

Related Books

Apache Cookbook: Solutions and Examples for Apache Administrators SSL and TLS: Designing and Building Secure Systems Principles of Information Security, Third Edition Juniper(r) Networks Secure Access SSL VPN Configuration Guide Security Metrics: Replacing Fear, Uncertainty, and Doubt

Comments

On August 06, 2008 at 02:58 AM Travis Johnson wrote:

Hi Tim,
Thanks for posting this. It's nice to have a quick and useful reference for doing the bare minimum for getting this up and rolling.

Travis
http://traviscj.com

Post a Comment




About

My name is Tim Fanelli, I am a software engineer in Northern NY. I spend most of my time working, and when I can, I try to post interesting things here.

Cigar Dossiers