Hello
I have a router with a public ip and l2tp and pptp vpn on it ( i know it is not secure , etc - will be upgrading soon )
I am facing a lot of failed authentications from unknown ip so i was thinking about fail2ban
Would anyone direct me ? is this a script ? is there any settings in the router for it cause i am not seeing it
Thank you
Not, sorry, I do help for free only on my spare time, and on other time I must help myself…
BUT
if you post on forum the results of /log print on terminal (removing useless lines) of wanted fail2ban log fail lines I can modify the script for you
06:01:07 pptp,info TCP connection established from 78.128.113.66
06:01:08 pptp,ppp,error <2856>: user mm authentication failed
06:10:24 pptp,info TCP connection established from 91.191.209.235
06:10:25 pptp,ppp,error <2857>: user guest authentication failed
06:20:43 pptp,info TCP connection established from 78.128.113.68
06:20:44 pptp,ppp,error <2858>: user test authentication failed
06:59:35 pptp,info TCP connection established from 91.191.209.236
06:59:36 pptp,ppp,error <2859>: user sd authentication failed
07:20:52 pptp,info TCP connection established from 91.191.209.235
07:20:53 pptp,ppp,error <2860>: user vpn authentication failed
07:20:59 pptp,info TCP connection established from 78.128.113.70
07:21:00 pptp,ppp,error <2861>: user admin authentication failed
08:01:08 pptp,info TCP connection established from 78.128.113.67
08:01:09 pptp,ppp,error <2862>: user zz authentication failed
08:11:23 pptp,info TCP connection established from 78.128.113.66
08:11:24 pptp,ppp,error <2863>: user asd authentication failed
08:50:00 pptp,info TCP connection established from 78.128.113.68
08:50:01 pptp,ppp,error <2864>: user qq authentication failed
09:13:21 pptp,info TCP connection established from 91.191.209.236
09:13:22 pptp,ppp,error <2865>: user 001 authentication failed
09:49:49 pptp,info TCP connection established from 78.128.113.70
09:49:49 pptp,ppp,error <2866>: user 8888 authentication failed
09:52:26 pptp,info TCP connection established from 91.191.209.234
09:52:27 pptp,ppp,error <2867>: user 333 authentication failed
09:53:14 pptp,info TCP connection established from 78.128.113.66
09:53:15 pptp,ppp,error <2868>: user 111 authentication failed
10:28:05 pptp,info TCP connection established from 91.191.209.235
10:28:05 pptp,ppp,error <2869>: user home authentication failed
10:31:21 pptp,info TCP connection established from 78.128.113.67
10:31:22 pptp,ppp,error <2870>: user aaa authentication failed
10:44:21 pptp,info TCP connection established from 185.76.176.192
11:31:40 pptp,info TCP connection established from 91.191.209.236
11:31:41 pptp,ppp,error <2877>: user vpn01 authentication failed
11:32:56 pptp,info TCP connection established from 78.128.113.66
11:32:57 pptp,ppp,error <2878>: user 123456 authentication failed
11:55:20 pptp,info TCP connection established from 91.191.209.235
11:55:21 pptp,ppp,error <2879>: user vpntest authentication failed
12:07:52 pptp,info TCP connection established from 78.128.113.67
12:07:53 pptp,ppp,error <2880>: user user1 authentication failed
12:37:35 pptp,info TCP connection established from 91.191.209.234
12:37:36 pptp,ppp,error <2881>: user 888 authentication failed
Is unadequate because the log I used for the script report on same line the IP and if failed or success.
examples:
SYSTEM: user admin logged in from 100.64.0.33 via winbox
login failure for user admin from 100.64.0.33 via winbox
on your log, is not on same line and probably must be enabled debug logging for see also if for example
pptp,ppp,error <2867>: user 333 authentication failed
what IP is used to establilish pptp connection with sessionid <2867>
The first step is to move SSH to another port. You wouldn’t believe how many of these bogus attempts this simple step will cut off, all by itself. Script kiddies and attack bots are lazy and stupid, respectively. They don’t try all possible ports for SSH; unless your threat model is “Mossad”, your attackers will only be trying port 22.
i was thinking about fail2ban
While it is possible to use fail2ban with RouterOS, it is far from trivial. You must first redirect your router logs to a host capable of running fail2ban, then script it to make calls back to the affected router to issue the block/unblock commands it’s based on.
I don’t know of anyone that has done that and packaged the solution for others to use in cookie-cutter fashion.
Therefore, the first question you should ask is, “Am I capable of being the one to do that work?”
yes, but is hard if inbetween another log is present something like (not true line)
09:52:26 pptp,info TCP connection established from 91.191.209.234
09:52:26 error winbox access denied
09:52:27 pptp,ppp,error <2867>: user 333 authentication failed
or like
09:52:26 pptp,info TCP connection established from 91.191.209.234
09:52:26 pptp,info TCP connection established from 77.191.92.24
09:52:27 pptp,ppp,error <2837>: user 333 authentication failed
09:52:27 pptp,ppp,error <2844>: user 666 authentication failed
or worst like
09:52:26 pptp,info TCP connection established from 91.191.209.234
09:52:26 pptp,info TCP connection established from 77.191.92.24
09:52:27 pptp,ppp,error <2812>: user rex successful authentication
09:52:27 pptp,ppp,error <2844>: user 666 authentication failed