Thursday 29 August 2019

Generate a SSL Certificate (Self Signed)


Step 1:

openssl genrsa -des3 -out mykey.key 1024

 
Step 2: Generate a CSR

openssl req -new -key mykey.key -out certificate.csr
Country Name (2 letter code) [GB]: UK
State or Province Name (full name) [Berkshire]:London
Locality Name (eg, city) [Newbury]:London City
Organization Name (eg, company) [My Company Ltd]:Test Corp
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:test.abc.com
Email Address []:test@abc.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Step 3: Remove the Passphrase from Key

To avoid your Apache or your webserver asking the passphrase every time a reboot is required. you can remove the pass phrase. Please ensure this key file is properly protected to avoid loosing the key through unauthorised access to the server.  

cp mykey.key mykey.key.org
openssl rsa -in mykey.key.org -out mykey.key

Step 4: Generate a Self-Signed Certificate

Generate a temporary certificate that is valid for 365 days, :

openssl x509 -req -days 365 -in certificate.csr -signkey mykey.key -out    certificate.crt

No comments:

Post a Comment