I don't want by server to get brute forced but I don't want to use a CAPTCHA as they're not user friendly / I don't want to rely on another company - because I'm not going to implement my own captcha system.
I've thought of creating a attempts
table with this structure:
________________________________________________________________
| IP | ATTEMPTS | LOCK |
|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
| 1.1.1.1 | 0 | 2 |
| .... | .... | .... |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Yes I had fun making this
And let the user have 5-10 attempts, before resetting to 0 and increasing the lock time by a factor of 2 - it's in minutes.
Is this a good method to lock out a brute force?
I'd have logic like this on my server: - abstracted
....
* on request to server do below *
db.query("SELECT * FROM attempts WHERE IP= *REQUEST.IP* ",function(result){
if (result.rows.length > 0 && result.rows[0].attempts > 5) {
if (CheckIfExpired(results.rows[0].lock)) {
if (loginFail) MultplyLockBy2();
else RemoveFromAttemptsTable();
} else res.status("403").send("You're locked out");
} else normalLoginAttempt().ifFal(add1toAttempts());
....
I have a feeling there's a more efficient way to do this natively in SQL, I'm a novice with SQL. (I'm using postgresql).
After looking at this I'm guessing I'd need a start-time field aswell, so I can calculate when the lock has expired.
EDIT: after doing research I've read / am thinking about implementing fail2ban which check's Apache/nginx logs and blocks users; a cookie that allows a user to connect back into their account without Captcha / proof of work, and then make others get captcha; or just a captcha in conjunction with a lockout;
... ptcha how does it know who to catch if the person is changing their IP's consistently, do I apply it accross the account and give the user a special cookie that makes them bypass captcha always on their account? or atleast an extended threshold - this is what I was illuding to when i started talking about a cookie that allows a user to connect back into their account without Captcha / proof of work, and then make others get captcha ...