Dashboard UI "max try" login

Hi
Seems like UI Dashboard does not have a "max try" option for its login,. I have been trying to find a way to limit the login try on my UI Dashboard, but no success.
for example if I navigate to my UI address http://my_ip:my_port/ui, it prompts user/password dialog, and seems like it prompts you infinite times if you put the wrong user/password. how I can limit this number of try to 3 time lets say.

Thanks.

I use a nginx reverse proxy then fail2ban with a custom filter for 403 Forbidden
if you enter the wrong details for login node-red will send back 403 Forbidden

I'm not going to cover how to setup a nginx reverse proxy here or installing fail2ban but here is how I setup fail2ban for rejecting failed login attempts and other failed requests on the server.

Create a new fail2ban filter for 404, 444, 403, 400 responses from the server.

$ sudo nano /etc/fail2ban/filter.d/nginx-4xx.conf

add the following to the file

[Definition]
failregex = ^<HOST>.*"(GET|POST).*" (404|444|403|400) .*$
ignoreregex =

exit and save changes to file

CTRL+x

Now, edit your /etc/fail2ban/jail.conf, to use the new filter we created and ban after 3 failed attempts.

$ sudo nano /etc/fail2ban/jail.conf

add/edit the following in the file

[nginx-4xx]
enabled = true
port = http,https
logpath = %(nginx_access_log)s
maxretry = 3

exit and save changes to file

CTRL+x

restart fail2ban

$ sudo service fail2ban restart

check that the new rule is working

$ sudo fail2ban-client status nginx-4xx

now the user will be banned for the amount of time you have set in fail2ban after 3 failed attempts

you can check this is working with the logs.

$ sudo cat /var/log/fail2ban.log | grep Ban

and in nginx

$ sudo cat /var/log/nginx/access.log

Just checked in on the server as its been a few weeks.
fail to ban is working just fine.

Looks like @#@# from china got the msg that its not worth his time
https://www.abuseipdb.com/check/115.159.123.29

Just finished the whole guide if you need more information on fail2ban
https://discourse.nodered.org/t/node-red-server-with-nginx-reverse-proxy-howto-guide/27397

1 Like

Thank you for your reply, it adds too much complexity in my system as I am already using ngnix for other purpose. I prefer to remove the whole node-red and start learning Django, rather than dealing with such a complexity.

I would have thought that if you already use nginx that the effort of adding a node-red server and fail2ban to it would have been almost trivial.

@meeki007 nice write up, thanks for taking the time to document.
I'm sure other users will find it of interest.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.