How to generate self signed ssl certificate in centos
Generating Self Signed SSL Certificate - Centos
About Self-Signed Certificates
SSL Certificates, sometimes called digital certificates, are used to establish a secure encrypted connection between a browser (user's computer) and a server (website). The SSL connection protects sensitive data, such as credit card information, exchanged during each visit (session). Whether you need to secure one or many domains, one or multiple servers
Self-signed certificates Drawbacks
When using a self-signed certificate, there is no chain of trust. The certificate has signed itself. The web browser will then issue a warning, telling you that the web site certificate cannot be verified. Therefore, you should not use self-signed certificates for professional use, as your visitors will not trust your web site to be safe.
Below are the steps to generate Self signed ssl certificate in Apache using openssl
Steps: Self Signed SSL Genertion
Step 1 : installing the pre-requisites
In order to generate the self-signed certificate, we first have to be sure that apache ,openssl and modssl are installed on your server
yum install apache openssl mod_ssl
Step 2 : Create a new Directory
mkdir /etc/httpd/ssl
Step 3 : generating self signed certificates
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt
with
this command ,we will be creating both the self signed ssl certificate and the
server key and placing them both into the new directory.
This
command will prompt terminal to display a lists of fields that need to be
filled in.
Generating a 2048 bit RSA private keywriting new private key to '/etc/httpd/ssl/apache.key'You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter '.', the field will be left blank.Country Name (2 letter code) [XX]:INState or Province Name (full name) []:KARNATAKALocality Name (eg, city) [Default City]:SBCOrganization Name (eg, company) [Default Company Ltd]:STRIKER24X7Organizational Unit Name (eg, section) []:DIALERCommon Name (eg, your name or your server's hostname) []:14.102.81.114Email Address []:support@striker24x7.com
Step 4 : Setting up the Certificate
Now
we have all of the required components of the finished certificate.The next
thing to do is to set up the virtual hosts to display the new certificate.
Open
up the SSL config file:
vi /etc/httpd/conf.d/ssl.conf
Find the section that begins with
<VirtualHost _default_:443> and make some quick changes.
Uncomment the DocumentRoot and
ServerName line and replace example.com with your DNS approved domain name or
server IP address (it should be the same as the common name on the
certificate):
DocumentRoot "/var/www/html"ServerName example.com:443
Find the following three lines, and make sure that they match the extensions below:
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/apache.crt
SSLCertificateKeyFile /etc/httpd/ssl/apache.key
Step 5 : Restart apache/httpd
/etc/init.d/httpd restart
In your browser, type https://youraddress to view the new certificate.
Support
For support reach me on skype:striker24x7
Check out my youtube channel