Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Limit Number of Failed Login Attempts

Open richardwlu opened this issue 10 years ago • 45 comments

Your Rocket.Chat version: 0.24

Is there a way to limit the number of failed login attempts for a user account? How much security can be put into place from this end?

This should be helpful for those of us who run an instance that is available on the public internet.

richardwlu avatar Apr 01 '16 16:04 richardwlu

I believe there is already. 5 per second, but we can change it.

engelgabriel avatar Apr 01 '16 19:04 engelgabriel

That sounds good. Is there a way to also block based on IP?

richardwlu avatar Apr 01 '16 20:04 richardwlu

I forgot to mention, does it still apply for LDAP users?

richardwlu avatar Apr 01 '16 21:04 richardwlu

Applies to all method calls, so it still apply for LDAP users.

engelgabriel avatar Apr 01 '16 21:04 engelgabriel

And if there is a way to set how many attempts for how long til we lock it and possibly get a notification, that would be ideal.

richardwlu avatar Apr 01 '16 21:04 richardwlu

👍

I intended to secure it with fail2ban but I did not find where these failed login attempts are logged. I am using https://github.com/RocketChat/Deploy.to.Cloud/tree/master/GenericLinux to deploy, with this docker-compose.yml:

db:
  image: mongo
  volumes:
    - ./data/runtime/db:/data/db
    - ./data/dump:/dump
  command: mongod --smallfiles
web:
  image: rocketchat/rocket.chat
  environment:
    - MONGO_URL=mongodb://db:27017/meteor
    - ROOT_URL=https://rocket.domain.com
    - MAIL_URL=smtp://[email protected]:[email protected]:465
  links:
    - db:db
  volumes:
    - logs:/home/app/logs
  expose:
    - "3000"
  ports:
    - "3000:3000"

Anyway, 5 per second is a much too high limit for my needs (and it does not seem to work, maybe I missed something?).

pa-de-solminihac avatar Apr 25 '16 17:04 pa-de-solminihac

Hi I am also trying to reduce the chances of brute forcing our LDAP via Rocket Chat. Fail2Ban is useless until there is error reporting in the nginx log I cannot act upon the brute forcing.

Interestingly the api/login route will provide a 401 (HTTP/1.1 401 Unauthorized) response back and into the access log in nginx but normal users are not coming in via API calls.

Can you provide some timescales to add the standard user login fail 401 error output back to nginx? That would sort this problem out allowing me to use fail2ban.

p.s. fail2ban has worked to block /api/logon brute forcing :-) Thanks for your help.

Mark

ghost avatar Jul 11 '16 13:07 ghost

@mdearlove I am not sure how we would be able to do that. All the logins are done via a single open web-socket connection, so there is not 401. Maybe the only way would be to redirect the browser to a route that returns 401 so NGINX and pick that up. @rodrigok what do you think?

engelgabriel avatar Jul 11 '16 14:07 engelgabriel

@engelgabriel If the DDOS is scripted, redirect to another route probably will not work. Since the login requires a WebSocket connection, normal tools for DDOS does not work, so it's harder to do that on Rocket.Chat.

We can add the ability to ban IPs based on loggin or connection attempts.

rodrigok avatar Jul 12 '16 12:07 rodrigok

@rodrigok one alternative is to get Rocket.Chat it self to record on the logs the failed login attempt, so @mdearlove can configure fail2ban to monitor our logs too and this would make it work. Makes sense?

engelgabriel avatar Jul 12 '16 13:07 engelgabriel

@rodrigok @engelgabriel I believe that would be do-able from a fail2ban pov as it uses a regex to spot the machine behaviour to identify the issue. The log entry would also need to identify the source IP of the request so that fail2ban can take action.

ghost avatar Jul 12 '16 13:07 ghost

@rodrigogs wan we log failed login attempts with the IP? This would be very useful for everyone.

engelgabriel avatar Jul 12 '16 13:07 engelgabriel

@rodrigok @engelgabriel Hi guys Ive been away sunny my ar$e for several weeks :-). Have you made any progress on this issue? Thanks in advance.

ghost avatar Aug 11 '16 13:08 ghost

@engelgabriel i'm afraid you notified @rodrigogs instead of @rodrigok

BTW, I believe this is still a much needed improvement for security

pa-de-solminihac avatar Oct 18 '16 08:10 pa-de-solminihac

I agree with pa-de-solminihac that 5 per second is way too high. But regardless, @pa-de-solminihac you suggested earlier on this ticket that the block didn't seem to work. Is that still the case?

mddvul22 avatar Oct 25 '16 15:10 mddvul22

@engelgabriel @rodrigok would be great to have this feature enabled... so we can monitor the logs and use fail2ban.. any idea if it will be available any time soon? Thanks

juniorsemacento avatar Feb 06 '17 19:02 juniorsemacento

+1 Push

dmeier86 avatar Feb 24 '17 10:02 dmeier86

+1 Push

Marx1st avatar Jul 10 '17 19:07 Marx1st

+1

mrsimpson avatar Aug 18 '17 08:08 mrsimpson

Is the 5-attempts-per-second rule still aplying? If so, is it configurable? Gitlab, for example, offers a limit and period variables to be set, defaulting to 6 attempts per minute (source).

Adirio avatar Sep 01 '17 10:09 Adirio