• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4 (GeoTrust/RapidSSL/Comodo)

By Abhishek Ghosh August 18, 2018 9:57 am Updated on August 18, 2018

How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4 (GeoTrust/RapidSSL/Comodo)

Advertisement

Although we have detailed guide on the same topic, there is necessity of an updated detailed guide for many users. Here Are the Detailed Steps & Commands on How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4. SSL Cert Provider Can Be GeoTrust, RapidSSL, Comodo Like CA. For this guide, we are assuming that the reader can manage own server via SSH and used with basic server management. We are strictly limiting this guide to paid DV or EV SSLs like from GeoTrust, RapidSSL, Comodo. Trial of those SSL/TLS will be same. This guide is not for Let’s Encrypt. Make sure that you have DNS CAA Record of the CA you going to use. RapidSSL and GeoTrust Quick Premium differs by root CA.

How to Install or Renew SSL Cert on Ubuntu 18-04 Apache 2-4

 

How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4

 

Obtaining certificate starts with generating CSR (Certificate Signing Request) file, which requires to create private key as initial step.

Those who will renew, they already have a private key. Unless there is reason, they can use that private key to generate the CSR (Certificate Signing Request). Old CSR (Certificate Signing Request) file generated from the old private key can be used for the purpose.

Advertisement

---

To generate a CSR, we need to create a key pair for our server. These two files are a digital certificate key pair – public and private. If we loss public/private key file or forget password, the fingerprint of SSL Certificate will no longer match and that is dangerous for public key pinning (HPKP).

We recommend tho use a 2048 bit key using OpenSSL utility on server. For generation of password-less (non-encrypted key) type the following command :

Vim
1
openssl genrsa -out private.key 2048

For an encrypted key use the below command :

Vim
1
openssl genrsa -des3 -out private.key 2048

 

The Fuss of Password on Apache Server

 

Note that, Apache2 does not by default easily support password in private key. You’ll need to perform extra steps to make Apache2 using encrypted (with password) private key. Else Apache2 will throw odd error on restart. You need these on your virtual server configuration file :

Vim
1
2
3
# any of these will work
SSLPassPhraseDialog |/path/to/password-script
SSLPassPhraseDialog exec:/path/to/password-script

That password-script is a simple script with this content :

Vim
1
2
#!/bin/sh
echo "your password here"

Make the script executable :

Vim
1
chmod +x /path/to/password-script

The above is for protecting the private key for commercial sites. For ordinary sites, we need password free private key. If you wrongly created private key protected by password, you can create password free private key from the old password protected file with the below command :

Vim
1
2
3
4
5
cp private.key backup_private.key
# encrypted_private.key, non-encrypted_private_key are names to indicate files
openssl rsa -in encrypted_private.key -out non-encrypted_private_key.key
chmod 400 non-encrypted_private_key.key
# you can use filename as private.key for easiness

You’ll get the above instructions in document site of Apache 2.4 (linked to Apache2 site).

 

Generate CSR (Certificate Signing Request) File

 

Type the following command :

Vim
1
openssl req -new -key private.key -out yourdomain-example.com.csr

It will ask you questions.

Country Name: Use the two-letter code without punctuation for country, like US, IN, CA.

State or Province: Full name of the state or province name, like California, West-Bengal

Locality or City: Just the city or town name, like Saint Louis, Kolkata

Company: You can omit it or write the name like TCW Corporation.

Organizational Unit: Optional field, for value like IT. Press Enter on your keyboard to skip.

Common Name: The Common Name is most important. It is domain name like thecustomizewindows.com. For wildcard certificate request, the syntax should look like *.thecustomizewindows.com

Do not enter your email address, challenge password or fill optional fields when generating the CSR. If those needed then the CA would instruct you. You’ll have

So at this step, we have private key, CSR file. Run cat on the CSR file, copy it and fill web form of CA to obtain SSL certificate.

As for GeoTrust, RapidSSL; you’ll receive email with your domain’s certificate in PEM format. There will be link to download the intermediate certificate. Open the web page of intermediate certificate.

 

The Final Steps

 

Go to the server directory where you have those private key, CSR files. You can keep them on directory like :

Vim
1
/usr/local/ssl/crt/

Copy the content of certificate sent by GeoTrust, RapidSSL, Comodo to you via email, open text editor on SSH and paste the content. Save the file :

Vim
1
2
nano public.crt
# paste and save

Copy the content of intermediate certificate pointed by GeoTrust, RapidSSL, Comodo to download via email, open text editor on SSH and paste the content. Save the file :

Vim
1
2
nano intermediate.crt
# paste and save

So our path :

Vim
1
/usr/local/ssl/crt/

Has four files :

Vim
1
2
ls -al
intermediate.crt private.key public.crt yourdomain-example.com.csr

We will generate Diffie-Hellman key (the command will take time to end) :

Vim
1
sudo openssl dhparam -out dhparam.pem 2048

Essentially you need virtual host and mod SSL activated in the way we directed in our TLS guide for Let’s Encrypt , for that repo’s Apache2, we have http2 module too:

Vim
1
2
3
4
5
6
a2enmod http2
systemctl restart apache2
a2enmod ssl
systemctl restart apache2
a2ensite default-ssl
systemctl restart apache2

Create a file named ssl-apache.conf in /usr/local/ssl/crt/ directory with this content :

Vim
1
2
3
4
5
6
7
8
SSLEngine on
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite          (find latest cipher suitable for you and add here)
SSLHonorCipherOrder     on
SSLCompression          off
SSLOptions +StrictRequire
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

Save the file.

Now, go to /etc/apache2/sites-available/ and run a ls -al to realize which config file you are using. Open to edit that file to add the below content :

Vim
1
2
3
4
5
### Start third party SSL cert block
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/private/private.key
SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
### End third party SSL cert block

The end configuration will be looking like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<IfModule mod_ssl.c>
<VirtualHost *:443>
Protocols http/1.1 h2
       ServerName jima.in
       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html/jima.in
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
### Start third party SSL cert block
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/private/private.key
SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
### End third party SSL cert block
 
SSLOpenSSLConfCmd DHParameters "/usr/local/ssl/crt/dhparams_4096.pem"
SSLOpenSSLConfCmd ECDHParameters secp384r1
SSLOpenSSLConfCmd Curves secp521r1:secp384r1
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomainsi; preload"
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options SAMEORIGIN
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
Include /usr/local/ssl/crt/ssl-apache.conf
 
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/html/jima.in>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
 
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 
</VirtualHost>
 
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>

Run configuration test :

Vim
1
apachectl -t

If syntax is OK then restart Apache :

Vim
1
service apache2 restart

Test your site on :

Vim
1
2
https://www.ssllabs.com/ssltest/analyze.html
https://securityheaders.io

If you face trouble in setup, then ask on StackExchange, ServerFault like Q&A sites pointing to our site at the step you have messed up. Apache2 is commonly used webserver and whole earth knows about common errors.

Tagged With install ssl ubuntu , how to renew ssl certificate in ubuntu 18 , ubuntu 18 04 ssl , how to renew ssl certs for apache2 , ubuntu renew certificate , ssl installation in ubuntu 18 , ZOPD , how to access private and public certificates for ubuntu 18 04 , godaddy certificate for ubuntu 18 04 , COMODO cert add to server ubuntu 18 04

This Article Has Been Shared 339 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4 (GeoTrust/RapidSSL/Comodo)

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • Top Reasons Why Cloud Server Sucks Your Bucks

    Public Cloud is Deceptive From Sysadmin’s Point of View When Usage of RAM is More. Here Are Top Reasons Why Cloud Server Sucks Your Bucks.

  • How To Perform Security Audits On Ubuntu 16.04 (With Lynis)

    Here Is How To Perform Security Audits On Ubuntu 16.04 With Lynis And Other Tools Which Are Appropriate On Cloud Server’s Shared Environment.

  • How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

    rsnapshot Once Set, Can Automatically Incrementally Backup. Here is How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS.

  • Analyzing Unexpected Shutdown of Ubuntu Cloud Server

    Unexpected Shutdown May Be Warning of Deeper Complex Issues. Here is Some Basics on Analyzing Unexpected Shutdown of Ubuntu Cloud Server from SSH.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is ChatGPT? February 3, 2023
  • Zebronics Pixaplay 16 : Entry Level Movie Projector Review February 2, 2023
  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How to Install or Renew SSL Cert on Ubuntu 18.04, Apache 2.4 (GeoTrust/RapidSSL/Comodo)," in The Customize Windows, August 18, 2018, February 4, 2023, https://thecustomizewindows.com/2018/08/how-to-install-or-renew-ssl-cert-on-ubuntu-18-04-apache-2-4-geotrust-rapidssl-comodo/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT