hashicorp / hashicorp/consul

consul tls ca create ignores filename-prefix

Open
#7,196 1 comment 1 reaction 1 assignee Claimed by @hanshasselberg View on GitHub
theme/certificates type/docs
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

Hi Team,

I may just be interpreting the documentation incorrectly, apologies if that's the case.
The documentation for the `consul tls` helper function for creating consul pki certificates implies that a filename prefix can be added as follows:

` Usage: consul tls ca create [filename-prefix] [options]` [source](https://www.consul.io/docs/commands/tls/ca.html)

However when I try using a filename prefix of bananas, it's ignored:

``` bash
sudo /usr/local/bin/consul tls ca create bananas
==> Saved consul-agent-ca.pem
==> Saved consul-agent-ca-key.pem
```

Looking at the code it appears the the filename prefix is actually taken by reading the `-domain` flag [source](https://github.com/hashicorp/consul/blob/master/command/tls/ca/create/tls_ca_create.go#L53-54)

And by testing I get the desired result:

``` bash
sudo /usr/local/bin/consul tls ca create -domain=bananas
==> Saved bananas-agent-ca.pem
==> Saved bananas-agent-ca-key.pem
```

If the code is correct I think that it may be clearer to remove the ` [filename-prefix] ` from the usage examples and just update the options section for `-domain` to mention this is also used as the prefix for the generated files?

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.