blob: 61900f9b6d2f2374dfb363fc7727235bce8e8327 [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux Cert Management
andybons3322f762015-08-24 21:37:092
Raphael Kubo da Costa15d33ef2021-11-18 18:26:023The easy way to manage certificates is navigate to chrome://settings/certificates.
andybonsad92aa32015-08-31 02:27:444Then click on the "Manage Certificates" button. This will load a built-in
5interface for managing certificates.
andybons3322f762015-08-24 21:37:096
andybonsad92aa32015-08-31 02:27:447On Linux, Chromium uses the
8[NSS Shared DB](https://wiki.mozilla.org/NSS_Shared_DB_And_LINUX). If the
9built-in manager does not work for you then you can configure certificates with
10the
11[NSS command line tools](http://www.mozilla.org/projects/security/pki/nss/tools/).
andybons3322f762015-08-24 21:37:0912
andybonsad92aa32015-08-31 02:27:4413## Details
andybons3322f762015-08-24 21:37:0914
andybonsad92aa32015-08-31 02:27:4415### Get the tools
andybons3322f762015-08-24 21:37:0916
Raphael Kubo da Costa92e0de22022-09-13 16:12:5117* Debian/Ubuntu: `sudo apt install libnss3-tools`
18* Fedora: `sudo dnf install nss-tools`
andybonsad92aa32015-08-31 02:27:4419* Gentoo: `su -c "echo 'dev-libs/nss utils' >> /etc/portage/package.use &&
20 emerge dev-libs/nss"` (You need to launch all commands below with the `nss`
21 prefix, e.g., `nsscertutil`.)
22* Opensuse: `sudo zypper install mozilla-nss-tools`
andybons3322f762015-08-24 21:37:0923
andybonsad92aa32015-08-31 02:27:4424### List all certificates
andybons3322f762015-08-24 21:37:0925
andybonsad92aa32015-08-31 02:27:4426 certutil -d sql:$HOME/.pki/nssdb -L
andybons3322f762015-08-24 21:37:0927
andybonsad92aa32015-08-31 02:27:4428### List details of a certificate
andybons3322f762015-08-24 21:37:0929
andybonsad92aa32015-08-31 02:27:4430 certutil -d sql:$HOME/.pki/nssdb -L -n <certificate nickname>
andybons3322f762015-08-24 21:37:0931
andybonsad92aa32015-08-31 02:27:4432### Add a certificate
andybons3322f762015-08-24 21:37:0933
andybonsad92aa32015-08-31 02:27:4434```shell
35certutil -d sql:$HOME/.pki/nssdb -A -t <TRUSTARGS> -n <certificate nickname> \
36-i <certificate filename>
37```
andybons3322f762015-08-24 21:37:0938
andybonsad92aa32015-08-31 02:27:4439The TRUSTARGS are three strings of zero or more alphabetic characters, separated
40by commas. They define how the certificate should be trusted for SSL, email, and
41object signing, and are explained in the
Raphael Kubo da Costa92e0de22022-09-13 16:12:5142[certutil docs](https://firefox-source-docs.mozilla.org/security/nss/legacy/tools/nss_tools_certutil/index.html)
andybonsad92aa32015-08-31 02:27:4443or
Raphael Kubo da Costa92e0de22022-09-13 16:12:5144[Meena's blog post on trust flags](https://web.archive.org/web/20131212024426/https://blogs.oracle.com/meena/entry/notes_about_trust_flags).
andybons3322f762015-08-24 21:37:0945
andybonsad92aa32015-08-31 02:27:4446For example, to trust a root CA certificate for issuing SSL server certificates,
47use
andybons3322f762015-08-24 21:37:0948
andybonsad92aa32015-08-31 02:27:4449```shell
50certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <certificate nickname> \
51-i <certificate filename>
52```
andybons3322f762015-08-24 21:37:0953
54To import an intermediate CA certificate, use
55
andybonsad92aa32015-08-31 02:27:4456```shell
57certutil -d sql:$HOME/.pki/nssdb -A -t ",," -n <certificate nickname> \
58-i <certificate filename>
59```
andybons3322f762015-08-24 21:37:0960
61Note: to trust a self-signed server certificate, we should use
62
andybonsad92aa32015-08-31 02:27:4463```
64certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n <certificate nickname> \
65-i <certificate filename>
66```
andybons3322f762015-08-24 21:37:0967
andybonsad92aa32015-08-31 02:27:4468#### Add a personal certificate and private key for SSL client authentication
andybons3322f762015-08-24 21:37:0969
70Use the command:
71
andybonsad92aa32015-08-31 02:27:4472 pk12util -d sql:$HOME/.pki/nssdb -i PKCS12_file.p12
andybons3322f762015-08-24 21:37:0973
andybonsad92aa32015-08-31 02:27:4474to import a personal certificate and private key stored in a PKCS #12 file. The
75TRUSTARGS of the personal certificate will be set to "u,u,u".
andybons3322f762015-08-24 21:37:0976
andybonsad92aa32015-08-31 02:27:4477### Delete a certificate
andybons3322f762015-08-24 21:37:0978
andybonsad92aa32015-08-31 02:27:4479 certutil -d sql:$HOME/.pki/nssdb -D -n <certificate nickname>