blob: 7c75acf8ceabdb12ea5427dc319480b2d9108533 [file] [log] [blame] [view]
andybonsad92aa32015-08-31 02:27:441# Linux Cert Management
andybons3322f762015-08-24 21:37:092
andybonsad92aa32015-08-31 02:27:443**NOTE:** SSL client authentication with personal certificates does not work
4completely in Linux, see [issue 16830](https://crbug.com/16830) and
5[issue 25241](https://crbug.com/25241).
andybons3322f762015-08-24 21:37:096
andybonsad92aa32015-08-31 02:27:447The easy way to manage certificates is navigate to chrome://settings/search#ssl.
8Then click on the "Manage Certificates" button. This will load a built-in
9interface for managing certificates.
andybons3322f762015-08-24 21:37:0910
andybonsad92aa32015-08-31 02:27:4411On Linux, Chromium uses the
12[NSS Shared DB](https://wiki.mozilla.org/NSS_Shared_DB_And_LINUX). If the
13built-in manager does not work for you then you can configure certificates with
14the
15[NSS command line tools](http://www.mozilla.org/projects/security/pki/nss/tools/).
andybons3322f762015-08-24 21:37:0916
andybonsad92aa32015-08-31 02:27:4417## Details
andybons3322f762015-08-24 21:37:0918
andybonsad92aa32015-08-31 02:27:4419### Get the tools
andybons3322f762015-08-24 21:37:0920
andybonsad92aa32015-08-31 02:27:4421* Debian/Ubuntu: `sudo apt-get install libnss3-tools`
22* Fedora: `su -c "yum install nss-tools"`
23* Gentoo: `su -c "echo 'dev-libs/nss utils' >> /etc/portage/package.use &&
24 emerge dev-libs/nss"` (You need to launch all commands below with the `nss`
25 prefix, e.g., `nsscertutil`.)
26* Opensuse: `sudo zypper install mozilla-nss-tools`
andybons3322f762015-08-24 21:37:0927
andybonsad92aa32015-08-31 02:27:4428### List all certificates
andybons3322f762015-08-24 21:37:0929
andybonsad92aa32015-08-31 02:27:4430 certutil -d sql:$HOME/.pki/nssdb -L
andybons3322f762015-08-24 21:37:0931
andybonsad92aa32015-08-31 02:27:4432#### Ubuntu Jaunty error
33
andybons3322f762015-08-24 21:37:0934Above (and most commands) gives:
35
andybonsad92aa32015-08-31 02:27:4436 certutil: function failed: security library: invalid arguments.
andybons3322f762015-08-24 21:37:0937
38Package version 3.12.3.1-0ubuntu0.9.04.2
39
andybonsad92aa32015-08-31 02:27:4440### List details of a certificate
andybons3322f762015-08-24 21:37:0941
andybonsad92aa32015-08-31 02:27:4442 certutil -d sql:$HOME/.pki/nssdb -L -n <certificate nickname>
andybons3322f762015-08-24 21:37:0943
andybonsad92aa32015-08-31 02:27:4444### Add a certificate
andybons3322f762015-08-24 21:37:0945
andybonsad92aa32015-08-31 02:27:4446```shell
47certutil -d sql:$HOME/.pki/nssdb -A -t <TRUSTARGS> -n <certificate nickname> \
48-i <certificate filename>
49```
andybons3322f762015-08-24 21:37:0950
andybonsad92aa32015-08-31 02:27:4451The TRUSTARGS are three strings of zero or more alphabetic characters, separated
52by commas. They define how the certificate should be trusted for SSL, email, and
53object signing, and are explained in the
54[certutil docs](http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html#1034193)
55or
56[Meena's blog post on trust flags](https://blogs.oracle.com/meena/entry/notes_about_trust_flags).
andybons3322f762015-08-24 21:37:0957
andybonsad92aa32015-08-31 02:27:4458For example, to trust a root CA certificate for issuing SSL server certificates,
59use
andybons3322f762015-08-24 21:37:0960
andybonsad92aa32015-08-31 02:27:4461```shell
62certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <certificate nickname> \
63-i <certificate filename>
64```
andybons3322f762015-08-24 21:37:0965
66To import an intermediate CA certificate, use
67
andybonsad92aa32015-08-31 02:27:4468```shell
69certutil -d sql:$HOME/.pki/nssdb -A -t ",," -n <certificate nickname> \
70-i <certificate filename>
71```
andybons3322f762015-08-24 21:37:0972
73Note: to trust a self-signed server certificate, we should use
74
andybonsad92aa32015-08-31 02:27:4475```
76certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n <certificate nickname> \
77-i <certificate filename>
78```
andybons3322f762015-08-24 21:37:0979
andybonsad92aa32015-08-31 02:27:4480This should work now, because
81[NSS bug 531160](https://bugzilla.mozilla.org/show_bug.cgi?id=531160) is claimed
82to be fixed in a related bug report. If it doesn't work, then to work around
83the NSS bug, you have to trust it as a CA using the "C,," trust flags.
andybons3322f762015-08-24 21:37:0984
andybonsad92aa32015-08-31 02:27:4485#### Add a personal certificate and private key for SSL client authentication
andybons3322f762015-08-24 21:37:0986
87Use the command:
88
andybonsad92aa32015-08-31 02:27:4489 pk12util -d sql:$HOME/.pki/nssdb -i PKCS12_file.p12
andybons3322f762015-08-24 21:37:0990
andybonsad92aa32015-08-31 02:27:4491to import a personal certificate and private key stored in a PKCS #12 file. The
92TRUSTARGS of the personal certificate will be set to "u,u,u".
andybons3322f762015-08-24 21:37:0993
andybonsad92aa32015-08-31 02:27:4494### Delete a certificate
andybons3322f762015-08-24 21:37:0995
andybonsad92aa32015-08-31 02:27:4496 certutil -d sql:$HOME/.pki/nssdb -D -n <certificate nickname>