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

xpack.security.http.ssl.verification_mode is missing from the docs #85375

Closed
linghengqian opened this issue Mar 28, 2022 · 11 comments · Fixed by #93083
Closed

xpack.security.http.ssl.verification_mode is missing from the docs #85375

linghengqian opened this issue Mar 28, 2022 · 11 comments · Fixed by #93083
Labels
>docs General docs changes :Security/TLS SSL/TLS, Certificates Team:Docs Meta label for docs team Team:Security Meta label for security team

Comments

@linghengqian
Copy link

Description

@linghengqian linghengqian added >enhancement needs:triage Requires assignment of a team area label labels Mar 28, 2022
@tvernum tvernum added >docs General docs changes :Security/TLS SSL/TLS, Certificates and removed >enhancement needs:triage Requires assignment of a team area label labels Mar 28, 2022
@elasticmachine elasticmachine added Team:Docs Meta label for docs team Team:Security Meta label for security team labels Mar 28, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@tvernum
Copy link
Contributor

tvernum commented Mar 28, 2022

The fact that this isn't documented is intentional, because it shouldn't ever be set, and the fact that setup-passwords uses it is really a bug.
However, given we mention it in 1 part of the docs, and it is technically a valid setting (even if it shouldn't be used), we probably should document it (even if only to say that it is only useful for setup-passwords)

@linghengqian
Copy link
Author

The fact that this isn't documented is intentional, because it shouldn't ever be set, and the fact that setup-passwords uses it is really a bug. However, given we mention it in 1 part of the docs, and it is technically a valid setting (even if it shouldn't be used), we probably should document it (even if only to say that it is only useful for setup-passwords)

@lockewritesdocs
Copy link
Contributor

@tvernum, should we remove that setting from the example docker-compose.yml file? We can document it in the security settings, but if it shouldn't be set, then I think that it makes sense to remove it from the example.

@lockewritesdocs
Copy link
Contributor

@ywangd, can I get your input on this issue? Should we document xpack.security.http.ssl.verification_mode in the secure settings page and also remove it from the example docker-compose.yml file?

@ywangd
Copy link
Member

ywangd commented May 18, 2022

@lockewritesdocs Yes it can be removed from the docker-compose.yml. When ES running as a server, this setting is completely useless and should not be set at all. Unfortunately, the setup-passwords tool shares the same settings with the ES server but running in a client mode. So it is useful only in this particular use case. Maybe in the long term, we should separate the settings used by the server from those for CLI tools. But for now documenting it explicilty and removing it from server side setting are the way to go.

@tvernum
Copy link
Contributor

tvernum commented May 18, 2022

It turns out not to be just setup-passwords. It looks like reset-password has inherited the same behaviour.

I would propose that we migrate away from relying on verification mode, and instead start trusting the actual HTTP server cert instead.
CommandLineHttpClient.pinnedCaCertFingerprint already does something like that. We probably don't want to do exactly that (because there's no requirement that a node have a copy of its CA, so we may not know the fingerprint of the CA), but we could verify that the node provided the same cert that is configured in elasticsearch.yml

That would mean verification_mode is never needed anymore, and we can drop it everywhere, and simply document it as a "this is valid, but unncessary & discouraged".

@tvernum
Copy link
Contributor

tvernum commented May 31, 2022

I just realised this issue doesn't explain why that setting shouldn't be set. I've explained it elsewhere (possibly on other issues) but it's worth covering here since this has become the main issue for tracking the lack of docs.


verification_mode defines how to verify the certificates presented by the other party in the SSL/TLS connection.

For TLS clients there are 3 values, all of which have meaning, and can be useful (although one of them is particularly dangerous and should be used with extreme caution).

  • full verifies that the certificate is valid (e.g. it is within the not_before and not_after dates), chains to a trusted anchor (CA), and has a Subject Alternative Name (hostname) that matches the address to which the connection was intended
  • certificate checks validity & trust chain (CA) but does not check the hostname (Subject Alternative Name).
  • none checks nothing - neither validity, trust, or hostname. This is very dangerous, are ought to be avoided (but is occasionally necessary for debugging purposes, or to temporarily work around a transient issue such as expired certificates - but fixing the certificates is a much idea).

For TLS servers there is no such thing as hostname verification of the client's certificate. The server didn't open the connection so it doesn't have an address to check against. (Some servers do non-standard checks involving reverse DNS lookups, but that's not part of TLS or HTTPS).
So, when we are configuring TLS for a server, the full and certificate verification modes are identical. That means there are only 2 meaningful options - full and none.
However, client certificates are entirely optional in TLS. By default, they are not used, and in Elasticsearch you can set the client_authentication setting to none, optional or required.

Because of that, there's no case where setting verification mode to none makes sense.
If you configure:

xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.client_authentication: required
xpack.security.http.ssl.verification_mode: none

It means, Clients must provide a certificate, but I don't care what certificate it is. That's nonsense. Don't do that. If you don't care about the certs, don't require them.

If you configure:

xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.client_authentication: none
xpack.security.http.ssl.verification_mode: none

Then there are no certificates to verify (because client authentication is off), so the verification_mode is useless.

Given that xpack.security.http.ssl configures a server with configurable options for client_authentication, there is no need to have a configurable verification_mode.


The minor issue we have is that setup-passwords and reset-password configure their HTTPS client using the settings from xpack.security.http.ssl. That means that in this very specific case, xpack.security.http.ssl is used for both client and server settings. That was a bad idea, and we should fix it.

@justincr-elastic
Copy link
Contributor

justincr-elastic commented Jun 1, 2022

@tvernum thank you for the explanation. I have a followup question about mTLS to Elasticsearch.

In Kibana 8.3 documentation, it describes using a TLS client for Kibana authentication, and an Elasticsearch PKI realm for authorization. In other words, use role mapping from the Kibana TLS client's Subject DN to the kibana_system role.

In that scenario, the Kibana documention says to set xpack.security.http.ssl.client_authentication to optional. There is no mention of xpack.security.http.ssl.verification_mode, so I assume it would default to full.

What is design intent if xpack.security.http.ssl.verification_mode were changed to certificate? Is it design intent for full and certificate to behave the same way in that documented Kibana mTLS use case?

@tvernum
Copy link
Contributor

tvernum commented Jun 2, 2022

Is it design intent for full and certificate to behave the same way in that documented Kibana mTLS use case?

Kibana mTLS doesn't use client certificates between Kibana and ES (hence needing to set client_authentication to optional). So the value of verification_mode has no consequence to Kibana mTLS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Security/TLS SSL/TLS, Certificates Team:Docs Meta label for docs team Team:Security Meta label for security team
Projects
None yet
6 participants