Adding Trusted Root Certificates on Linux | Windows OS Hub (2024)

This article will explain how to add (install) a new certificate to the trusted root certificate list on Linux.

Contents:

  • How to Install the Root Certificate in the Trust Store on Linux?
  • Adding a Trusted CA Certificate to Chrome and Firefox

Let’s say you are using a self-signed SSL/TLS certificate but don’t want to get SEC_ERROR_UNKNOWN_ISSUER error on the client browser whenever your site is opened.
Adding Trusted Root Certificates on Linux | Windows OS Hub (1)

In this example, we will install a self-signed certificate from an IIS website running on a Windows Server.

To check if your Linux host cannot verify (and therefore does not trust) the SSL certificate on a certain site, run the following command:

$ curl –I https://woshub.local

curl: (60) SSL certificate problem: unable to get local issuer certificate. More details here: https://curl.haxx.se/docs/sslcerts.htmlcurl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.

Adding Trusted Root Certificates on Linux | Windows OS Hub (2)

In this case, we need to add this website’s Root CA to the list of trusted certificates on Linux.

How to Install the Root Certificate in the Trust Store on Linux?

If you want to update your trusted certificate store on Linux, the first thing you need is the certificate’s PEM file with an *.CRT extension. A PEM certificate s a text file in base64 format that starts with the line —-BEGIN CERTIFICATE—– and ends with ——END CERTIFICATE——.

Adding Trusted Root Certificates on Linux | Windows OS Hub (3)

If you have your certificate’s file stored in DER format, you can convert it into PEM using the openssl command:

$ openssl x509 -in my_trusted_sub_ca.der -inform der -out my_trusted_sub_ca.cer

Now let’s see how you can add your CA root certificate to the trust list in DEB-based Linux distros (Ubuntu, Debian, Mint, Kali Linux, etc.).

First, copy your certificate files to the certificate store folder (/usr/local/share/ca-certificates/):

$ sudo cp my_trusted_sub_ca.crt /usr/local/share/ca-certificates/
$ sudo cp my_trusted_root_ca.crt /usr/local/share/ca-certificates/

Update the certificate store using the command:

$ sudo update-ca-certificates -v

If the command is not found, you need to install the package on your Ubuntu/Debian host:

$ sudo apt-get install -y ca-certificates

Adding Trusted Root Certificates on Linux | Windows OS Hub (4)

If the certificates have been successfully added, you will see a message saying that the certificate has been copied to /etc/ssl/certs/:

Updating certificates in /etc/ssl/certs…2 added, 0 removed; done.Running hooks in /etc/ca-certificates/update.d

Here’s another way to add new certificates to the trusted store on Linux:

$ sudo dpkg-reconfigure ca-certificates

Check out the list of certificates and select the ones you want to add to the trusted ones.

Adding Trusted Root Certificates on Linux | Windows OS Hub (5)

On Linux, the list of trusted certificates is stored in the file /etc/ssl/certs/ca-certificates.crt. Both of the above commands will update this file and add information about the new certificates.

Use the following command to make sure that your certificates have been added to the trust list:

$ awk -v cmd='openssl x509 -noout -subject' ' /BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt | grep -i YourCASubj

Specify the Common Name part of your certificate instead of YourCASubj to search the store by subject.

Adding Trusted Root Certificates on Linux | Windows OS Hub (6)

You can see if your OS trusts the certificate by using the command:

$ openssl verify my_trusted_sub_ca.crt

Adding Trusted Root Certificates on Linux | Windows OS Hub (7)

If your Linux host does not trust the certificate, you will get an error:

error 20 at 0 depth lookup: unable to get local issuer certificateerror my_trusted_sub_ca.crt: verification failed

You can use curl to ensure that the site uses a trusted SSL certificate:

$ curl –I https://woshub.local

Everything is alright, the certificate is trusted { HTTPOnly: secure }.

Adding Trusted Root Certificates on Linux | Windows OS Hub (8)

Note that a certificate file can also be added to the trust list manually:

$ sudo mkdir /usr/share/ca-certificates/extra
$ sudo cp my.crt /usr/share/ca-certificates/extra/mycert1.crt
$ sudo vim /etc/ca-certificates.conf

exta/mycert1.crt

$ sudo update-ca-certificates

To remove the certificate from the trusted list, simply delete your .crt file:

$ sudo rm /usr/local/share/ca-certificates/yourcert.crt

And update the CA store:

$ sudo update-ca-certificates --fresh

To add a certificate to the trust list on RPM-based Linux distros (CentOS, Oracle, RHEL, Rocky Linux, Fedora), use the following procedure:

  1. Instal the ca-certificates package: # yum install ca-certificates
  2. Copy the certificate file to /etc/pki/ca-trust/source/anchors/: # cp mycert.crt /etc/pki/ca-trust/source/anchors/
  3. Update the certificate trusted store:
    # update-ca-trust force-enable
    # update-ca-trust extract

And here’s a similar article on managing the trusted root certificate store on Windows.

Adding a Trusted CA Certificate to Chrome and Firefox

After performing the above steps, all system tools will trust websites that use this CA. However, this will not affect the Mozilla Firefox or Google Chrome web browsers, as they will still show a warning message about the untrusted certificate.

The thing is that Firefox, Chromium, Google Chrome, Vivaldi, and even Mozilla Thunderbird e-mail client don’t use the Linux system certificate store. The certificate store for these programs can be found in the user’s directory in the cert8.db (for Mozilla) or cert9.db file (for Chromium and Chrome). To update these certificate stores, you can use the certutil tool from the libnss3-tools package.

First, install the package:

$ sudo apt install libnss3-tools

Adding Trusted Root Certificates on Linux | Windows OS Hub (9)

Now run the following bash script to add your certificates to the store via NSS:

#!/bin/bash
certfile="my_rusted_root_ca.crt"
certname="My Root CA1"
for certDB in $(find ~/ -name "cert8.db")
do
certdir=$(dirname ${certDB});
certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d dbm:${certdir}
done
for certDB in $(find ~/ -name "cert9.db")
do
certdir=$(dirname ${certDB});
certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d sql:${certdir}
done

Once that’s done, websites with the given CA will be trusted by all browsers.

Adding Trusted Root Certificates on Linux | Windows OS Hub (2024)

FAQs

Adding Trusted Root Certificates on Linux | Windows OS Hub? ›

Expand the Computer Configuration section and open Windows Settings\Security Settings\Public Key. Right-click Trusted Root Certification Authorities and select Import. Follow the prompts in the wizard to import the root certificate (for example, rootCA. cer ) and click OK.

How do I add a certificate to the trusted root in Linux? ›

Linux (Ubuntu, Debian)
  1. Copy your CA to dir /usr/local/share/ca-certificates/
  2. Use command: sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt.
  3. Update the CA store: sudo update-ca-certificates.

How do I add a trusted root certificate authority? ›

Expand the Computer Configuration section and open Windows Settings\Security Settings\Public Key. Right-click Trusted Root Certification Authorities and select Import. Follow the prompts in the wizard to import the root certificate (for example, rootCA. cer ) and click OK.

How to add SSL certificate to Truststore in Linux? ›

9.5. Add a Certificate to a Truststore Using Keytool
  1. Run the keytool -import -alias ALIAS -file public.cert -storetype TYPE -keystore server.truststore command: ...
  2. If the specified truststore already exists, enter the existing password for that truststore, otherwise enter a new password:

How to manually update root certificate? ›

On the machine without internet access...
  1. Click Start>Run. ...
  2. Type: certmgr.msc - this opens the certificate manager.
  3. Right click on the item "Trusted Root Certification Authorities.
  4. Select All Tasks>Import.
  5. Click Next.
  6. Click "Browse", change the file type in the lower right selection drop-down to "All Files"
Dec 20, 2019

Where are trusted certificates stored in Linux? ›

The default location to install certificates is /etc/ssl/certs . This enables multiple services to use the same certificate without overly complicated file permissions. For applications that can be configured to use a CA certificate, you should also copy the /etc/ssl/certs/cacert.

Where can I find trusted root certificates? ›

In the MMC, under the Certificates (Local Computer) tree, expand the Trusted Root Certification Authorities folder. Click on Certificates under the Trusted Root Certification Authorities . This will display all the certificates that are currently trusted by the computer.

How do you fix this CA root certificate is not trusted? ›

Workaround
  1. Manually import the root certificate on a machine by using the certutil -addstore root c:\tmp\rootca. ...
  2. Open GPMC. ...
  3. Edit the GPO that you would like to use to deploy the registry settings in the following way: ...
  4. Deploy the new GPO to the machines where the root certificate needs to be published.
Feb 26, 2024

How do I create a trusted Certificate Authority? ›

To set up a CA, perform the following tasks:
  1. Create the directories and configuration files for the CA. ...
  2. Create the server's private key and root certificate. ...
  3. Add the root certificate as a trusted certificate on your network. ...
  4. Configure OpenSSL to use the server's private key and certificate to sign certificate requests.

How to find root certificate in Linux? ›

Here are the typical locations:
  1. Certificate Authority (CA) Certificates: Root CA certificates are typically stored in: /etc/ssl/certs/ ...
  2. Server Certificates and Keys: Server SSL certificates and private keys are usually stored in: /etc/ssl/private/
Nov 9, 2023

How to add SSL certificate in Linux command line? ›

The installation is in four parts
  1. Copy the certificate files to your server.
  2. Configure the Apache server to point to certificate files.
  3. Test the configuration was successful.
  4. Restart the Apache server.

How do I add a root certificate to Truststore? ›

Installing a Root Certificate in the Trust Store
  1. Import the root certificate. Execute the command JRE_HOME/bin/keytool -import -trustcacerts -alias certAlias -file certFile -keystore trustStoreFile. ...
  2. Confirm that you trust the certificate. ...
  3. Identify the trust store to the client application.

How do I add to the list of trusted certificates? ›

To add certificates to the Trusted Root Certification Authorities store for a local computer, please follow the steps below:
  1. Click Start, click Start Search, type mmc, and then press ENTER.
  2. Under Available snap-ins, click Certificates, and then click Add.
  3. Click Local computer, and click Finish.

How do I add a personal certificate to trusted root? ›

Adding certificate snap-ins

Choose My user account. Choose Add again and this time select Computer Account. Move the new certificate from the Certificates-Current User > Trusted Root Certification Authorities into Certificates (Local Computer) > Trusted Root Certification Authorities.

How do I upload a root certificate? ›

Install root certificates on Windows
  1. Click Continue to the website.
  2. In the address bar, right-click the certificate and select View Certificates.
  3. On the certificate dialog, click the Details tab.
  4. Click Copy to file.
  5. In the wizard, select Base-64 encoded binary X. ...
  6. Click the Windows Start button.

How do I add a certificate to system roots? ›

To add certificates to the Trusted Root Certification Authorities store for a local computer, please follow the steps below:
  1. Click Start, click Start Search, type mmc, and then press ENTER.
  2. Under Available snap-ins, click Certificates, and then click Add.
  3. Click Local computer, and click Finish.

How do I add a certificate to GPO trusted root? ›

To Add a Trusted Root Certificate to the Group Policy Object
  1. Open the Certificates (MMC) snap-in. ...
  2. Select Computer account, and click Next.
  3. Select Local computer, then click Next.
  4. Click Certificates > Trusted Root Certification Authorities > Certificates.

How do I add a self-signed certificate to Trusted? ›

Adding the self-signed certificate as trusted to a browser
  1. Select the Continue to this website (not recommended) link. ...
  2. Click Certificate Error. ...
  3. Select the View certificates link. ...
  4. Select the Details tab, and then click Copy to File to create a local copy of the certificate. ...
  5. Follow the Wizard instructions.
Aug 22, 2024

Top Articles
Your Fall Financial Checklist: 17 Things To Do Now
XRP Price Prediction - Forecast for 2022, 2023, 2025 & 2030
No Hard Feelings (2023) Tickets & Showtimes
Ups Stores Near
Sound Of Freedom Showtimes Near Governor's Crossing Stadium 14
Research Tome Neltharus
Cad Calls Meriden Ct
The Ivy Los Angeles Dress Code
oklahoma city for sale "new tulsa" - craigslist
Arrests reported by Yuba County Sheriff
Is Csl Plasma Open On 4Th Of July
Ktbs Payroll Login
Craigslist Free Grand Rapids
The Blind Showtimes Near Showcase Cinemas Springdale
Unit 1 Lesson 5 Practice Problems Answer Key
Voyeuragency
Gino Jennings Live Stream Today
Craiglist Tulsa Ok
Driving Directions To Bed Bath & Beyond
Viha Email Login
Gina Wilson All Things Algebra Unit 2 Homework 8
Delectable Birthday Dyes
4 Times Rihanna Showed Solidarity for Social Movements Around the World
Danielle Moodie-Mills Net Worth
Tu Housing Portal
Trust/Family Bank Contingency Plan
Frequently Asked Questions - Hy-Vee PERKS
"Pure Onyx" by xxoom from Patreon | Kemono
Frommer's Belgium, Holland and Luxembourg (Frommer's Complete Guides) - PDF Free Download
Ark Unlock All Skins Command
Unlock The Secrets Of "Skip The Game" Greensboro North Carolina
Autozone Locations Near Me
Gets Less Antsy Crossword Clue
Dmitri Wartranslated
Ktbs Payroll Login
Registrar Lls
Dispensaries Open On Christmas 2022
Atom Tickets – Buy Movie Tickets, Invite Friends, Skip Lines
Does Target Have Slime Lickers
Iupui Course Search
Huntsville Body Rubs
Wpne Tv Schedule
Gonzalo Lira Net Worth
Best Restaurant In Glendale Az
SF bay area cars & trucks "chevrolet 50" - craigslist
Besoldungstabellen | Niedersächsisches Landesamt für Bezüge und Versorgung (NLBV)
Public Broadcasting Service Clg Wiki
Jesus Calling Oct 6
Coldestuknow
Inloggen bij AH Sam - E-Overheid
Affidea ExpressCare - Affidea Ireland
Latest Posts
Article information

Author: Melvina Ondricka

Last Updated:

Views: 6599

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Melvina Ondricka

Birthday: 2000-12-23

Address: Suite 382 139 Shaniqua Locks, Paulaborough, UT 90498

Phone: +636383657021

Job: Dynamic Government Specialist

Hobby: Kite flying, Watching movies, Knitting, Model building, Reading, Wood carving, Paintball

Introduction: My name is Melvina Ondricka, I am a helpful, fancy, friendly, innocent, outstanding, courageous, thoughtful person who loves writing and wants to share my knowledge and understanding with you.