|# SSL self signed localhost for rails start to finish, no red warnings.|
|# 1) Create your private key (any password will do, we remove it below)|
|$ openssl genrsa -des3 -out server.orig.key 2048|
|# 2) Remove the password|
|$ openssl rsa -in server.orig.key -out server.key|
|# 3) Generate the csr (Certificate signing request) (Details are important!)|
|$ openssl req -new -key server.key -out server.csr|
|# MUST have localhost.ssl as the common name to keep browsers happy|
|# (has to do with non internal domain names ... which sadly can be|
|# avoided with a domain name with a "." in the middle of it somewhere)|
|Country Name (2 letter code) [AU]:|
|Common Name: localhost.ssl|
|# 4) Generate self signed ssl certificate|
|$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt|
|# 5) Finally Add localhost.ssl to your hosts file|
|$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /private/etc/hosts|
|# 6) Boot thin|
|$ thin start --ssl --ssl-verify --ssl-key-file server.key --ssl-cert-file server.crt|
|# 7) Add server.crt as trusted !!SYSTEM!! (not login) cert in the mac osx keychain|
|# Open keychain tool, drag .crt file to system, and trust everything.|
|# 1) Https traffic and http traffic can't be served from the same thin process. If you want|
|# both you need to start two instances on different ports.|
Step one, create a DES3 encrypted key with a password.
All of that can be summarized into one step:
req(1ssl) answers what the line does, but I'll put it here for completness:
The other problem with this is that it will not teach you how TLS works, or rather, how it should work, and what you as application programmer need to do in order to get it right:
Client applications should generally reject self signed certificates, and instead validate a chain up to a CA that they trust. This CA can still be created by you, but you'll need to walk the extra kilometer.
Really, it's just a couple of meters:
https://gist.github.com/igalic/4943106 -- The explanation and comments in this Makefile should help with that, or so I like to think.
Thanks for this gist!
I'm interested in doing this all programmatically. I found that I can pass in info for the prompts with the -subj flag. Reference from http://www.codenes.com/blog/?p=300#comment-2068
Here's the command I ended up using:
I did all the steps in the first outline, but failed at step 6. I got
Cool, it was finally the only detailed solution on the web that worked for me.
Ain't there a way to add the