summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-09-15 12:17:23 -0700
committerClaire McQuin <claire@getchef.com>2014-09-15 12:17:23 -0700
commit8fc145c9c9cc4682628862b0192638ade73b4e34 (patch)
tree80469525382ed9f147f84f41f04e3b6583e7b481
parentbf3e2dfceef3a5555dd5f9214940f4d30435ec43 (diff)
downloadchef-8fc145c9c9cc4682628862b0192638ade73b4e34.tar.gz
Troubleshooting tips for trusted certificate warnings.
-rw-r--r--DOC_CHANGES.md219
1 files changed, 172 insertions, 47 deletions
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index 8b0e5da24a..c6fe7087c3 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -146,14 +146,13 @@ $ knife search node "platform:ubuntu" --filter-result "c_version:languages.c.gcc
$
```
-### `knife ssl check` will verify X509 properties of your trusted certificates
+# `knife ssl check` will verify X509 properties of your trusted certificates
When you run `knife ssl check URL (options)` knife will verify if the certificate files, with extensions `*.crt` and `*.pem`
in your `:trusted_certs_dir` have valid X509 certificate properties. Knife will generate warnings for certificates that
do not meet X509 standards. OpenSSL **will not** use these certificates in verifying SSL connections.
-#### Troubleshooting
-
+## Troubleshooting
For each certificate that does not meet X509 specifications, a message will be displayed indicating why the certificate
failed to meet these specifications. You may see output similar to
@@ -168,77 +167,203 @@ The documentation for resolving common issues with certificates is a work in pro
are outlined in the following sections. If you would like to help expand this documentation, please
submit a pull request to [chef-docs](https://github.com/opscode/chef-docs) with your contribution.
-##### Fetch the certificate again
-
+### Fetch the certificate again
If the certificate was generated by your chef server, you may want to try downloading the certificate again.
By default, the certificate is stored in the following location on the host where your chef-server runs:
`/var/opt/chef-server/nginx/ca/SERVER_HOSTNAME.crt`. Copy that file into your `:trusted_certs_dir` using SSH,
SCP, or some other secure method and run `knife ssl check URL (options)` again.
-##### Generate a new certificate
+### Generate a new certificate
+If you control the trusted certificate and you suspect it is bad (e.g., you've fetched the certificate again,
+but you're still getting warnings about it from `knife ssl check`), you might try generating a new certificate.
+
+#### Generate a certificate signing request
+If you used a certificate authority (CA) to authenticate your certificate, you'll need to generate
+a certificate signing request (CSR) to fetch a new certificate.
+
+If you don't have one already, you'll need to create an openssl configuration file. This example
+configuration file is saved in our current working directory as openssl.cnf
-You will need a 1024 bit RSA key. You can generate one using the `openssl` cli tool:
```
-openssl genrsa -des3 -out privkey.key 1024
+#
+# OpenSSL configuration file
+# ./openssl.cnf
+#
+
+[ req ]
+default_bits = 1024 # Size of keys
+default_keyfile = key.pem # name of generated keys
+default_md = md5 # message digest algorithm
+string_mask = nombstr # permitted characters
+distinguished_name = req_distinguished_name
+req_extensions = v3_req
+
+[ req_distinguished_name ]
+# Variable name Prompt string
+#--------------------- ----------------------------------
+0.organizationName = Organization Name (company)
+organizationalUnitName = Organizational Unit Name (department, division)
+emailAddress = Email Address
+emailAddress_max = 40
+localityName = Locality Name (city, district)
+stateOrProvinceName = State or Province Name (full name)
+countryName = Country Name (2 letter code)
+countryName_min = 2
+countryName_max = 2
+commonName = Common Name (hostname, IP, or your name)
+commonName_max = 64
+
+# Default values for the above, for consistency and less typing.
+# Variable name Value
+#-------------------------- ------------------------------
+0.organizationName_default = My Company
+localityName_default = My Town
+stateOrProvinceName_default = State or Providence
+countryName_default = US
+
+[ v3_req ]
+basicConstraints = CA:FALSE # This is NOT a CA certificate
+subjectKeyIdentifier = hash
```
-You will be prompted for a passphrase for your new private key.
-Once you have private key, you can generate a Certificate Signing Request (CSR), which can either be sent to a
-Certificate Authority (CA) for verification, or be self-signed. You can generate a CSR with
+You can use `openssl` to create a certificate from an existing private key
+```
+$ openssl req -new -extensions v3_req -key KEYNAME.pem -out REQNAME.pem -config ./openssl.cnf
```
-openssl req -new -key privkey.key -out mycsr.csr
+or `openssl` can create a new private key simultaneously
```
-When you create a CSR, you will be prompted for
-information which is used to fill out the X509 attributes of the certificate. You will be asked to provide
-a two-letter [Country Name](https://www.digicert.com/ssl-certificate-country-codes.htm), and a Common Name
-which should be the FQDN of your server to be protected by SSL.
+$ openssl req -new -extensions v3_req -keyout KEYNAME.pem -out REQNAME.pem -config ./openssl.cnf
+```
+where `KEYNAME` is the path to your private key and `REQNAME` is the path to your CSR.
-(Optional) You may want to remove the passphrase from the key, otherwise you will be prompted to
-type in the passphrase after system reboot or crash. It is recommended that you make this key
-readable only by root once you remove the passphrase.
+You can verify your CSR was generated correctly
```
-cp privkey.key privkey.key.org
-openssl rsa -in privkey.key.org -out privkey.key
+$ openssl req -noout -text -in REQNAME.pem
```
-(Optional) You can generate a self-signed certificate if you don't plan on having your certificate
-signed by a CA, or as an interim certificate for testing while you wait for the CA to sign your
-certificate. You can create a temporary certificate good for 365 days with the command
+The final step is to submit your CSR to your certificate authority (CA) for signing.
+
+### Generate a self-signed (root) certificate
+You'll need to modify your openssl configuration file, or create a separate file, for
+generating root certificates.
+
```
-openssl x509 -req -days 365 -in mycsr.csr -signkey privkey.key -out mycert.crt
+#
+# OpenSSL configuration file
+# ./openssl.cnf
+#
+
+dir = .
+
+[ ca ]
+default_ca = CA_default
+
+[ CA_default ]
+serial = $dir/serial
+database = $dir/certindex.txt
+new_certs_dir = $dir/certs
+certificate = $dir/cacert.pem
+private_key = $dir/private/cakey.pem
+default_days = 365
+default_md = md5
+preserve = no
+email_in_dn = no
+nameopt = default_ca
+certopt = default_ca
+policy = policy_match
+
+[ policy_match ]
+countryName = match
+stateOrProvinceName = match
+organizationName = match
+organizationalUnitName = optional
+commonName = supplied
+emailAddress = optional
+
+[ v3_ca ]
+basicConstraints = CA:TRUE # This is a CA certificate
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid:always,issuer:always
```
-##### Generate a certificate with SubjectAltName
+You can now create a root certificate. If you have a private key you would like
+to use
+```
+$ openssl req -new -x509 -extensions v3_ca -key KEYNAME.pem -out CERTNAME.pem -config ./openssl.cnf
+```
+or `openssl` can create a new private key simultaneously
+```
+$ openssl req -new -x509 -extensions v3_ca -keyout KEYNAME.pem -out CERTNAME.pem -config ./openssl.cnf
+```
+where `KEYNAME` is the path to your private key and `REQNAME` is the path to your CSR.
-You will need an openssl configuration file which enables subject alternative names. This is usually
-saved in your system as `openssl.cnf`, but you can create and use an alternative configuration file
-if you find that easier. If you use an alternative configuration file, you will have to append the
-command line option `-config CONFIG_FILE` to the commands shown below.
+At this point, you should add the generated certificate to your trusted certificates as well as
+replace the old server certificate. Furthermore, you should regenerate any certificates that
+were signed by the previous root certificate.
-The `[req]` section of your configuration file tells openssl how to handle certificate requests (CSRs). There
-should be a line beginning with `req_extensions`. This section of your configuration file should look like
+For more information and an example on how to set up your server to generate certificates
+check out this post on [setting up OpenSSL to create certificates](http://www.flatmtn.com/article/setting-openssl-create-certificates).
+
+#### Signing certificates
+Use your root certificate to sign certificate requests sent to your server
```
-[req]
-distinguished_name = req_distinguished_name
-req_extensions = v3_req
+$ openssl ca -out CERTNAME.pem -config ./openssl.cnf -infiles REQNAME.pem
```
-`v3_req` tells openssl to include that section in CSRs. You should modify your `v3_req` section to include
-`subjectAltName`. Your configuration file may look something like
+This creates the certificate `CERTNAME.pem` generated from CSR `REQNAME.pem`. You
+should send `CERTNAME.pem` back to the client who generated the CSR.
+
+### Certificate attributes
+When creating certificates and certificate signing requests, you will be prompted for
+information via the command line. These are your certificate attributes.
+
+RDN | Name | Explanation | Examples
+:---: | :---: | --- | ---
+CN | Common Name | You server's FQDN, or YOUR_SERVER Certificate Authority if root certificate | mail.domain.com, *.domain.com, MyServer Certificate Authority
+OU | Organizational Unit | (Optional) Additional organization information. | mail server, R&D
+O | Organization | The exact name of your organization. Do not abbreviate. | DevOpsRUs Inc.
+L | Locality | The city where your organization is located | Seattle
+S | State or Province | The state or province where your organization is located. Do not abbreviate. | Washington
+C | Country Name | 2-letter ISO abbreviation for your country. | US
+ | Email Address | How you or another maintainer can be reached. | maintainers@devopsr.us
+
+If you examine the `policy_match` section in the openssl configuration file example from the section on generating
+self signed certificates, you'll see specifications that CSRs need to match the countryName, stateOrProvinceName,
+and the organizationName. CSRs whose CN, S, and O values do not match those of the root certificate will not be
+signed by that root certificate. You can modify these requirements as desired.
+
+### Key usage
+A keyUsage field can be added to your `v3_req` and `v3_ca` sections of your configuration file.
+Key usage extensions define the purpose of the public key contained in a certificate, limiting what
+it can and cannot be used for.
+
+Extension | Description
+--- | ---
+digitalSignature | Use when the public key is used with a digital signature mechanism to support security services other than non-repudiation, certificate signing, or CRL signing. A digital signature is often used for entity authentication and data origin authentication with integrity
+nonRepudiation | Use when the public key is used to verify digital signatures used to provide a non-repudiation service. Non-repudiation protects against the signing entity falsely denying some action (excluding certificate or CRL signing).
+keyEncipherment | Use when a certificate will be used with a protocol that encrypts keys.
+dataEncipherment | Use when the public key is used for encrypting user data, other than cryptographic keys.
+keyAgreement | Use when the sender and receiver of the public key need to derive the key without using encryption. This key can then can be used to encrypt messages between the sender and receiver. Key agreement is typically used with Diffie-Hellman ciphers.
+certificateSigning | Use when the subject public key is used to verify a signature on certificates. This extension can be used only in CA certificates.
+cRLSigning | Use when the subject public key is to verify a signature on revocation information, such as a CRL.
+encipherOnly | Use only when key agreement is also enabled. This enables the public key to be used only for enciphering data while performing key agreement.
+decipherOnly | Use only when key agreement is also enabled. This enables the public key to be used only for deciphering data while performing key agreement.
+[Source](http://www-01.ibm.com/support/knowledgecenter/SSKTMJ_8.0.1/com.ibm.help.domino.admin.doc/DOC/H_KEY_USAGE_EXTENSIONS_FOR_INTERNET_CERTIFICATES_1521_OVER.html)
+
+### Subject Alternative Names
+Subject alternative names (SANs) allow you to list host names to protect with a single certificate.
+To create a certificate using SANs, you'll need to add a `subjectAltName` field to your `v3_req` section
+in your openssl configuration file
+
```
[ v3_req ]
-# Extensions to add to a certificate request
-basicConstraints = CA:FALSE
-subjectAltName = @alt_names
+basicConstraints = CA:FALSE # This is NOT a CA certificate
+subjectKeyIdentifier = hash
+subjectAltName = @alt_names
[alt_names]
DNS.1 = kb.example.com
DNS.2 = helpdesk.example.org
DNS.3 = systems.example.net
-IP.1 = 192.168.1.1
-IP.2 = 192.168.69.14
+IP.1 = 192.168.1.1
+IP.2 = 192.168.69.14
```
-It is important to note that what gets entered here will appear on all CSRs generated from this point on. If you want to change
-the SANs you will have to manually edit this file again.
-
-Now you can follow the steps for generating a new certificate. Don't forget to append the `-config CONFIG_FILE` option
-if your configuration file is not the default `openssl.cnf`