blob: 7af877f18f65d17239fa2dd8a7488a3ab3c512f2 [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux Cert Management
andybons3322f762015-08-24 21:37:092
andybonsad92aa32015-08-31 02:27:443The easy way to manage certificates is navigate to chrome://settings/search#ssl.
4Then 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
andybonsad92aa32015-08-31 02:27:4417* Debian/Ubuntu: `sudo apt-get install libnss3-tools`
18* Fedora: `su -c "yum install nss-tools"`
19* 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#### Ubuntu Jaunty error
29
andybons3322f762015-08-24 21:37:0930Above (and most commands) gives:
31
andybonsad92aa32015-08-31 02:27:4432 certutil: function failed: security library: invalid arguments.
andybons3322f762015-08-24 21:37:0933
34Package version 3.12.3.1-0ubuntu0.9.04.2
35
andybonsad92aa32015-08-31 02:27:4436### List details of a certificate
andybons3322f762015-08-24 21:37:0937
andybonsad92aa32015-08-31 02:27:4438 certutil -d sql:$HOME/.pki/nssdb -L -n <certificate nickname>
andybons3322f762015-08-24 21:37:0939
andybonsad92aa32015-08-31 02:27:4440### Add a certificate
andybons3322f762015-08-24 21:37:0941
andybonsad92aa32015-08-31 02:27:4442```shell
43certutil -d sql:$HOME/.pki/nssdb -A -t <TRUSTARGS> -n <certificate nickname> \
44-i <certificate filename>
45```
andybons3322f762015-08-24 21:37:0946
andybonsad92aa32015-08-31 02:27:4447The TRUSTARGS are three strings of zero or more alphabetic characters, separated
48by commas. They define how the certificate should be trusted for SSL, email, and
49object signing, and are explained in the
50[certutil docs](http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html#1034193)
51or
52[Meena's blog post on trust flags](https://blogs.oracle.com/meena/entry/notes_about_trust_flags).
andybons3322f762015-08-24 21:37:0953
andybonsad92aa32015-08-31 02:27:4454For example, to trust a root CA certificate for issuing SSL server certificates,
55use
andybons3322f762015-08-24 21:37:0956
andybonsad92aa32015-08-31 02:27:4457```shell
58certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <certificate nickname> \
59-i <certificate filename>
60```
andybons3322f762015-08-24 21:37:0961
62To import an intermediate CA certificate, use
63
andybonsad92aa32015-08-31 02:27:4464```shell
65certutil -d sql:$HOME/.pki/nssdb -A -t ",," -n <certificate nickname> \
66-i <certificate filename>
67```
andybons3322f762015-08-24 21:37:0968
69Note: to trust a self-signed server certificate, we should use
70
andybonsad92aa32015-08-31 02:27:4471```
72certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n <certificate nickname> \
73-i <certificate filename>
74```
andybons3322f762015-08-24 21:37:0975
andybonsad92aa32015-08-31 02:27:4476This should work now, because
77[NSS bug 531160](https://bugzilla.mozilla.org/show_bug.cgi?id=531160) is claimed
78to be fixed in a related bug report. If it doesn't work, then to work around
79the NSS bug, you have to trust it as a CA using the "C,," trust flags.
andybons3322f762015-08-24 21:37:0980
andybonsad92aa32015-08-31 02:27:4481#### Add a personal certificate and private key for SSL client authentication
andybons3322f762015-08-24 21:37:0982
83Use the command:
84
andybonsad92aa32015-08-31 02:27:4485 pk12util -d sql:$HOME/.pki/nssdb -i PKCS12_file.p12
andybons3322f762015-08-24 21:37:0986
andybonsad92aa32015-08-31 02:27:4487to import a personal certificate and private key stored in a PKCS #12 file. The
88TRUSTARGS of the personal certificate will be set to "u,u,u".
andybons3322f762015-08-24 21:37:0989
andybonsad92aa32015-08-31 02:27:4490### Delete a certificate
andybons3322f762015-08-24 21:37:0991
andybonsad92aa32015-08-31 02:27:4492 certutil -d sql:$HOME/.pki/nssdb -D -n <certificate nickname>