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

Expose realms authentication metrics #104200

Conversation

slobodanadamovic
Copy link
Contributor

@slobodanadamovic slobodanadamovic commented Jan 10, 2024

This PR adds metrics for recording successful and failed
authentications for individual realms. Exposed metrics are:

  • es.security.authc.realms.success.total
  • es.security.authc.realms.failures.total
  • es.security.authc.realms.time

Each of the metric is exposed at node level and includes additional information with these attributes:

  • es.security.realm_type - can be one of: jwt, saml, oidc, active_directory, ldap, pki, kerberos...
  • es.security.realm_name
  • es.security.realm_authc_failure_reason

authentications for individual realms. Exposed metrics are:

- `es.security.authc.realms.success.total`
- `es.security.authc.realms.failures.total`
- `es.security.authc.realms.time`

Each of the metric is exposed at node level and includes
additional information with these attributes:

- `es.security.realm_type`
- `es.security.realm_name`
- `es.security.realm_authc_failure_reason`
@slobodanadamovic slobodanadamovic added >enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team labels Jan 10, 2024
@slobodanadamovic slobodanadamovic self-assigned this Jan 10, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @slobodanadamovic, I've created a changelog YAML for you.

"Authentication of [%s] was terminated by realm [%s] - %s",
realm.authenticate(
authenticationToken,
InstrumentedSecurityActionListener.wrapForAuthc(authenticationMetrics, realm, ActionListener.wrap(result -> {
Copy link
Contributor Author

@slobodanadamovic slobodanadamovic Jan 10, 2024

Choose a reason for hiding this comment

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

Wrapping a listener with InstrumentedSecurityActionListener.wrapForAuthc caused the formatting change which makes it hard to determine the actual diff, but this line is the only change.

…bodanadamovic/elasticsearch into sa-add-realms-authentication-metrics
…ealms-authentication-metrics

# Conflicts:
#	x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/metric/SecurityMetricType.java
@slobodanadamovic slobodanadamovic marked this pull request as ready for review January 11, 2024 00:33
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@jfreden jfreden left a comment

Choose a reason for hiding this comment

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

Great job! LGTM! 👍

@slobodanadamovic slobodanadamovic merged commit 0a21210 into elastic:main Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants