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

Add constraints on invalid password attempts #3573

Merged
merged 14 commits into from
Dec 30, 2021

Conversation

Aiee
Copy link
Contributor

@Aiee Aiee commented Dec 27, 2021

What type of PR is this?

  • bug
  • feature
  • enhancement

What does this PR do?

  1. Limit login attempts
  2. Block the account after a few consecutive login attempts provide an incorrect password

Which issue(s)/PR(s) this PR relates to?

Close #2442

Special notes for your reviewer, ex. impact of this fix, etc:

Introducing 2 new gflags:

  • failed_login_attempts
    how many consecutive incorrect passwords input to a SINGLE graph service node cause the account to become locked.

Please note that this flag is functioning on a SINGLE graph node, for example, if there are 3 graph nodes and each node has a failed_login_attempts set to 3, this allows a user to input an invalid password for a total of 9 times (3 times per node).

  • password_lock_time_in_secs
    how long to lock the account after too many consecutive login attempts provide an incorrect password

By default, both glags have a value of 0, which means there is no limitation on login attempts.
For now, these configs function on all users rather than bound to a specific user.

Additional context/ Design document:

Checklist:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the corresponding label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

                                                            `

@Aiee Aiee added ready-for-testing PR: ready for the CI test doc affected PR: improvements or additions to documentation wip Solution: work in progress labels Dec 27, 2021
@Aiee Aiee changed the title Add constants for invalid password attempts Add constraints on invalid password attempts Dec 27, 2021
src/clients/meta/MetaClient.cpp Outdated Show resolved Hide resolved
src/clients/meta/MetaClient.cpp Outdated Show resolved Hide resolved
@Aiee Aiee force-pushed the login_attempts branch 4 times, most recently from 97b9677 to d7f7080 Compare December 29, 2021 13:33
@Aiee Aiee added cherry-pick-v3.0 PR: need cherry-pick to this version and removed wip Solution: work in progress labels Dec 29, 2021
@Sophie-Xie Sophie-Xie removed the cherry-pick-v3.0 PR: need cherry-pick to this version label Dec 29, 2021
src/clients/meta/MetaClient.cpp Show resolved Hide resolved
Comment on lines 146 to 151
using UserPasswordMap = std::unordered_map<std::string, std::string>;
// Mapping of user name and remaining wrong password attempts
using UserPasswordAttemptsRemain = std::unordered_map<std::string, uint32>;
// Mapping of user name and the timestamp when the account is locked
using UserLoginLockTime = std::unordered_map<std::string, uint32>;

Copy link
Contributor

Choose a reason for hiding this comment

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

Could these 3 map be merged to one map?
eg.
std::unordered_map<std::string, PassInfo>.

Copy link
Contributor Author

@Aiee Aiee Dec 30, 2021

Choose a reason for hiding this comment

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

I've considered this, but UserPasswordMap is used in the localThreadCache as a read-only object, and the rest two objects require both read and write. I believe we could keep it like this for now.

jievince
jievince previously approved these changes Dec 30, 2021
Copy link
Contributor

@jievince jievince left a comment

Choose a reason for hiding this comment

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

LGTM

HarrisChu
HarrisChu previously approved these changes Dec 30, 2021
Copy link
Contributor

@HarrisChu HarrisChu left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc affected PR: improvements or additions to documentation ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When log in nebula, there is no mechanism to limit the number of retries for incorrect passwords
5 participants