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 support for transport TLS certificate other/common name suffix #5189

Merged
merged 5 commits into from
Jan 4, 2022

Conversation

pebrc
Copy link
Collaborator

@pebrc pebrc commented Dec 21, 2021

Fixes #5148

@botelastic botelastic bot added the triage label Dec 21, 2021
// CommonNameSuffix when defined will be prefixed with the Pod name and used as the common name,
// and the first DNSName as well an OtherName required by Elasticsearch in the Subject Alternative Name extension of
// each Elasticsearch node's transport TLS certificate.
CommonNameSuffix string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Naming: should this be called OtherNameSuffix because this is actually the relevant one (CommonName is only populated for legacy reasons)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think that makes sense to go with otherName 👍

if userConfiguredSuffix == "" {
return fmt.Sprintf("%s.node.%s.%s.es.local", pod.Name, es.Name, es.Namespace)
}
return fmt.Sprintf("%s.%s", pod.Name, userConfiguredSuffix)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do we want to handle user error here: e.g. .my.suffix vs my.suffix and try to do "the right thing"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm good question. I think it's best to not do any magic here (if you manipulate this field you probably know what you're doing).

Copy link
Contributor

Choose a reason for hiding this comment

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

I initially thought we would not even set the . in between by default.
But I don't know if there'd be any case where we wouldn't want a . there.

pkg/apis/elasticsearch/v1/elasticsearch_types.go Outdated Show resolved Hide resolved
if userConfiguredSuffix == "" {
return fmt.Sprintf("%s.node.%s.%s.es.local", pod.Name, es.Name, es.Namespace)
}
return fmt.Sprintf("%s.%s", pod.Name, userConfiguredSuffix)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm good question. I think it's best to not do any magic here (if you manipulate this field you probably know what you're doing).

// CommonNameSuffix when defined will be prefixed with the Pod name and used as the common name,
// and the first DNSName as well an OtherName required by Elasticsearch in the Subject Alternative Name extension of
// each Elasticsearch node's transport TLS certificate.
CommonNameSuffix string
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think that makes sense to go with otherName 👍

@pebrc pebrc added >enhancement Enhancement of existing functionality v2.0.0 labels Dec 21, 2021
@botelastic botelastic bot removed the triage label Dec 21, 2021
Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Sebastien Guilloux <contact.sebgl@gmail.com>
@pebrc pebrc marked this pull request as ready for review December 22, 2021 08:51
@pebrc pebrc merged commit d1a8109 into elastic:master Jan 4, 2022
naemono pushed a commit to naemono/cloud-on-k8s that referenced this pull request Jan 13, 2022
…lastic#5189)

Add a new option called otherNameSuffix to allow users to influence the name construction in the OtherName SAN extension of Elasticsearch node certificates for the transport layer. 

Co-authored-by: Sebastien Guilloux <contact.sebgl@gmail.com>
fantapsody pushed a commit to fantapsody/cloud-on-k8s that referenced this pull request Feb 7, 2023
…lastic#5189)

Add a new option called otherNameSuffix to allow users to influence the name construction in the OtherName SAN extension of Elasticsearch node certificates for the transport layer. 

Co-authored-by: Sebastien Guilloux <contact.sebgl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to provide the name pattern of Elasticsearch's transport certs commonName & otherName
2 participants