Certificate Signing Request (CSR) is required for placing an order to obtain an SSL certificate from any SSL certificate provider. You can create your certificate signing request (CSR) for your Apache web server with the OpenSSL utility. OpenSSL utility comes with the OpenSSL package and is usually installed under /usr/bin/openssl. You can find the installed location of the utility using the below command:
[root@dbappweb ~]# whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/share/man/man1/openssl.1ssl.gz
Generate Certificate Signing Request (CSR) for Apache Using OpenSSL
Follow the below instructions to use OpenSSL to create your certificate signing request (CSR) on your Apache server.
Step 1: Generating the Private Key
generate the private key using the below command, and provide the passphrase to enhance the security of the apache service. This passphrase will be required when you will start the apache service after installing the SSL certificate. The private key dbappweb.key will be stored in the current working directory.
[root@dbappweb ~]# openssl genrsa -des3 -out dbappweb.key 2048
Generating RSA private key, 2048 bit long modulus
................+++
........+++
e is 65537 (0x10001)
Enter pass phrase for dbappweb.key:
Verifying - Enter pass phrase for dbappweb.key:
[root@dbappweb ~]#
Step 2: Generating the Certificate Signing Request (CSR)
Generate the Certificate Signing Request (CSR) using the below command by using the private key generated in the first step and passphrase. The Generated CSR (dbappweb.csr) will be stored in the current working directory.
[root@dbappweb ~]# openssl req -new -key dbappweb.key -out dbappweb.csr
Enter pass phrase for dbappweb.key:
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) [XX]:IN
State or Province Name (full name) []:Delhi
Locality Name (eg, city) [Default City]:New Delhi
Organization Name (eg, company) [Default Company Ltd]:Database Applictaion and Web Server
Organizational Unit Name (eg, section) []:DbAppWeb
Common Name (eg, your name or your server's hostname) []:www.dbappweb.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@dbappweb ~]#
Inputs are given in step 2 for various parameters are described below:
Country Name: Use the two-letter code without punctuation for country, for example:US or CA or IN etc..
State or Province: Spell out the state completely; do not abbreviate the state or province name, for example: California, Delhi etc.
Locality or City: The Locality field is the city or town name, for example: Berkeley. Do not abbreviate. For example: Saint Louis, not St. Louis, New Delhi etc.
Company: If the company or department has an &, @, or any other symbol using the shift key in its name, the symbol must be spelled out or omitted, in order to enroll. Example: XY & Z Corporation would be XYZ Corporation or XY and Z Corporation.
Organizational Unit: The Organizational Unit (OU) field is the name of the department or organization unit making the request. To skip the OU field, press Enter on the keyboard.
Common Name: The Common Name is the Host + Domain Name. It looks like “www.company.com” or “company.com”.
NOTE: Please do not enter an email address, challenge password or an optional company name when generating the CSR.A public/private key pair has now been created. The private key (dbappweb.key) is stored locally on the server machine and is used for decryption. The public portion, in the form of a Certificate Signing Request (dbappweb.csr), will be submitted for certificate enrollment.
Backup the Private Key
It is recommended that you should keep the backup of the private key (in my case it is dbappweb.key) on removable media or the backup server if you have one.
Last Updated: February 08, 2019