Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to customise the details of the CA #17309

Merged
merged 8 commits into from
Jul 11, 2023

Conversation

lhaig
Copy link
Contributor

@lhaig lhaig commented May 25, 2023

Allow operators to customise the CA created using nomad tls ca create

@lhaig lhaig marked this pull request as draft May 25, 2023 05:34
@lhaig lhaig marked this pull request as ready for review May 25, 2023 07:26
@lhaig lhaig requested review from tgross and jrasell and removed request for tgross and jrasell May 25, 2023 07:27
.changelog/17309.txt Outdated Show resolved Hide resolved
Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some initial comments inline along with an internal note about a change I believe is required for this to work. It would also be nice if new tests used must rather than require, so we continue moving towards this library.

command/tls_ca_create.go Show resolved Hide resolved
command/tls_ca_create.go Outdated Show resolved Hide resolved
helper/tlsutil/generate.go Outdated Show resolved Hide resolved
Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @lhaig; I left some comments inline, mostly stylistic ones and some areas we could reduce the amount of code.

I feel we could make some changes to the validation logic as well after testing this locally. I would expect to be able to modify only the organizational-unit for example, however, when running this I get an error:

./pkg/darwin_arm64/nomad tls ca create --organizational-unit="nomad engineering"
please provide the -common-name flag when customizing the CA

I therefore think we need some type of merge function, which merges default values onto a potentially partially populated opts struct.

helper/tlsutil/generate.go Outdated Show resolved Hide resolved
helper/tlsutil/generate.go Outdated Show resolved Hide resolved
helper/tlsutil/generate.go Outdated Show resolved Hide resolved
Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some inline comments. It would probably also be nice to expand on the command description, given that defaults don't take effect if you modify certain parameters.

command/tls_ca_create.go Outdated Show resolved Hide resolved
command/tls_ca_create.go Outdated Show resolved Hide resolved
helper/tlsutil/generate.go Outdated Show resolved Hide resolved
helper/tlsutil/generate.go Outdated Show resolved Hide resolved
command/tls_ca_create.go Outdated Show resolved Hide resolved
lhaig and others added 8 commits June 23, 2023 16:15
Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks so much @lhaig!

@jrasell jrasell merged commit 1541358 into main Jul 11, 2023
@jrasell jrasell deleted the f-command-tls-ca-update branch July 11, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants