openware / barong

Barong auth server
https://www.openware.com
Apache License 2.0
139 stars 262 forks source link

Ability to limit rate on login API #440

Closed mod closed 6 years ago

mod commented 6 years ago

Ability to limit rate on login API

A malicious user tries to brute-force the login form and login API using thousands of requests.

Implementation suggestion

Study the optional Capcha on login: https://github.com/rubykube/barong/issues/356

We can count Failed login attempts, and last fail login attempts time.

disregarding IP and cookies, this is a mysql based counter that will increment for each consecutive login failed, but reset on first successful login.

After 5 failed login attempts we will reject any login attempt during 10 minutes.

if after 10 minutes login was successful failed login attempted is reset.

rxqd commented 6 years ago

We need to add Rack::Attack middleware like peatio does. It has good configuration https://github.com/kickstarter/rack-attack/wiki/Advanced-Configuration

rxqd commented 6 years ago

I don't like captcha solution. We should use recaptcha on frontend and limit api calls by Rack Attack

mod commented 6 years ago

Agreed with you, please create an additional issue for adding Rack::Attack but I think we need both.

mod commented 6 years ago

why did you closed @calj

rxqd commented 6 years ago

@mod it was implemented at #467 and closed with that request. It's just devise lockable

rxqd commented 6 years ago

@mod Request with Rack Attack is here https://github.com/rubykube/barong/pull/468

rxqd commented 6 years ago

Implemented at 1.8.22