Rss Feed Tweeter button Facebook button Technorati button Reddit button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button

A Waage Blog

Ruby, Rails, Life

Quick! create a self-signed SSL certificate in Ubuntu

with 2 comments

Especially for testing SSL, I can never remember how to create a self-signed certificate. Here’s a quick and dirty guide to setting up a self-signed certificate. Obviously, not recommended for production setups :)

We will create the certificate in the “/etc/ssl/self-signed” directory

# Become root first !
$ mkdir /etc/ssl/self-signed && cd /etc/ssl/self-signed
$ openssl genrsa -des3 -out server.key 1024
$ openssl rsa -in server.key -out server.key.insecure
$ mv server.key server.key.secure && mv server.key.insecure server.key
$ openssl req -new -key server.key -out server.csr
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Now, you can use the files server.key and server.crt in your web server setups. See my post on Setting up Node.js with to accept HTTP and HTTPS connections for a quick example of using this SSL certificate with Node.js!

Written by Andrew Waage

February 27th, 2012 at 4:20 pm

Posted in linux, ubuntu

2 Responses to 'Quick! create a self-signed SSL certificate in Ubuntu'

Subscribe to comments with RSS or TrackBack to 'Quick! create a self-signed SSL certificate in Ubuntu'.

  1. [...] In the example, we created a self-signed SSL certificate. If you need help on that, check out this quick guide on how to set up a self-signed SSL certificate on Ubuntu. [...]

  2. 3 of those commands are removing the password you set with -des3. Here’s a one liner:

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

    Chris LeBlanc

    16 Apr 12 at 4:12 pm

Leave a Reply