Install OpenSSL
To properly set up SSL self-signed certificate we need openssl library. To check if we have it already installed (on Linux and Mac OS) simply input this command in terminal
1 |
$ which openssl |
If it returns something like this:
1 |
/usr/bin/openssl |
we can go further and create certificate. In other way we have to install openssl library. For different systems we can do the following:
- Linux (Ubuntu): apt-get install openssl
- Mac OS (using Homebrew): brew install openssl
- Windows: openssl installer
Create SSL certificate
To properly create SSL certificate just input in your terminal following commands
1 2 3 4 5 |
$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 $ openssl rsa -passin pass:x -in server.pass.key -out server.key $ rm server.pass.key $ openssl req -new -key server.key -out server.csr // after this command you can leave all inputs blank |
And now we can create our certificate using server.key and server.csr files
1 |
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |