SeeM Posted February 10, 2020 Report Share Posted February 10, 2020 Nie mogę zmusić fail2bana tdo banowania IPków. /var/log/fail2ban.log 2020-02-10 20:14:45,237 fail2ban.actions [152496]: WARNING [sshd] 218.92.0.210 already banned 2020-02-10 20:14:48,893 fail2ban.filter [152496]: INFO [sshd] Found 218.92.0.210 - 2020-02-10 20:14:48 2020-02-10 20:14:53,187 fail2ban.filter [152496]: INFO [sshd] Found 218.92.0.210 - 2020-02-10 20:14:52 2020-02-10 20:14:53,249 fail2ban.actions [152496]: WARNING [sshd] 218.92.0.210 already banned journalctl -u sshd (218.92.0.210 nadal radośnie próbuje) lut 10 20:22:07 vps627971.ovh.net sshd[153295]: Failed password for root from 218.92.0.210 port 50601 ssh2 /etc/fail2ban/jail.d/10-sshd.local [sshd] mode = aggressive enabled = true port = ssh #backend = systemd bantime = 33d maxretry = 2 Naprawdę nie mam pomysłu. W CentOS 7 to było dla mnie trochę prostsze, bo był tekstowy log /var/log/secure, który fail2ban mógł sobie czytać. Link to comment Share on other sites More sharing options...
Guest Posted February 10, 2020 Report Share Posted February 10, 2020 O ile chcesz pokazać to pokaż: fail2ban-client status sshd Sprawdź iptables czy fail2ban wstawił łańcuch, który odrzuca połączenia: iptables -nvL Link to comment Share on other sites More sharing options...
@sunrise Posted February 10, 2020 Report Share Posted February 10, 2020 Nie wiem jakiego systemu używasz, ale może trzeba dodać action = <tu odpowiednia akcja z katalogu /etc/fail2ban/action.d> np. jak używasz firewalld to firewallcmd-new, a jak iptables to iptables-new? 1 Link to comment Share on other sites More sharing options...
SeeM Posted February 10, 2020 Author Report Share Posted February 10, 2020 Dzięki. Nie ma problemu: # fail2ban-client status sshd Status for the jail: sshd |- Filter | |- Currently failed: 6 | |- Total failed: 1046 | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd `- Actions |- Currently banned: 9 |- Total banned: 36 `- Banned IP list: 218.92.0.210 222.186.175.154 82.51.126.70 80.178.115.146 93.55.209.46 222.186.175.167 49.88.112.62 222.186.173.183 121.229.6.166 W iptables nie ma łąńcucha fai2bana. Tak jakby brakowało mu parametru action i co z tego, że ma Banned IP list, skoro nic z nimi nie robi. Poszukam w tę stronę. Link to comment Share on other sites More sharing options...
Guest Posted February 10, 2020 Report Share Posted February 10, 2020 Być może o to chodzi: https://www.cyberciti.biz/faq/how-to-protect-ssh-with-fail2ban-on-centos-8/ . W pliku /etc/fail2ban/jail.local jest linia: # Call iptables to ban IP addressbanaction = iptables-multiport Albo tak jak pisał kolega sunrise - nazwy dostosowane do dystrybucji. Zrestartować usługi, poczekać na bota - sprawdzić logi journalctl -q -b -p 4 -g "IN=" Link to comment Share on other sites More sharing options...
SeeM Posted February 10, 2020 Author Report Share Posted February 10, 2020 Dzięki za naprowadzenie, chodziło o parametr action. .Łańcuch Chain f2b-sshd (1 references) świeci się pięknie w iptables. Jedyne, co mi się nie podoba to REJECTowanie tego ruchu. Wolałbym tym botom rozdawać DROPy, no ale mniejsza. Poszukam jutro jak to zrobić. Ważne, że się odczepiły. Link to comment Share on other sites More sharing options...
@sunrise Posted February 10, 2020 Report Share Posted February 10, 2020 16 minut temu, SeeM napisał: Tak jakby brakowało mu parametru action Sprawdź polecenie: fail2ban-client get sshd actions 1 Link to comment Share on other sites More sharing options...
SeeM Posted February 10, 2020 Author Report Share Posted February 10, 2020 Teraz, sunrise napisał: Sprawdź polecenie: fail2ban-client get sshd actions Już działa, ale dzięki. Może sobie nawet dodam wysyłanie maila po banowaniu IPka. Link to comment Share on other sites More sharing options...
SeeM Posted February 18, 2020 Author Report Share Posted February 18, 2020 W dniu 10.02.2020 o 21:01, SeeM napisał: Jedyne, co mi się nie podoba to REJECTowanie tego ruchu. Wolałbym tym botom rozdawać DROPy, no ale mniejsza. Poszukam jutro jak to zrobić. Ważne, że się odczepiły. Znalazłem. Plik /etc/fail2ban/iptables/action.d/iptables-common; # Option: blocktype # Note: This is what the action does with rules. This can be any jump target # as per the iptables man page (section 8). Common values are DROP # REJECT, REJECT --reject-with icmp-port-unreachable # Values: STRING #blocktype = REJECT --reject-with icmp-port-unreachable blocktype = DROP Od razu lepiej. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now