2018-12-19 08:22:49 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: TLS Cert Create'
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: cert
|
2018-12-19 08:22:49 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul TLS Cert Create
|
|
|
|
|
|
|
|
Command: `consul tls cert create`
|
|
|
|
|
|
|
|
The `tls cert create` command is used to create certificates for your Consul TLS
|
|
|
|
setup.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Create a certificate for servers:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-12-19 08:22:49 +00:00
|
|
|
$ consul tls cert create -server
|
|
|
|
==> WARNING: Server Certificates grants authority to become a
|
|
|
|
server and access all state in the cluster including root keys
|
|
|
|
and all ACL tokens. Do not distribute them to production hosts
|
|
|
|
that are not server nodes. Store them as securely as CA keys.
|
|
|
|
==> Using consul-ca.pem and consul-ca-key.pem
|
2020-03-17 20:00:45 +00:00
|
|
|
==> Saved dc1-server-consul-0.pem
|
|
|
|
==> Saved dc1-server-consul-0-key.pem
|
2018-12-19 08:22:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Create a certificate for clients:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-12-19 08:22:49 +00:00
|
|
|
$ consul tls cert create -client
|
|
|
|
==> Using consul-ca.pem and consul-ca-key.pem
|
|
|
|
==> Saved consul-client-0.pem
|
|
|
|
==> Saved consul-client-0-key.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a certificate for cli:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-12-19 08:22:49 +00:00
|
|
|
$ consul tls cert create -cli
|
|
|
|
==> Using consul-ca.pem and consul-ca-key.pem
|
|
|
|
==> Saved consul-cli-0.pem
|
|
|
|
==> Saved consul-cli-0-key.pem
|
|
|
|
```
|
2020-04-07 18:55:19 +00:00
|
|
|
|
2018-12-19 08:22:49 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul tls cert create [filename-prefix] [options]`
|
|
|
|
|
|
|
|
#### TLS Cert Create Options
|
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-additional-dnsname=<string>` - Provide an additional dnsname for Subject
|
|
|
|
Alternative Names. localhost is always included. This flag may be provided
|
|
|
|
multiple times.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-additional-ipaddress=<string>` - Provide an additional ipaddress for
|
|
|
|
Subject Alternative Names. `127.0.0.1` is always included. This flag may be
|
|
|
|
provided multiple times.
|
2019-04-04 12:32:02 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-ca=<string>` - Provide path to the ca. Defaults to `#DOMAIN#-agent-ca.pem`.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-cli` - Generate cli certificate.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-client` - Generate client certificate.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-days=<int>` - Provide number of days the certificate is valid for from now
|
|
|
|
on. Defaults to 1 year.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-dc=<string>` - Provide the datacenter. Matters only for `-server`
|
|
|
|
certificates. Defaults to `dc1`.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-domain=<string>` - Provide the domain. Matters only for `-server`
|
|
|
|
certificates.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-key=<string>` - Provide path to the key. Defaults to
|
|
|
|
`#DOMAIN#-agent-ca-key.pem`.
|
2018-12-19 08:22:49 +00:00
|
|
|
|
2020-05-18 17:01:14 +00:00
|
|
|
- `-node=<string>` - When generating a server cert and this is set an
|
|
|
|
additional dns name is included of the form
|
|
|
|
`<node>.server.<datacenter>.<domain>`.
|
|
|
|
|
|
|
|
- `-server` - Generate server certificate.
|