SSL stands for Secure Sockets Layer in short, it's the standard technology for keeping an internet connection secure and safeguarding any sensitive data that is being sent between two systems. The two systems can be a server and a client (for example, a shopping website and browser) or server to server (for example, an application with personal identifiable information or with payroll information). In general we would say SSL Certificates protect your sensitive information such as credit card information, usernames, passwords etc.
This particular kind of cryptography harnesses the power of two keys which are long strings of randomly generated numbers. One is called a private key and another one is called a public key.A public key is known to your server and available in the public domain. It can be used to encrypt any message.
In this post I will show you how to properly configure OpenSSL which is full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
OpenSSL
is a nice tool to help you became a CA (Certificaet Authority)
to sign other people's CSR (Certificate Signing Request).OpenSSL
can generate 2048-bit keys. Certificates generated by OpenSSL
are compatible for "keytool" to import into 'keystore' files. We will use 2048-Bit Private Keys, for most web sites, security provided by 2,048-bit RSA keys is
sufficient. The RSA public key algorithm is widely supported, which
makes keys of this type a safe default choice.Create your server's self signed SSL Certificates.
Note: If you use your server for a business, it better to buy and use Formal Certificates.
cd /etc/ssl/private
openssl genrsa -aes128 -out server.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
......................+++++
....................+++++
e is 65537 (0x010001)
Enter pass phrase for server.key: # set passphrase
Verifying - Enter pass phrase for server.key: # confirm
# remove passphrase from private key
openssl rsa -in server.key -out server.key
Enter pass phrase for server.key: # passphrase
writing RSA key
generate certificate requests
openssl req -new -days 3650 -key server.key -out server.csr
Ignoring -days; not generating a certificate
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:TZ
State or Province Name (full name) [Some-State]:Dar Es Salaam
Locality Name (eg, city) []:Dar Es Salaam
Organization Name (eg, company) [Internet Widgits Pty Ltd]:LBT
Organizational Unit Name (eg, section) []:internal labnet
Common Name (e.g. server FQDN or YOUR name) []:pyw.internal,labnet
Email Address []:admin@internal.labnet
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Generate a certificate signing request based on an existing certificate
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
Signature ok
subject=C = TZ, ST = Dar Es Salaam, L = Dar Es Salaam, O = LBT, OU = internal labnet, CN = "pyw.internal,labnet", emailAddress = admin@internal.labnet
Getting Private key