Skip to content

verify cluster name of TLS peer certificates#52128

Merged
r0mant merged 1 commit intomasterfrom
capnspacehook/oss-trusted-cluster-cert-verify
Feb 13, 2025
Merged

verify cluster name of TLS peer certificates#52128
r0mant merged 1 commit intomasterfrom
capnspacehook/oss-trusted-cluster-cert-verify

Conversation

@capnspacehook
Copy link
Copy Markdown
Contributor

OSS backport of https://github.com/gravitational/teleport-private/pull/1787.

This fixes https://github.com/gravitational/teleport-private/issues/1749 by verifying that the cluster name of a TLS peer cert matches the cluster name of the CA that issued it. Checks have been also added to ensure all locations in a CA where the cluster name is specified all match. These checks together ensure that CAs provided by trusted leaf clusters cannot sign a cert that will be accepted by the root as if it belongs to the root cluster.

You can't really get useful info of the certs in a *x509.CertPool, so I modified logic that builds client CA cert pools to return the information I need to do the additional checks alongside the cert pool itself. I lookup the CA cert that issued the client TLS cert by the cert's serial number, this means if CAs contain trusted certs that share serial numbers these checks could be bypassed. This shouldn't happen normally, I would think this would likely only happen if a malicious leaf cluster somehow knew the serial number of a root Host or User CA but didn't have the CA itself (or else better attacks could be done).

ClientCertPool was removed from middleware.go because it is an unused duplicate func likely left there by accident.

Tested by (on root and leaf clusters):

Connecting via tsh and the Web UI
Connecting to an App
Connecting to an SSH
Connecting to a database

changelog: verify that cluster name of TLS peer certs matches the cluster name of the CA that issued it to prevent Auth bypasses

@capnspacehook capnspacehook force-pushed the capnspacehook/oss-trusted-cluster-cert-verify branch from f6be23e to 702d1d0 Compare February 13, 2025 17:47
@capnspacehook capnspacehook force-pushed the capnspacehook/oss-trusted-cluster-cert-verify branch from 702d1d0 to 68e34ba Compare February 13, 2025 19:21
@r0mant r0mant added this pull request to the merge queue Feb 13, 2025
Merged via the queue into master with commit eecd072 Feb 13, 2025
@r0mant r0mant deleted the capnspacehook/oss-trusted-cluster-cert-verify branch February 13, 2025 21:46
carloscastrojumo pushed a commit to carloscastrojumo/teleport that referenced this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application-access database-access Database access related issues and PRs size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants