2023-03-28 19:12:30 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 19:12:30 +00:00
|
|
|
|
2018-12-19 08:22:49 +00:00
|
|
|
package cert
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/cli"
|
2023-01-30 17:26:56 +00:00
|
|
|
|
|
|
|
"github.com/hashicorp/consul/command/flags"
|
2018-12-19 08:22:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func New() *cmd {
|
|
|
|
return &cmd{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type cmd struct{}
|
|
|
|
|
|
|
|
func (c *cmd) Run(args []string) int {
|
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Synopsis() string {
|
|
|
|
return synopsis
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Help() string {
|
|
|
|
return flags.Usage(help, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
const synopsis = `Helpers for certificates`
|
|
|
|
const help = `
|
2023-01-30 17:26:56 +00:00
|
|
|
Usage: consul tls cert <subcommand> [options]
|
2018-12-19 08:22:49 +00:00
|
|
|
|
|
|
|
This command has subcommands for interacting with certificates
|
|
|
|
|
|
|
|
Here are some simple examples, and more detailed examples are available
|
|
|
|
in the subcommands or the documentation.
|
|
|
|
|
|
|
|
Create a certificate
|
|
|
|
|
|
|
|
$ consul tls cert create -server
|
2020-03-17 20:00:45 +00:00
|
|
|
==> saved dc1-server-consul.pem
|
|
|
|
==> saved dc1-server-consul-key.pem
|
2018-12-19 08:22:49 +00:00
|
|
|
|
|
|
|
Create a certificate with your own CA:
|
|
|
|
|
2021-12-17 20:00:21 +00:00
|
|
|
$ consul tls cert create -server -ca my-ca.pem -key my-ca-key.pem
|
2020-03-17 20:00:45 +00:00
|
|
|
==> saved dc1-server-consul.pem
|
|
|
|
==> saved dc1-server-consul-key.pem
|
2018-12-19 08:22:49 +00:00
|
|
|
|
|
|
|
For more examples, ask for subcommand help or view the documentation.
|
|
|
|
`
|