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 per-repository truststore #77081

Open
DaveCTurner opened this issue Aug 31, 2021 · 7 comments
Open

Add support for per-repository truststore #77081

DaveCTurner opened this issue Aug 31, 2021 · 7 comments
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.

Comments

@DaveCTurner
Copy link
Contributor

DaveCTurner commented Aug 31, 2021

If we communicate with a repository over TLS then today we use the default (JVM-wide) truststore to validate the certificate chain that the repository presents to prove its identity. In most of the other contexts that use TLS we typically let users specify which truststore to use in order to support very fine-grained control of the certificates that are trusted in each context. I think we should permit users to configure a per-repository (or maybe per-repo-client) trust store to give the same level of control over traffic to snapshot repositories

This is particularly thinking of S3-compatible repositories, I'm not sure we need this for most of the other implementations right now.

Relates https://discuss.elastic.co/t/configure-certificate-for-repository-s3-with-ceph/282645


Workaround: Note that the JVM-wide truststore is under the user's control so for now they can work around this missing feature by adding a certificate for their own custom CAs there.

@DaveCTurner DaveCTurner added >enhancement :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs labels Aug 31, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Aug 31, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@tvernum
Copy link
Contributor

tvernum commented Sep 1, 2021

@DaveCTurner, do you have an idea of how this should look in configuration?

Would it simply be a matter of adding support for s3.client.{client-name}.ssl.* settings in elasticsearch.yml / elasticsearch.keystore (as appropriate for the setting type)?

@DaveCTurner
Copy link
Contributor Author

Yes that's what I'd envisioned. The various SDKs typically don't let you get access to the low-level details of the connection so we can only really customise things to the extend that the API permits it. For instance the S3 SDK lets us pass in a FileStoreTlsKeyManagersProvider that I believe does what we want, except it looks like it only supports single-file stores (i.e. it won't support a trust store that comprises a directory of PEM files).

@tvernum
Copy link
Contributor

tvernum commented Sep 1, 2021

It's been a couple of years since I looked, but last time I investigated this, it looked like we might be able to add something like this to S3Service.buildConfiguration

SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier)
clientConfiguration.getApacheHttpClientConfig().setSslSocketFactory(socketFactory);

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes elastic#65034
Relates elastic#77081

Co-authored-by: Joost De Cock <[email protected]>
elasticsearchmachine pushed a commit that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes #65034
Relates #77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes elastic#65034
Relates elastic#77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes elastic#65034
Relates elastic#77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes elastic#65034
Relates elastic#77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
elasticsearchmachine pushed a commit that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes #65034
Relates #77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
elasticsearchmachine pushed a commit that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes #65034
Relates #77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
elasticsearchmachine pushed a commit that referenced this issue Sep 14, 2021
Today it's not clear how to tell Elasticsearch to trust an S3-compatible
repository that presents a certificate issued by a private or
nonstandard CA. This commit expands the docs to say how.

Supersedes #65034
Relates #77081

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>

Co-authored-by: Joost De Cock <[email protected]>
@ebuildy
Copy link
Contributor

ebuildy commented Feb 16, 2022

What about a global setting to configure all TLS CA on 1 shot? (inter node security, any web hook, snapshot etc...)

@tvernum
Copy link
Contributor

tvernum commented Feb 17, 2022

What about a global setting to configure all TLS CA on 1 shot? (inter node security, any web hook, snapshot etc...)

We used to have that (though not for snapshots). We removed it because it caused more problems than it solved.

It is rarely the case that you actually want one CA for all of those different contexts. The CA you trust for internode security should be different than the CA you trust for webhooks. Attempting to configure them together is almost always a mistake.

We can continue this conversation on the forums: https://discuss.elastic.co/t/set-a-global-tls-ca-for-security-snapshot-reindex-etc/297389

@willem-dhaese
Copy link

Any news on this? We need to add our ca certs to /usr/share/elasticsearch/jdk/lib/security/cacerts after every upgrade... We were told by support that this issue would solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination.
Projects
None yet
Development

No branches or pull requests

5 participants