Skip to content

Conversation

vapopov
Copy link
Contributor

@vapopov vapopov commented Oct 14, 2025

In this PR, added a user agent to the client tools request header. During login, it is passed through the proxy to the auth service. Additionally, information about the public proxy address is included so it can be recorded in metrics.

The user_login_total counter now has two labels: proxy and user_agent.

  • The proxy label allows us to track which regions are used by customers during login.
  • The user_agent label helps identify the client tools version in use, to detect any affected versions in future, and monitor the progress of client tools managed updates.

Example:

# HELP user_login_total Number of times there was a user login
# TYPE user_login_total counter
user_login_total{proxy="proxy1:8443",user_agent="api/19.0.0-dev"} 1
user_login_total{proxy="proxy1:8443",user_agent="web/19.0.0-dev"} 2
user_login_total{proxy="proxy2:8443",user_agent="api/18.2.5"} 1
user_login_total{proxy="proxy2:8443",user_agent="api/19.0.0-dev"} 2
user_login_total{proxy="proxy2:8443",user_agent="web/19.0.0-dev"} 3

Related:

@tigrato
Copy link
Contributor

tigrato commented Oct 14, 2025

How can we ensure that an attacker doesn't break cloud monitoring by spamming tons of agents and causing Prometheus to fail? Are we going to drop them in cloud?

Copy link
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

Agree with Tiago, this seems like it could be a very high cardinality metric. cc @evanfreed.

github.com/gosuri/uitable v0.0.4 // indirect
github.com/gravitational/license v0.0.0-20250329001817-070456fa8ec1 // indirect
github.com/gravitational/roundtrip v1.0.2 // indirect
github.com/gravitational/roundtrip v1.0.3 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

I see a tag for this but not a GH release. Do you plan on creating a new release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I will draft release for this version

Copy link
Member

@sclevine sclevine left a comment

Choose a reason for hiding this comment

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

I think the concern about high cardinality on the user agent is worth addressing for scalability reasons, even if authenticated users could likely already cause trouble by connecting many agent versions (which we already record).

Could we parse the user agent for Teleport major version, and only accept reasonable values?

@vapopov
Copy link
Contributor Author

vapopov commented Oct 14, 2025

How can we ensure that an attacker doesn't break cloud monitoring by spamming tons of agents and causing Prometheus to fail? Are we going to drop them in cloud?

@tigrato in order to do that, you need a user from the cluster and must complete the login process. We would probably need to reset counters periodically as well

Replaced Sprintf with string concatenation
@vapopov vapopov force-pushed the vapopov/user-login-agent-proxy-tags-metric branch from cbec0d8 to 3cc147e Compare October 15, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants