Host-based snakeoil certificates in Ubuntu

How to create snakeoil a certificate and a key for a given host in Ubuntu?


First make sure that the ssl-cert package is installed:

sudo apt-get install ssl-cert

Then, try the command below.

sudo make-ssl-cert generate-default-snakeoil --force-overwrite

This will end up creating or overwriting the following files:

/etc/ssl/certs/ssl-cert-snakeoil.pem
/etc/ssl/private/ssl-cert-snakeoil.key