• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

securitywing

How to Renew Self-Signed SSL Certificate with OpenSSL Tool in Linux

by wing

OpenSSL is a free and open-source SSL solution that anyone can use for personal and commercial purposes. Although it is free, certificates created with it can expire, and you may need to renew them. This post will show you how to renew a self-signed certificate using the OpenSSL tool on a Linux server. If you are looking into creating a new self-signed certificate instead of renewing an existing one, please take a look at Six Easy Steps to Create a Self-Signed Certificate on Ubuntu Server

What do I need to know to renew my OpenSSL cert?                              

You must know the location of your current certificate that has expired and the private key. The majority  of the Linux server administrator like to put the certificate files in the /etc/apache2/ssl directory. You can take a look at the /etc/apache2/ssl directory or for your existing cert file and the private key.

If you do not know where you kept your private key, do not worry; you can generate a new one using the following command. However, note that this new key will not restore access to anything associated with the lost key.

openssl genrsa -out /etc/apache2/ssl/mynew.key 2048

 

To renew the secure socket layer (SSL) cert, you need to follow two steps:

  1. create a CSR (certificate signing request)
  2. and generate the certificate with your private key.

Remember that you must need a private key before creating your CSR.

Scenario: for example, you have a certificate called apache.crt which has been expired and you want to renew it for the next 365 days.

The complete procedures you need to follow:

  1. Create a certificate signing request with the following command:

openssl req -new -key /etc/apache2/ssl/mykey.key -out /etc/apache2/ssl/new.csr

  1. Check your certificate signing request information using the following command:

openssl req -in /etc/apache2/ssl/new.csr -noout –text

 

Before creating the new certification, please rename the apache.crt file located in /etc/apache2/ssl so that you do not have to change anything  in the  apache configuration file.

openssl x509 -req -days 365 -in /etc/apache2/ssl/new.csr -signkey /etc/apache2/ssl/mykey.key -out /etc/apache2/ssl/apache.crt

Note: in the above command 365 is the number of days after which your new certificate will expire. The name of key file is mykey.key and the name of the certificate file is apache.crt. You need to change the name of the key and the CRT file name to match your existing certificate and the key file.

Next, restart apache2 server with the following command:

service apache2 restart

Finally, test the new expiry date of your certificate by running the following openssl command.

openssl x509 -in /etc/apache2/ssl/apache.crt -noout -enddate

Related posts:

  1. How to install a new Godaddy SSL Wildcard Certificate
  2. How to Setup SSL in AWS application load balancer for WordPress
  3. Facebook Security Issues| Checklists
  4. How to Control Directory Access with Htaccess and Htpasswd in Apache

Filed Under: Internet Security and Safety Tagged With: openssl, renew, SSL

Primary Sidebar

Please help us sharing

Categories

  • AWS
  • Basics
  • Containers
  • Cryptocurrency
  • Cyber
  • Internet Security and Safety
  • IS Audit
  • IT Security Exams
  • Law & Human Rights
  • Network Security Tips
  • Off Track
  • Social Media Governance
  • Tech Comparisons
  • Tech Stack Suitability
  • Telecom
  • Tutorial

CISSP Sample Test

Take a CISSP Sample Test

CISA Sample Test

CISA IT governance Sample test

Please Follow Us

Contact us for Ads

Go to Contact Form

Search

Footer

Copyrights

Protected by Copyscape Duplicate Content Detection Software

Securitywing.com reserves the copyrights of all of its published articles.No contents of this site is permitted to be published to anywhere else in the Internet.If any contents are found in any other websites, securitywing reserves the rights to file a DMCA complaint. But you have the right to use the link of any relevant article of this site to point from your website if you consider that it might improve the quality of your article.

Tags

audit AWS backup basics browser check cisco cloud computer configuration cyber data database email gmail hsrp ids iis informaiton internet kubernetes linux load balancing malware microsoft network protection redundancy risk router security security tips server social media SSL switch test tools vpn vrrp web webserver website windows wordpress

Copyright © 2010-2025 ·All Rights Reserved · SecurityWing.com