-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
tsh does not set the correct SNI when talking to auth server #3870
Milestone
Comments
awly
pushed a commit
that referenced
this issue
Jun 23, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
awly
pushed a commit
that referenced
this issue
Jun 26, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
awly
pushed a commit
that referenced
this issue
Jun 29, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
awly
pushed a commit
that referenced
this issue
Jun 29, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
awly
pushed a commit
that referenced
this issue
Jun 29, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
This was referenced Jun 29, 2020
awly
pushed a commit
that referenced
this issue
Jun 29, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
awly
pushed a commit
that referenced
this issue
Jun 30, 2020
SNI is used to indicate which cluster's CA to use for client cert validation. If SNI is not sent, or set as "teleport.cluster.local" (which is default in the client config), auth server will attempt to validate against all known CAs. The list of CA subjects is sent to the client during handshake, before client sends its own client cert. If this list is too long, handshake will fail. The limit is 65535 bytes, because TLS wire encoding uses 2 bytes for a length prefix. In teleport, this fits ~520-540 trusted cluster CAs. To avoid handshake failures on such large setups, all clients must send the correct SNI. In some future version, we should enforce this to catch such issues early. For now, added a debug log to report clients using the default ServerName. Also added a check for large number of CAs, to print a helpful error. Updates #3870
This is fixed in 4.3 (still alpha) and 4.2.11 (releasing a bit later today). |
10 tasks
awly
pushed a commit
that referenced
this issue
Apr 20, 2021
Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
Apr 29, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 3, 2021
… (#6666) * kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 5, 2021
… (#6668) * kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 5, 2021
… (#6670) * kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 5, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 5, 2021
… (#6667) * kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
awly
pushed a commit
that referenced
this issue
May 5, 2021
* kube: handle large number of trusted clusters in mTLS handshake Same as #3870 but for k8s endpoints. There is a hard limit on how many CAs we can put into a client CertPool, usually several hundred (depending on Subject length). The solution here is to fall back to only using the current cluster's CA for validation if the limit is reached. This is almost always the case in root clusters. There, the client certificate will be signed by the root cluster and validation will pass. In the unlikely case that you have a leaf cluster which in turn has hundreds of trusted leaf clusters itself, the validation will fail. The client cert will still be signed by the root cluster (not the leaf). However, that's better than a panic. And I'm not aware of any real setups like that. Also in this PR, add the wildcard `*.teleport.cluster.local` SAN to proxy and k8s TLS certificates, which was missing before. This SAN is used for clients to encode the cluster name and pass it in SNI. The client (kubectl) is not updated to set this SNI yet, it would break existing clusters without the SAN change. * add SNI tests for k8s Test that mTLS works with large numbers of CAs.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Description
What happened:
Auth server uses SNI to match a client to the correct TLS CA for validation.
Client may have certs issued by a trusted cluster, so auth server can't always validate against its own CA.
If SNI match fails (it's empty or the format isn't correct), auth server validates client against all known CAs. The list of CA Subjects is sent during TLS handshake. The size of this list (in bytes) can't exceed
MaxUint16
, due to encoding defined in https://tools.ietf.org/html/rfc5246#section-7.4.4.So, if client doesn't send the correct SNI and auth server has many trusted clusters, TLS handshake will fail.
What you expected to happen:
Client sends the correct SNI for the cluster that issued its client cert.
Auth server never falls back to sending all CAs in TLS handshake.
How to reproduce it (as minimally and precisely as possible):
Create an auth server with ~550 trusted clusters.
Run
tsh login
against the root cluster.Relevant Debug Logs If Applicable
The text was updated successfully, but these errors were encountered: