8000 Added event for temporary lockout for brute force protector by tsaarni · Pull Request #26630 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Added event for temporary lockout for brute force protector - #26630

Merged
ahus1 merged 4 commits into
keycloak:mainfrom
Nordix:bruteforce-protector-events
Feb 7, 2024
Merged

ahus1 merged 4 commits into
keycloak:mainfrom
Nordix:bruteforce-protector-events

Conversation

@tsaarni
@tsaarni tsaarni commented Jan 31, 2024 •
Copy link
Copy Markdown
Contributor

This PR adds new event when user account is temporarily disabled by brute force protector. Before this change, and event was sent for only permanent lockout. Having event also for temporary lockout can improve visibility of ongoing brute force attack.

The PR also removes the free-text log for failed login attempts. This avoids having following printout in logs:

2024-01-31 10:51:41,466 WARN  [org.keycloak.services] (Brute Force Protector) KC-SERVICES0053: login failure for user 69563c18-7215-471c-b344-c7a0a8d49296 from ip 127.0.0.1

Reasoning for this change is that unconditionally printing user id and IP address in free-text logs for every invalid login may be seen as unnecessary logging of personally identifiable information. This can be also better served by event now that both permanent and temporary lockout are covered. In lockout event the presence of this information is justified and due to the structured format of events, is easier to process appropriately.

Fixes #26626

@tsaarni
tsaarni requested review from a team as code owners January 31, 2024 09:31
@tsaarni
tsaarni requested a review from a team January 31, 2024 09:31
@tsaarni
tsaarni requested a review from a team as a code owner January 31, 2024 09:31
@cypress
cypress Bot commented Jan 31, 2024 •
Copy link
Copy Markdown

Passing run #10949 ↗︎

0 554 54 0 Flakiness 0

Details:

Merge 7e61f51 into bcd423b...
Project: Keycloak Admin UI Commit: ff046301e1 ℹ️
Status: Passed Duration: 08:07 💡
Started: Feb 7, 2024 1:15 PM Ended: Feb 7, 2024 1:23 PM

Review all test suite changes for PR #26630 ↗︎

@tsaarni
tsaarni commented Jan 31, 2024 •
Copy link
Copy Markdown
Contributor Author

One observation regarding the default implementation JBossLoggingEventListenerProvider.java:

It converts "success" events to DEBUG level logs by default (code here). Since by default the log level is set to INFO, neither permanent or temporary lockout is visible if using jboss-logging event listener. User can change this by setting --spi-events-listener-jboss-logging-success-level or env KC_SPI_EVENTS_LISTENER_JBOSS_LOGGING_SUCCESS_LEVEL (doc here) to log level they wish to be used for the events, for example INFO. Obviously the configuration will have effect to all success events, not just brute force protector's events.

@ahus1 ahus1 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this change, I like the direction. See below for some comments that I'd like to see changed.

@ahus1
ahus1 commented Feb 1, 2024
Copy link
Copy Markdown
Member

@tsaarni - I've seen that you have merged the main branch into this PR. Within the Keycloak project, we usually prefer a rebase, as that allows for simpler squashing of commits later.

@tsaarni
tsaarni force-pushed the bruteforce-protector-events branch from 052b5dc to 50afa72 Compare February 1, 2024 11:00
@tsaarni
tsaarni commented Feb 1, 2024
Copy link
Copy Markdown
Contributor Author

@tsaarni - I've seen that you have merged the main branch into this PR. Within the Keycloak project, we usually prefer a rebase, as that allows for simpler squashing of commits later.

Sure! I've removed the merge commit, rebased and force pushed - also to re-trigger CI since there seemed to be some problems with Quarkus 3.7.0.CR1 that I think were unrelated.

jonkoops
jonkoops previously approved these changes Feb 1, 2024
This change adds event for brute force protector when user account is
temporarily disabled.

It also lowers the priority of free-text log for failed login attempts.

Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
pedroigor
pedroigor previously approved these changes Feb 7, 2024
@pedroigor pedroigor left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tsaarni Thanks for your time on it.

jonkoops
jonkoops previously approved these changes Feb 7, 2024
@ahus1
ahus1 commented Feb 7, 2024
Copy link
Copy Markdown
Member

I've submitted a PR with documentation changes to this PR for @tsaarni to review and merge: Nordix#235

Signed-off-by: Tero Saarni <tero.saarni@est.tech>
@tsaarni
tsaarni dismissed stale reviews from jonkoops and pedroigor via 7e61f51 February 7, 2024 13:06
@tsaarni
tsaarni commented Feb 7, 2024
Copy link
Copy Markdown
Contributor Author

I've submitted a PR with documentation changes to this PR for @tsaarni to review and merge: Nordix#235

Thanks @ahus1!

DCO check seems unhappy, maybe your commit should not have had my sign-off. Do you want it fixed?

@jonkoops
jonkoops commented Feb 7, 2024
Copy link
Copy Markdown
Contributor

I've set the DCO to pass, since @ahus1 is a member of the Keycloak team this should not be an issue.

@jonkoops
jonkoops requested review from ahus1 and pedroigor February 7, 2024 13:16
@ahus1
ahus1 enabled auto-merge (squash) February 7, 2024 13:53
@ahus1 ahus1 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving based on previous reviews of @pedroigor and the docs review by @tsaarni.

@ahus1
ahus1 merged commit ac1780a into keycloak:main Feb 7, 2024
cavuugroup pushed a commit to cavuugroup/keycloak that referenced this pull request Feb 8, 2024
…#26630)

This change adds event for brute force protector when user account is
temporarily disabled.

It also lowers the priority of free-text log for failed login attempts.

Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
Signed-off-by: Krzysztof Walczewski <kwalczewski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Brute force detection should issue event for temporary lockout

4 participants

0