Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [fail2ban]

Fail2ban scans log files like /var/log/pwdfail or /var/log/apache/error_log and bans IP that makes too many password failures. It updates firewall rules to reject the IP address.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
16 views

Fail2Ban deny pings after the 20th one Ubuntu Server 20.04

I need to do this for my school project but I can't find any info: Put a rule, if a user makes 20 pings, block that IP, for 1 day. I couldn't find any info on Google and ChatGPT didn't help neither I ...
Turboporro's user avatar
0 votes
1 answer
88 views

How to Create a Custom Action in Fail2Ban to Execute a Bash File for Printing a Banner [duplicate]

I'm using Fail2Ban to enhance the security of my server by automatically banning IP addresses that attempt to log in unsuccessfully multiple times. I'd like to go further by displaying a custom banner ...
prince royce's user avatar
0 votes
0 answers
29 views

ignoreregex not matching in fail2ban

I have a problem. I'm trying to catch 404 error with fail2ban and ignore images files. I had this in my filter file but it is not working: [Definition] ignoreregex = ^.* - - \[.*\] \"(GET|POST|...
dt dino's user avatar
  • 101
0 votes
0 answers
24 views

fail2ban iptables REJECT rules not working [duplicate]

I managed to setup fail2ban and monitor my mysql database logs because I am being brute force attacked through my database login. the database is in a docker container and fail2ban is on the host ...
SirHectorin's user avatar
0 votes
0 answers
25 views

Custom Fail2ban Regex not working

Using the regex filter below: [Definition] failregex = ^.*Priority: 0 ignoreregex = Fail2ban does not detect any of these log entries below. Mon Apr 1 21:11:29 2024 [] [1:1000002:1] SSH attempt [] ...
nexdev's user avatar
  • 1
0 votes
0 answers
22 views

Correct regex to block POST request and GET request to single file in apache?

What's the correct fail2ban regex to block these kind of requests? The excerpt is from apache access.log 181.204.83.115 - - [28/Mar/2024:17:38:47 +0200] "POST /login.php HTTP/1.1" 200 11593 ...
ServerMan's user avatar
1 vote
1 answer
165 views

fail2ban for dovecot not working

i have set up ufw in linux mint and works fine. in my linux mint box i run dovecot and i see many failure login tries. I set up fail2ban like this: [dovecot-pop3imap] enabled = true filter = dovecot-...
Athon's user avatar
  • 11
5 votes
3 answers
1k views

fail2ban bans IP addresses, yet they still appear in access.log

This is my filter: [Definition] failregex = <HOST> .* "POST /customer/account/create.*$ <HOST> .* "GET /customer/account/create.*$ and this the corresponding jail: [...
digijay's user avatar
  • 1,245
-1 votes
1 answer
95 views

fail2ban cannot block ip public, it works only for private ip

My server live behind the reverse proxy nginx, but the ip of the client access shows in the apache log like this, looks normal, there is no x-forward things in the log. 103.221.234.206 - - [28/Feb/...
Riska K A's user avatar
0 votes
1 answer
223 views

Trying to understand if fail2ban is working on Debian 10 VPS

I have a Debian 10 server running on a VPS. The only software I installed is: tinyproxy (http proxy) and fail2ban I have included the results of port scan using nmap I have included my specific ...
xstack's user avatar
  • 105
0 votes
1 answer
100 views

Fail2Ban RegEx works but filter does not

my plan is to ban all accesses to my webserver which repeatedly produce 404-errors and obviously do some scanning only For this I tried fail2ban-regex /var/log/apache2/otheraccess.log '^<HOST>. -...
Elmi's user avatar
  • 101
0 votes
2 answers
227 views

Fail2Ban: RegEx to filter all 404 errors out of the Apache-log

In my logs I regularly see loads of 404-errors where bots obviously do scan the server systematically for specific software installations. As this also causes loads of traffic, I want to ban them. So ...
Elmi's user avatar
  • 101
1 vote
0 answers
137 views

firewalld and iptables | fail2ban

I have fail2ban 1.0.2 running on an Almalinux server. Seems to be working as hoped, but I'm puzzled by something. have sshd.local and 00-firewalld.local in jail.d (installed fail2ban and fail2ban-...
Johnny Canuck's user avatar
0 votes
1 answer
321 views

fail2ban include list of ip addresses to ban

Suppose I have a .txt file containing a list of ip addresses I'd like to ban for some amount of time (so, a blacklist file of some sort). I know how do do this in Apache (for example) - simply by ...
Johnny Canuck's user avatar
1 vote
0 answers
39 views

iptables ignores REJECT in custom chain but works in the main chain

I configured a server with fail2ban for the smtp server. Now, fail2ban correctly bans the IPs and I can see them in the iptables chain of fail2ban. However, the kernel seems to ignore the iptables ...
ocirocir's user avatar
  • 113
0 votes
1 answer
181 views

fail2ban | difference between [sshd] in jail.local, vs sshd.local in jail.d?

AlmaLinux server -- 1.0.2 fail2ban installed. Seems to be working, but, am hoping someone can clarify something for me: 1\ working with jail.local copy of jail.conf. In said jail.local, there is a ...
Johnny Canuck's user avatar
0 votes
1 answer
86 views

Is firewalld needed by fail2ban?

When I install fail2ban, it also installs firewalld. After a reboot, firewalld also starts, enforcing settings on the iptables (dropping most connections accept ssh). This is frustrating as I want to ...
Thomas Stokes's user avatar
-1 votes
1 answer
84 views

fail2ban Jail starts but no connections are showed

I installed fail2ban on my Ubuntu server. It seems to starts fine: cat fail2ban.log 2023-12-07 14:55:27,758 fail2ban.server [803]: INFO -------------------------------------------------- ...
João Sacramento's user avatar
1 vote
1 answer
2k views

Issue with sshd logfile using fail2ban on minimal Ubuntu server 22.04

I am working on trying to get fail2ban set up and enabled for sshd on my VPS with Ionos. I am using a minimal Ubuntu 22.04 server install. fail2ban has installed fine, but getting it to run seems a ...
Sorin Orii's user avatar
1 vote
1 answer
118 views

fail2ban ignores <HOST> IP address and bans all incoming traffic

I'm trying to enable fail2ban on Centos 7 with Apache. I have an app which writes to the error log a specific string when login fails. responds with the right IP address in the Banned IP list, > ...
Ami Heines's user avatar
0 votes
0 answers
136 views

fail2ban jail is not respected

I'm completely new to fail2ban. I implemented a custom filter and a custom jail to ban some users from accessing my website which is hosted by apache. Fail2ban seems to recognize my regex fail rules ...
learningtech's user avatar
  • 7,509
0 votes
0 answers
63 views

fail2ban missed lines in my filter

I am completely new to using fail2ban. Right now I am getting a missed line error but I cannot figure out why. I have the following two files: // /etc/fail2ban/filter.d/apache-custom.conf [...
learningtech's user avatar
  • 7,509
-1 votes
1 answer
367 views

Crafting regex for Fail2ban and NGINX

I'm having some trouble understanding how to craft a regex to capture probe attempts on my nginx webserver. I would like to craft a filter to catch sites hitting certain files (by name) and/or by php ...
Thystra's user avatar
0 votes
0 answers
70 views

Fail2ban rule not working, nginx basic auth

I have a regexp like this that is used in my fail2ban jail ^ \[error\] \d+#\d+: \*\d+ user "\S+":? (password mismatch|was not found in ".*"), client: <HOST>, server: \S+, ...
sblantipodi's user avatar
0 votes
0 answers
344 views

How to correctly remove entries from firewalld ipset runtime?

Running Debian 12 I have created an IPSet in the following manner: ~$ firewall-cmd --permanent --new-ipset=myipset --type=hash:ip --option=timeout=0 success ~$ firewall-cmd --reload success ~$ ...
John David Ravenscroft's user avatar
0 votes
1 answer
115 views

Retrieve URL / Request in a fail2ban action with nginx

I have configured fail2ban to block spam attempts with nginx. everything works but I would like to be able to retrieve the url / domain visited in my actions. recovering the “logpath” also suits me ...
guillaumearnx's user avatar
0 votes
1 answer
149 views

Banning an IP address (or subnet) on Debian (still connecting after ufw and iptables)

I know the subject of banning IP addresses have been covered multiple times but for some reason I'm failing to address/identify this one. I am trying to identify a problem with random attacks of some ...
omega1's user avatar
  • 446
0 votes
1 answer
227 views

Unable to configure fail2ban to protect samba shares

With this configuration service (fail2ban) starts, logfile register wrong attempts, but still not count attempts in fail2ban-client. I suspect that there is a problem with regex, but this is the only ...
Ivan's user avatar
  • 1
0 votes
1 answer
157 views

Creating an IPTABLES chain, whose rules are ignored, unless the packet is from a certain port?

I want to confirm the following. If I create a chain whose first rule is: iptables -I INPUT -p tcp -m multiport --dports 25,465 -j name Does that mean that any further specified rules in the chain, ...
user1993015's user avatar
0 votes
1 answer
364 views

Fail2ban accepted the customized jail but it did not detect the event

this problem drives me crazy. I configured a jail to prevent excessive http post to my web server. Seems the fail2ban server accepts my new jail but nothing takes effective in the fail2ban server. ...
mzzhmh's user avatar
  • 1
0 votes
1 answer
97 views

iptables string matching feasability; possible use with fail2ban

We have several Apache 2.4 web servers behind a load balancer and CDN front end - where HTTPS is terminated - we see the client IP in headers from the front end in the back end Apache logs. I'm ...
Special Monkey's user avatar
0 votes
2 answers
424 views

fail2ban on host for rootless podman keycloak container

running on Rocky Linux 9.2 with podman 4.4.1. I got a podman Pod with keycloak + postgresql inside, running rootless. The pod itself with --network 'slirp4netns:port_handler=slirp4netns'. The keycloak ...
Leo's user avatar
  • 141
0 votes
1 answer
549 views

Fail2ban apache2 access log regex

Can anyone help me with fail2ban regex My goal is to ban any accessing .env or .php files or any request that starts with "wp-", it is a little bit confusing and another to detect invalid ...
Joukhar's user avatar
  • 103
0 votes
2 answers
328 views

Apache Log files Fail2ban and WordPress

I am trying to get Fail2ban to block brute force and persistent xmlrpc and wp-login attacks on a WordPress site. I have an issue with the apache logging filenames. Getting past selinux issues was ...
jon_the_eye's user avatar
0 votes
1 answer
97 views

fail2ban is working but not getting email to show that sshd-ddos is running

I have fail2ban running on my server and I have three programs running: sshd, sshd-ddos and runcloud-agent. There are no error messages but when I recently restarted my server, I got an email message ...
Gregory Schultz's user avatar
0 votes
1 answer
70 views

Does iptables apply all rules in order when an incoming connection is received?

I'm using iptables and fail2ban to secure server connections. Currently I have connections filtered via a router passing only ports for email and webserver access and fail2ban adding restrictions ...
Max's user avatar
  • 3
0 votes
2 answers
226 views

Unable to compile regular expression in Fail2Ban

I'm trying to get this regex working in Fail2Ban: SRC=(?<ADDR>.*) DST.*(?=DPT=5003) In a regex tester it's working very fine. When testing in Fail2Ban, I get this error: ERROR: Unable to ...
error401's user avatar
0 votes
1 answer
162 views

Using fail2ban to scan for SSH Accepted Connections and write the username to auth.log

I have a small server that authenticate users as root using their ssh-keys stored in authorized_keys file. I also run fail2ban. I made a convention to have a nickname written after the public_key of ...
meldirlobor's user avatar
0 votes
1 answer
280 views

linux fail2ban not catching auth a specific fail with postfix

I had journalctl open and noticed an offender repeatedly hitting me with auth fails in postfix. I have a standard postfix-sasl filter on by default that, to my knowledge, is working well. It wasn't ...
gstlouis's user avatar
  • 119
1 vote
1 answer
199 views

Fail2Ban - Match Asterisk PJSIP Successful Authentication

I'm trying to create a fail2ban filter that will match successful authentications. An example log entry looks like this: [2023-05-25 18:41:00] VERBOSE[26149] res_pjsip/pjsip_options.c: Contact user/...
Nick Coons's user avatar
0 votes
0 answers
80 views

Filtering Amazon servers by IP range AND URL

My server is often attacked by bots hosted on Amazon servers. So I configured iptables to block the largest ip ranges from Amazon. My problem is that let's encrypt use also Amazon servers to issue new ...
Fabrice Kimmel's user avatar
2 votes
1 answer
400 views

Fail2ban Auto Whitelist

We use fail2ban on a number of our servers for blocking brute-force attempts against services like SSH, SMTP, IMAP, SIP, etc, and it works very well. However, we get a lot of false positives under ...
Nick Coons's user avatar
0 votes
0 answers
552 views

fail2ban block plex failed login attempts

I want to ban IPs who attempt to authenticate against my public Plex instance. Im on Ubuntu and the log Im looking at is the following: /var/lib/plexmediaserver/Library/Application\ Support/Plex\ ...
Deac Karns's user avatar
1 vote
1 answer
741 views

fail2ban ssh not banning any IP

I started fail2ban service as sudo systemctl restart fail2ban.service, it successfully started. But my ssh attempts with the wrong password from remote PCs are not blocking, There is no IP listed in ...
zaheerk's user avatar
  • 11
0 votes
1 answer
617 views

fail2ban ipset proper setup of jail.conf

My understanding is that running Fail2ban using ipset is faster. To that end: I downloaded and installed per instructions (modified for Fedora 37) ritsu/ipset-fail2ban from Git. My banaction is still ...
WSpivak's user avatar
0 votes
1 answer
264 views

How to make an regex in Fail2ban with ip:port

First of all, English is not mu native language, so if I make a mistake don't shoot me. :) Here's my problem: when I use every thing works fine, as soon as there is a port number or a comma direct ...
Storm's user avatar
  • 1
1 vote
2 answers
1k views

Fail2ban ban action error on debian

I'm not sure where to start looking for the issue here This is on debian 11 (using nftables) It seems like the nft add set ... command is failing nft add set inet f2b-table addr-set-wordpress \{ type ...
Michael T's user avatar
  • 121
0 votes
1 answer
261 views

hardening fail2ban using systemd sandbox

I've been trying to follow the ArchWiki instructions on hardening Fail2Ban: https://wiki.archlinux.org/title/Fail2ban#Service_hardening Specifically I've created a drop-in file as described and ...
Sam Mason's user avatar
  • 193
0 votes
0 answers
85 views

fail2ban regex failing to work

I am trying to create a regex for my fail2ban filter to block all IPs that get a incorrect login on a web application. The way I distinguish this is that each login generates a GET request in the ...
ServerMan's user avatar
0 votes
0 answers
172 views

fail2ban inside official MariaDB docker image

I am running a docker image mariadb:10.9.2-jammy I noticed with that I get a lot of brute force logging attempts cluttering my logs when I do docker logs mariadb Is it possible to implement something ...
jotyhista's user avatar

1
2 3 4 5
15