For the love of all things good; there is two things I don’t like: (1) unnecessary convoluted setups and (2) redoing work I’ve done earlier. SSL Certificates seem to combine both into one beautifully painful mess.
I once again found myself in the need to generate a throwaway SSL certificate for local development and testing. As I’ve posted earlier there is a way to do that with more or less effort. Since I found myself doing this for the third time now I decided to spice things up a bit, cutting down the time it takes. I’ve created a small docker container that’s sole purpose it is to create a certificate from a given config file. The way it works is:
- Create a folder (e.g. ./certs) and place the below config file (named config.cfg) into it.
- Modify the config file, adding all the SANs required for this certificate
- docker run –rm -it -v./certs:/certs firefoxmetzger/create_ssl
That’s it. It will drop a `private.key` and `certificate.crt` into the previously created folder. It will also print the properties of the certificate into console so you can make sure the SANs are actually added.
Here is the config.cfg template
And here a link to the GitHub repo with the code of the docker image: