Post: How to create a Self-Signed SSL Certificate [Root Access and SSH Needed]
04-28-2012, 05:38 PM #1
NeedaSlutSoon
Vault dweller
(adsbygoogle = window.adsbygoogle || []).push({});
- Hello NextGenUpdate Members -
Posted by: You must login or register to view this content. // Date: April, 28th, 2012
-


Supported OS: CentOS 5.x - 6.x
Software Required: OpenSSL, Apache, Mod_ssl
Requirements: Root Access, SSH (Secure Shell)
Note: This is a complicated process to create an "mirror" of a real SSL Certificate - Should be used in a Testing/Internal purpose. I don't not take any responsibility for anything that this could cause.


  • Step 1 - Generating a Private Key
    The OpenSSL toolkit is used to generate an RSA Private Key and CSR (Certificate Signing Request). It can also be used to generate self-signed certificates which can be used for testing purposes or internal usage.

    The first step is to create your RSA Private Key. This key is a 1024 bit RSA key which is encrypted using Triple-DES and stored in a PEM format so that it is readable as ASCII text.

    Originally posted by Input
    openssl genrsa -des3 -out server.key 1024


    Originally posted by Code
    Generating RSA private key, 1024 bit long modulus
    .........................................................++++++
    ........++++++
    e is 65537 (0x10001)
    Enter PEM pass phrase: <- Type in a Password
    Verifying password - Enter PEM pass phrase: <- Reconfirm it here


  • Step 2 - Generate a CSR (Certificate Signing Request)
    Once the private key is generated a Certificate Signing Request can be generated. The CSR is then used in one of two ways. Ideally, the CSR will be sent to a Certificate Authority, such as Thawte or Verisign who will verify the identity of the requestor and issue a signed certificate.


    During the generation of the CSR, you will be prompted for several pieces of information. These are the X.509 attributes of the certificate. One of the prompts will be for "Common Name (e.g., YOUR name)". It is important that this field be filled in with the fully qualified domain name of the server to be protected by SSL. If the website to be protected will be You must login or register to view this content., then enter public.iprickszone.com at this prompt. The command to generate the CSR is as follows:


    Originally posted by Input
    openssl req -new -key server.key -out server.csr

    Originally posted by Output
    Country Name (2 letter code) [GB]:CA
    State or Province Name (full name) [Berkshire]:British Columbia
    Locality Name (eg, city) [Newbury]:Vancouver
    Organization Name (eg, company) [My Company Ltd]:iPricksZone
    Organizational Unit Name (eg, section) []:Information Technology
    Common Name (eg, your name or your server's hostname) []: public.iprickszone.com
    Email Address []:admin at iprickszone dot com
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:



  • Step 3 - Remove Passphrase from Key
    One unfortunate side-effect of the pass-phrased private key is that Apache will ask for the pass-phrase each time the web server is started. Obviously this is not necessarily convenient as someone will not always be around to type in the pass-phrase, such as after a reboot or crash. mod_ssl includes the ability to use an external program in place of the built-in pass-phrase dialog, however, this is not necessarily the most secure option either. It is possible to remove the Triple-DES encryption from the key, thereby no longer needing to type in a pass-phrase. If the private key is no longer encrypted, it is critical that this file only be readable by the root user! If your system is ever compromised and a third party obtains your unencrypted private key, the corresponding certificate will need to be revoked. With that being said, use the following command to remove the pass-phrase from the key:

    Originally posted by Input
    cp server.key server.key.org
    openssl rsa -in server.key.org -out server.key

    Originally posted by Output
    The newly created server.key file has no more passphrase in it.

    -rw-r--r-- 1 root root 745 Jun 29 12:19 server.csr
    -rw-r--r-- 1 root root 891 Jun 29 13:22 server.key
    -rw-r--r-- 1 root root 963 Jun 29 13:22 server.key.or


  • Step 4 - Installing the Private Key and Certificate
    When Apache with mod_ssl is installed, it creates several directories in the Apache config directory. The location of this directory will differ depending on how Apache was compiled.

    Originally posted by Input
    cp server.crt /usr/local/apache/conf/ssl.crt
    cp server.key /usr/local/apache/conf/ssl.key


  • Step 5 - Restart Apache and Test

    Originally posted by Input
    /etc/init.d/httpd restart
    /etc/init.d/httpd restart


    Then go to your website with You must login or register to view this content.

Thanks for reading,
iPrick
(adsbygoogle = window.adsbygoogle || []).push({});

The following 3 users say thank you to NeedaSlutSoon for this useful post:

Jeremy, Pichu
05-02-2012, 07:47 PM #2
Pichu
RIP PICHU.
Interested, great if you are trying to create a shopping/marketing site and don't have money to pay for a real SSL certificate.
05-06-2012, 05:45 PM #3
Originally posted by iPrick View Post
- Hello NextGenUpdate Members -
Posted by: You must login or register to view this content. // Date: April, 28th, 2012
-


Supported OS: CentOS 5.x - 6.x
Software Required: OpenSSL, Apache, Mod_ssl
Requirements: Root Access, SSH (Secure Shell)
Note: This is a complicated process to create an "mirror" of a real SSL Certificate - Should be used in a Testing/Internal purpose. I don't not take any responsibility for anything that this could cause.


  • Step 1 - Generating a Private Key
    The OpenSSL toolkit is used to generate an RSA Private Key and CSR (Certificate Signing Request). It can also be used to generate self-signed certificates which can be used for testing purposes or internal usage.

    The first step is to create your RSA Private Key. This key is a 1024 bit RSA key which is encrypted using Triple-DES and stored in a PEM format so that it is readable as ASCII text.





  • Step 2 - Generate a CSR (Certificate Signing Request)
    Once the private key is generated a Certificate Signing Request can be generated. The CSR is then used in one of two ways. Ideally, the CSR will be sent to a Certificate Authority, such as Thawte or Verisign who will verify the identity of the requestor and issue a signed certificate.


    During the generation of the CSR, you will be prompted for several pieces of information. These are the X.509 attributes of the certificate. One of the prompts will be for "Common Name (e.g., YOUR name)". It is important that this field be filled in with the fully qualified domain name of the server to be protected by SSL. If the website to be protected will be You must login or register to view this content., then enter public.iprickszone.com at this prompt. The command to generate the CSR is as follows:






  • Step 3 - Remove Passphrase from Key
    One unfortunate side-effect of the pass-phrased private key is that Apache will ask for the pass-phrase each time the web server is started. Obviously this is not necessarily convenient as someone will not always be around to type in the pass-phrase, such as after a reboot or crash. mod_ssl includes the ability to use an external program in place of the built-in pass-phrase dialog, however, this is not necessarily the most secure option either. It is possible to remove the Triple-DES encryption from the key, thereby no longer needing to type in a pass-phrase. If the private key is no longer encrypted, it is critical that this file only be readable by the root user! If your system is ever compromised and a third party obtains your unencrypted private key, the corresponding certificate will need to be revoked. With that being said, use the following command to remove the pass-phrase from the key:




  • Step 4 - Installing the Private Key and Certificate
    When Apache with mod_ssl is installed, it creates several directories in the Apache config directory. The location of this directory will differ depending on how Apache was compiled.



  • Step 5 - Restart Apache and Test



    Then go to your website with You must login or register to view this content.

Thanks for reading,
iPrick



Yeah a good tutorial specially if you want trust/security on your site etc.. As said Shopping basket.
04-17-2014, 11:16 PM #4
Used this method on my server, thanks.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo