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

Login attempts could repeat depending on SSLMode and leads to incorrect count of attempts #274

Closed
TianzeMYou opened this issue Apr 18, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@TianzeMYou
Copy link
Contributor

Description

For the lockout-after-a-specific-number-of-login-attempts example, login attempts could increment by 2 depending on SSLMode

https://www.postgresql.org/message-id/flat/17032-7ad69968e744de35%40postgresql.org#:~:text=It%20tries%20to%20connect%20with%20encryption%20and%20fails%2C%20then%20tries%20to%20connect%0Awithout%20encryption%20and%20also%20fails

Steps to reproduce

Run the example here with sslmode set to allow/prefer
https://github.com/aws/pg_tle/blob/main/examples/client_lockout/client_lockout--1.0.sql

Expected outcome

Client should be locked out after 5 attempts

Actual outcome

Client is locked out before 5 attempts

Analysis

Could potentially check the SSLMode in hook sql, which requires a C code change.
https://github.com/aws/pg_tle/blob/main/src/clientauth.c#L144-L166

@TianzeMYou TianzeMYou added the bug Something isn't working label Apr 18, 2024
@adamguo0
Copy link
Contributor

Since this is an expected and documented client-side behaviour [1], we shouldn't try to change this on the pg_tle side. However it's worth adding a note in the example for users to be aware.

[1] https://www.postgresql.org/docs/devel/libpq-connect.html#LIBPQ-CONNECT-SSLMODE

@adamguo0 adamguo0 added documentation Improvements or additions to documentation and removed bug Something isn't working labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants