blob: bfc062771049a5a4f264b4681f86d3409c56f10a [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux Cert Management
andybons3322f762015-08-24 21:37:092
nodira6074d4c2015-09-01 04:26:453*** note
andybonsad92aa32015-08-31 02:27:444**NOTE:** SSL client authentication with personal certificates does not work
5completely in Linux, see [issue 16830](https://crbug.com/16830) and
6[issue 25241](https://crbug.com/25241).
nodira6074d4c2015-09-01 04:26:457***
andybons3322f762015-08-24 21:37:098
andybonsad92aa32015-08-31 02:27:449The easy way to manage certificates is navigate to chrome://settings/search#ssl.
10Then click on the "Manage Certificates" button. This will load a built-in
11interface for managing certificates.
andybons3322f762015-08-24 21:37:0912
andybonsad92aa32015-08-31 02:27:4413On Linux, Chromium uses the
14[NSS Shared DB](https://wiki.mozilla.org/NSS_Shared_DB_And_LINUX). If the
15built-in manager does not work for you then you can configure certificates with
16the
17[NSS command line tools](http://www.mozilla.org/projects/security/pki/nss/tools/).
andybons3322f762015-08-24 21:37:0918
andybonsad92aa32015-08-31 02:27:4419## Details
andybons3322f762015-08-24 21:37:0920
andybonsad92aa32015-08-31 02:27:4421### Get the tools
andybons3322f762015-08-24 21:37:0922
andybonsad92aa32015-08-31 02:27:4423* Debian/Ubuntu: `sudo apt-get install libnss3-tools`
24* Fedora: `su -c "yum install nss-tools"`
25* Gentoo: `su -c "echo 'dev-libs/nss utils' >> /etc/portage/package.use &&
26 emerge dev-libs/nss"` (You need to launch all commands below with the `nss`
27 prefix, e.g., `nsscertutil`.)
28* Opensuse: `sudo zypper install mozilla-nss-tools`
andybons3322f762015-08-24 21:37:0929
andybonsad92aa32015-08-31 02:27:4430### List all certificates
andybons3322f762015-08-24 21:37:0931
andybonsad92aa32015-08-31 02:27:4432 certutil -d sql:$HOME/.pki/nssdb -L
andybons3322f762015-08-24 21:37:0933
andybonsad92aa32015-08-31 02:27:4434#### Ubuntu Jaunty error
35
andybons3322f762015-08-24 21:37:0936Above (and most commands) gives:
37
andybonsad92aa32015-08-31 02:27:4438 certutil: function failed: security library: invalid arguments.
andybons3322f762015-08-24 21:37:0939
40Package version 3.12.3.1-0ubuntu0.9.04.2
41
andybonsad92aa32015-08-31 02:27:4442### List details of a certificate
andybons3322f762015-08-24 21:37:0943
andybonsad92aa32015-08-31 02:27:4444 certutil -d sql:$HOME/.pki/nssdb -L -n <certificate nickname>
andybons3322f762015-08-24 21:37:0945
andybonsad92aa32015-08-31 02:27:4446### Add a certificate
andybons3322f762015-08-24 21:37:0947
andybonsad92aa32015-08-31 02:27:4448```shell
49certutil -d sql:$HOME/.pki/nssdb -A -t <TRUSTARGS> -n <certificate nickname> \
50-i <certificate filename>
51```
andybons3322f762015-08-24 21:37:0952
andybonsad92aa32015-08-31 02:27:4453The TRUSTARGS are three strings of zero or more alphabetic characters, separated
54by commas. They define how the certificate should be trusted for SSL, email, and
55object signing, and are explained in the
56[certutil docs](http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html#1034193)
57or
58[Meena's blog post on trust flags](https://blogs.oracle.com/meena/entry/notes_about_trust_flags).
andybons3322f762015-08-24 21:37:0959
andybonsad92aa32015-08-31 02:27:4460For example, to trust a root CA certificate for issuing SSL server certificates,
61use
andybons3322f762015-08-24 21:37:0962
andybonsad92aa32015-08-31 02:27:4463```shell
64certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <certificate nickname> \
65-i <certificate filename>
66```
andybons3322f762015-08-24 21:37:0967
68To import an intermediate CA certificate, use
69
andybonsad92aa32015-08-31 02:27:4470```shell
71certutil -d sql:$HOME/.pki/nssdb -A -t ",," -n <certificate nickname> \
72-i <certificate filename>
73```
andybons3322f762015-08-24 21:37:0974
75Note: to trust a self-signed server certificate, we should use
76
andybonsad92aa32015-08-31 02:27:4477```
78certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n <certificate nickname> \
79-i <certificate filename>
80```
andybons3322f762015-08-24 21:37:0981
andybonsad92aa32015-08-31 02:27:4482This should work now, because
83[NSS bug 531160](https://bugzilla.mozilla.org/show_bug.cgi?id=531160) is claimed
84to be fixed in a related bug report. If it doesn't work, then to work around
85the NSS bug, you have to trust it as a CA using the "C,," trust flags.
andybons3322f762015-08-24 21:37:0986
andybonsad92aa32015-08-31 02:27:4487#### Add a personal certificate and private key for SSL client authentication
andybons3322f762015-08-24 21:37:0988
89Use the command:
90
andybonsad92aa32015-08-31 02:27:4491 pk12util -d sql:$HOME/.pki/nssdb -i PKCS12_file.p12
andybons3322f762015-08-24 21:37:0992
andybonsad92aa32015-08-31 02:27:4493to import a personal certificate and private key stored in a PKCS #12 file. The
94TRUSTARGS of the personal certificate will be set to "u,u,u".
andybons3322f762015-08-24 21:37:0995
andybonsad92aa32015-08-31 02:27:4496### Delete a certificate
andybons3322f762015-08-24 21:37:0997
andybonsad92aa32015-08-31 02:27:4498 certutil -d sql:$HOME/.pki/nssdb -D -n <certificate nickname>