Fail2Ban is not adding iptables rulesFail2Ban on CentOS 6.5 Never Bansiptables questionFail2ban on Ubuntu 11.10 does not ban custom filter/jailfail2ban not working on fresh install of ubuntu 14.04, why?Fail2Ban on CentOS 6.5 Never BansFail2Ban emails not showing extracts from Apache logfilesConfigure Fail2ban for SSH and ldapfail2ban apache-badbots not blocking IPssh terminal keeps on disconnecting at random timesSecuring linux servers: iptables vs fail2banUnderstanding fail2ban mechanisms

MX records from second domain to point to first domain but email is not delivered like on first domain

How do I allocate more memory to an app on Sheepshaver running Mac OS 9?

As black, how should one respond to 4. Qe2 by white in the Russian Game, Damiano Variation?

Piano: quaver triplets in RH v dotted quaver and semiquaver in LH

Which "exotic salt" can lower water's freezing point by –70 °C?

Sci-fi/fantasy book - ships on steel runners skating across ice sheets

Is the book wrong about the Nyquist Sampling Criterion?

Determine if a grid contains another grid

How can a hefty sand storm happen in a thin atmosphere like Martian?

Has the Hulk always been able to talk?

Why did WWI include Japan?

Why would one crossvalidate the random state number?

How to properly store the current value of int variable into a token list?

In Futurama, how many beings has Leela slept with?

My first C++ game (snake console game)

Dirichlet series with a single zero

Why is my arithmetic with a long long int behaving this way?

Why does sound not move through a wall?

What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?

Why are oscilloscope input impedances so low?

Should I simplify my writing in a foreign country?

Dangerous workplace travelling

What is the closest airport to the center of the city it serves?

Would a small hole in a Faraday cage drastically reduce its effectiveness at blocking interference?



Fail2Ban is not adding iptables rules


Fail2Ban on CentOS 6.5 Never Bansiptables questionFail2ban on Ubuntu 11.10 does not ban custom filter/jailfail2ban not working on fresh install of ubuntu 14.04, why?Fail2Ban on CentOS 6.5 Never BansFail2Ban emails not showing extracts from Apache logfilesConfigure Fail2ban for SSH and ldapfail2ban apache-badbots not blocking IPssh terminal keeps on disconnecting at random timesSecuring linux servers: iptables vs fail2banUnderstanding fail2ban mechanisms






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








6















Fail2Ban is not adding iptables rules to block attackers. I'm running CentOS 6.5 (32 bit)



Here's what I did:



  • fail2ban was installed via yum using the EPEL repo.

  • I copied jail.conf to jail.local.


  • I changed the ban time in jail.local to be 3600



    bantime = 3600


For iptables I have these rules defined regarding SSH



Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED
3 fail2ban-SSH tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22


My jail.local config for SSH:



[ssh-iptables]

enabled = true
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
logpath = /var/log/secure
maxretry = 5


Latest log entries:



2014-08-13 10:11:04,481 fail2ban.server : INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.8.11
2014-08-13 10:11:04,482 fail2ban.jail : INFO Creating new jail 'ssh-iptables'
2014-08-13 10:11:04,514 fail2ban.jail : INFO Jail 'ssh-iptables' uses pyinotify
2014-08-13 10:11:04,533 fail2ban.jail : INFO Initiated 'pyinotify' backend
2014-08-13 10:11:04,536 fail2ban.filter : INFO Added logfile = /var/log/secure
2014-08-13 10:11:04,537 fail2ban.filter : INFO Set maxRetry = 5
2014-08-13 10:11:04,540 fail2ban.filter : INFO Set findtime = 600
2014-08-13 10:11:04,540 fail2ban.actions: INFO Set banTime = 3600
2014-08-13 10:11:04,727 fail2ban.jail : INFO Jail 'ssh-iptables' started


I then start fail2ban, yet after a while (an hour or so) I check /var/log/secure and I'm still getting brute force attacks:



Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79
Aug 13 10:31:35 webhost sshd[15620]: input_userauth_request: invalid user china
Aug 13 10:31:36 webhost sshd[15620]: Connection closed by 128.199.147.79
Aug 13 10:35:04 webhost sshd[15661]: Invalid user klaudia from 106.187.90.33
Aug 13 10:35:04 webhost sshd[15662]: input_userauth_request: invalid user klaudia
Aug 13 10:35:05 webhost sshd[15662]: Connection closed by 106.187.90.33
Aug 13 10:41:56 webhost sshd[15772]: Invalid user cassandra from 106.187.90.33
Aug 13 10:41:56 webhost sshd[15773]: input_userauth_request: invalid user cassandra
Aug 13 10:41:57 webhost sshd[15773]: Connection closed by 106.187.90.33
Aug 13 10:44:10 webhost sshd[15807]: Invalid user knight from 106.187.90.33
Aug 13 10:44:10 webhost sshd[15808]: input_userauth_request: invalid user knight
Aug 13 10:44:12 webhost sshd[15808]: Connection closed by 106.187.90.33


No new rules have been added to iptables...



Chain fail2ban-SSH (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0


If I try and debug the problem with fail2ban-regex:



fail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd.conf

Running tests

Use failregex file : /etc/fail2ban/filter.d/sshd.conf
Use log file : /var/log/secure

Results

Failregex: 1374 total
|- #) [# of hits] regular expression
| 5) [1374] ^s*(<[^.]+.[^.]+>)?s*(?:S+ )?(?:kernel: [d+.d+] )?(?:@vserver_S+ )?(?:(?:[d+])?:s+[[(]?sshd(?:(S+))?[])]?:?|[[(]?sshd(?:(S+))?[])]?:?(?:[d+])?:?)?s(?:[ID d+ S+])?s*[iI](?:llegal|nvalid) user .* from <HOST>s*$
`-

Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
| [4615] MONTH Day Hour:Minute:Second
`-

Lines: 4615 lines, 0 ignored, 1374 matched, 3241 missed
Missed line(s):: too many to print. Use --print-all-missed to print all 3241 lines
</code>

The missed lines are:

Lines: 4621 lines, 0 ignored, 1376 matched, 3245 missed
|- Missed line(s):
| Aug 10 03:46:30 webhost sshd[12340]: input_userauth_request: invalid user simulator
| Aug 10 03:46:30 webhost sshd[12340]: Connection closed by 106.187.90.33
| Aug 10 03:55:01 webhost sshd[12430]: input_userauth_request: invalid user simulation
| Aug 10 03:55:02 webhost sshd[12430]: Connection closed by 106.187.90.33
| Aug 10 04:01:33 webhost sshd[12505]: Connection closed by 128.199.147.79
| Aug 10 04:02:46 webhost sshd[12539]: reverse mapping checking getaddrinfo for new.jerl.im [128.199.254.179] failed - POSSIBLE BREAK-IN ATTEMPT!


I don't know enough about fail2ban to know what's wrong with my sshd filter. I would have thought the default config would have been enough? How do I fix this?










share|improve this question
























  • I think I'm having a similar experience here : serverfault.com/questions/632774/…

    – SteadH
    Oct 5 '14 at 14:32

















6















Fail2Ban is not adding iptables rules to block attackers. I'm running CentOS 6.5 (32 bit)



Here's what I did:



  • fail2ban was installed via yum using the EPEL repo.

  • I copied jail.conf to jail.local.


  • I changed the ban time in jail.local to be 3600



    bantime = 3600


For iptables I have these rules defined regarding SSH



Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED
3 fail2ban-SSH tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22


My jail.local config for SSH:



[ssh-iptables]

enabled = true
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
logpath = /var/log/secure
maxretry = 5


Latest log entries:



2014-08-13 10:11:04,481 fail2ban.server : INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.8.11
2014-08-13 10:11:04,482 fail2ban.jail : INFO Creating new jail 'ssh-iptables'
2014-08-13 10:11:04,514 fail2ban.jail : INFO Jail 'ssh-iptables' uses pyinotify
2014-08-13 10:11:04,533 fail2ban.jail : INFO Initiated 'pyinotify' backend
2014-08-13 10:11:04,536 fail2ban.filter : INFO Added logfile = /var/log/secure
2014-08-13 10:11:04,537 fail2ban.filter : INFO Set maxRetry = 5
2014-08-13 10:11:04,540 fail2ban.filter : INFO Set findtime = 600
2014-08-13 10:11:04,540 fail2ban.actions: INFO Set banTime = 3600
2014-08-13 10:11:04,727 fail2ban.jail : INFO Jail 'ssh-iptables' started


I then start fail2ban, yet after a while (an hour or so) I check /var/log/secure and I'm still getting brute force attacks:



Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79
Aug 13 10:31:35 webhost sshd[15620]: input_userauth_request: invalid user china
Aug 13 10:31:36 webhost sshd[15620]: Connection closed by 128.199.147.79
Aug 13 10:35:04 webhost sshd[15661]: Invalid user klaudia from 106.187.90.33
Aug 13 10:35:04 webhost sshd[15662]: input_userauth_request: invalid user klaudia
Aug 13 10:35:05 webhost sshd[15662]: Connection closed by 106.187.90.33
Aug 13 10:41:56 webhost sshd[15772]: Invalid user cassandra from 106.187.90.33
Aug 13 10:41:56 webhost sshd[15773]: input_userauth_request: invalid user cassandra
Aug 13 10:41:57 webhost sshd[15773]: Connection closed by 106.187.90.33
Aug 13 10:44:10 webhost sshd[15807]: Invalid user knight from 106.187.90.33
Aug 13 10:44:10 webhost sshd[15808]: input_userauth_request: invalid user knight
Aug 13 10:44:12 webhost sshd[15808]: Connection closed by 106.187.90.33


No new rules have been added to iptables...



Chain fail2ban-SSH (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0


If I try and debug the problem with fail2ban-regex:



fail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd.conf

Running tests

Use failregex file : /etc/fail2ban/filter.d/sshd.conf
Use log file : /var/log/secure

Results

Failregex: 1374 total
|- #) [# of hits] regular expression
| 5) [1374] ^s*(<[^.]+.[^.]+>)?s*(?:S+ )?(?:kernel: [d+.d+] )?(?:@vserver_S+ )?(?:(?:[d+])?:s+[[(]?sshd(?:(S+))?[])]?:?|[[(]?sshd(?:(S+))?[])]?:?(?:[d+])?:?)?s(?:[ID d+ S+])?s*[iI](?:llegal|nvalid) user .* from <HOST>s*$
`-

Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
| [4615] MONTH Day Hour:Minute:Second
`-

Lines: 4615 lines, 0 ignored, 1374 matched, 3241 missed
Missed line(s):: too many to print. Use --print-all-missed to print all 3241 lines
</code>

The missed lines are:

Lines: 4621 lines, 0 ignored, 1376 matched, 3245 missed
|- Missed line(s):
| Aug 10 03:46:30 webhost sshd[12340]: input_userauth_request: invalid user simulator
| Aug 10 03:46:30 webhost sshd[12340]: Connection closed by 106.187.90.33
| Aug 10 03:55:01 webhost sshd[12430]: input_userauth_request: invalid user simulation
| Aug 10 03:55:02 webhost sshd[12430]: Connection closed by 106.187.90.33
| Aug 10 04:01:33 webhost sshd[12505]: Connection closed by 128.199.147.79
| Aug 10 04:02:46 webhost sshd[12539]: reverse mapping checking getaddrinfo for new.jerl.im [128.199.254.179] failed - POSSIBLE BREAK-IN ATTEMPT!


I don't know enough about fail2ban to know what's wrong with my sshd filter. I would have thought the default config would have been enough? How do I fix this?










share|improve this question
























  • I think I'm having a similar experience here : serverfault.com/questions/632774/…

    – SteadH
    Oct 5 '14 at 14:32













6












6








6


2






Fail2Ban is not adding iptables rules to block attackers. I'm running CentOS 6.5 (32 bit)



Here's what I did:



  • fail2ban was installed via yum using the EPEL repo.

  • I copied jail.conf to jail.local.


  • I changed the ban time in jail.local to be 3600



    bantime = 3600


For iptables I have these rules defined regarding SSH



Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED
3 fail2ban-SSH tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22


My jail.local config for SSH:



[ssh-iptables]

enabled = true
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
logpath = /var/log/secure
maxretry = 5


Latest log entries:



2014-08-13 10:11:04,481 fail2ban.server : INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.8.11
2014-08-13 10:11:04,482 fail2ban.jail : INFO Creating new jail 'ssh-iptables'
2014-08-13 10:11:04,514 fail2ban.jail : INFO Jail 'ssh-iptables' uses pyinotify
2014-08-13 10:11:04,533 fail2ban.jail : INFO Initiated 'pyinotify' backend
2014-08-13 10:11:04,536 fail2ban.filter : INFO Added logfile = /var/log/secure
2014-08-13 10:11:04,537 fail2ban.filter : INFO Set maxRetry = 5
2014-08-13 10:11:04,540 fail2ban.filter : INFO Set findtime = 600
2014-08-13 10:11:04,540 fail2ban.actions: INFO Set banTime = 3600
2014-08-13 10:11:04,727 fail2ban.jail : INFO Jail 'ssh-iptables' started


I then start fail2ban, yet after a while (an hour or so) I check /var/log/secure and I'm still getting brute force attacks:



Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79
Aug 13 10:31:35 webhost sshd[15620]: input_userauth_request: invalid user china
Aug 13 10:31:36 webhost sshd[15620]: Connection closed by 128.199.147.79
Aug 13 10:35:04 webhost sshd[15661]: Invalid user klaudia from 106.187.90.33
Aug 13 10:35:04 webhost sshd[15662]: input_userauth_request: invalid user klaudia
Aug 13 10:35:05 webhost sshd[15662]: Connection closed by 106.187.90.33
Aug 13 10:41:56 webhost sshd[15772]: Invalid user cassandra from 106.187.90.33
Aug 13 10:41:56 webhost sshd[15773]: input_userauth_request: invalid user cassandra
Aug 13 10:41:57 webhost sshd[15773]: Connection closed by 106.187.90.33
Aug 13 10:44:10 webhost sshd[15807]: Invalid user knight from 106.187.90.33
Aug 13 10:44:10 webhost sshd[15808]: input_userauth_request: invalid user knight
Aug 13 10:44:12 webhost sshd[15808]: Connection closed by 106.187.90.33


No new rules have been added to iptables...



Chain fail2ban-SSH (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0


If I try and debug the problem with fail2ban-regex:



fail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd.conf

Running tests

Use failregex file : /etc/fail2ban/filter.d/sshd.conf
Use log file : /var/log/secure

Results

Failregex: 1374 total
|- #) [# of hits] regular expression
| 5) [1374] ^s*(<[^.]+.[^.]+>)?s*(?:S+ )?(?:kernel: [d+.d+] )?(?:@vserver_S+ )?(?:(?:[d+])?:s+[[(]?sshd(?:(S+))?[])]?:?|[[(]?sshd(?:(S+))?[])]?:?(?:[d+])?:?)?s(?:[ID d+ S+])?s*[iI](?:llegal|nvalid) user .* from <HOST>s*$
`-

Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
| [4615] MONTH Day Hour:Minute:Second
`-

Lines: 4615 lines, 0 ignored, 1374 matched, 3241 missed
Missed line(s):: too many to print. Use --print-all-missed to print all 3241 lines
</code>

The missed lines are:

Lines: 4621 lines, 0 ignored, 1376 matched, 3245 missed
|- Missed line(s):
| Aug 10 03:46:30 webhost sshd[12340]: input_userauth_request: invalid user simulator
| Aug 10 03:46:30 webhost sshd[12340]: Connection closed by 106.187.90.33
| Aug 10 03:55:01 webhost sshd[12430]: input_userauth_request: invalid user simulation
| Aug 10 03:55:02 webhost sshd[12430]: Connection closed by 106.187.90.33
| Aug 10 04:01:33 webhost sshd[12505]: Connection closed by 128.199.147.79
| Aug 10 04:02:46 webhost sshd[12539]: reverse mapping checking getaddrinfo for new.jerl.im [128.199.254.179] failed - POSSIBLE BREAK-IN ATTEMPT!


I don't know enough about fail2ban to know what's wrong with my sshd filter. I would have thought the default config would have been enough? How do I fix this?










share|improve this question
















Fail2Ban is not adding iptables rules to block attackers. I'm running CentOS 6.5 (32 bit)



Here's what I did:



  • fail2ban was installed via yum using the EPEL repo.

  • I copied jail.conf to jail.local.


  • I changed the ban time in jail.local to be 3600



    bantime = 3600


For iptables I have these rules defined regarding SSH



Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state ESTABLISHED
3 fail2ban-SSH tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22


My jail.local config for SSH:



[ssh-iptables]

enabled = true
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
logpath = /var/log/secure
maxretry = 5


Latest log entries:



2014-08-13 10:11:04,481 fail2ban.server : INFO Changed logging target to /var/log/fail2ban.log for Fail2ban v0.8.11
2014-08-13 10:11:04,482 fail2ban.jail : INFO Creating new jail 'ssh-iptables'
2014-08-13 10:11:04,514 fail2ban.jail : INFO Jail 'ssh-iptables' uses pyinotify
2014-08-13 10:11:04,533 fail2ban.jail : INFO Initiated 'pyinotify' backend
2014-08-13 10:11:04,536 fail2ban.filter : INFO Added logfile = /var/log/secure
2014-08-13 10:11:04,537 fail2ban.filter : INFO Set maxRetry = 5
2014-08-13 10:11:04,540 fail2ban.filter : INFO Set findtime = 600
2014-08-13 10:11:04,540 fail2ban.actions: INFO Set banTime = 3600
2014-08-13 10:11:04,727 fail2ban.jail : INFO Jail 'ssh-iptables' started


I then start fail2ban, yet after a while (an hour or so) I check /var/log/secure and I'm still getting brute force attacks:



Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79
Aug 13 10:31:35 webhost sshd[15620]: input_userauth_request: invalid user china
Aug 13 10:31:36 webhost sshd[15620]: Connection closed by 128.199.147.79
Aug 13 10:35:04 webhost sshd[15661]: Invalid user klaudia from 106.187.90.33
Aug 13 10:35:04 webhost sshd[15662]: input_userauth_request: invalid user klaudia
Aug 13 10:35:05 webhost sshd[15662]: Connection closed by 106.187.90.33
Aug 13 10:41:56 webhost sshd[15772]: Invalid user cassandra from 106.187.90.33
Aug 13 10:41:56 webhost sshd[15773]: input_userauth_request: invalid user cassandra
Aug 13 10:41:57 webhost sshd[15773]: Connection closed by 106.187.90.33
Aug 13 10:44:10 webhost sshd[15807]: Invalid user knight from 106.187.90.33
Aug 13 10:44:10 webhost sshd[15808]: input_userauth_request: invalid user knight
Aug 13 10:44:12 webhost sshd[15808]: Connection closed by 106.187.90.33


No new rules have been added to iptables...



Chain fail2ban-SSH (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0


If I try and debug the problem with fail2ban-regex:



fail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd.conf

Running tests

Use failregex file : /etc/fail2ban/filter.d/sshd.conf
Use log file : /var/log/secure

Results

Failregex: 1374 total
|- #) [# of hits] regular expression
| 5) [1374] ^s*(<[^.]+.[^.]+>)?s*(?:S+ )?(?:kernel: [d+.d+] )?(?:@vserver_S+ )?(?:(?:[d+])?:s+[[(]?sshd(?:(S+))?[])]?:?|[[(]?sshd(?:(S+))?[])]?:?(?:[d+])?:?)?s(?:[ID d+ S+])?s*[iI](?:llegal|nvalid) user .* from <HOST>s*$
`-

Ignoreregex: 0 total

Date template hits:
|- [# of hits] date format
| [4615] MONTH Day Hour:Minute:Second
`-

Lines: 4615 lines, 0 ignored, 1374 matched, 3241 missed
Missed line(s):: too many to print. Use --print-all-missed to print all 3241 lines
</code>

The missed lines are:

Lines: 4621 lines, 0 ignored, 1376 matched, 3245 missed
|- Missed line(s):
| Aug 10 03:46:30 webhost sshd[12340]: input_userauth_request: invalid user simulator
| Aug 10 03:46:30 webhost sshd[12340]: Connection closed by 106.187.90.33
| Aug 10 03:55:01 webhost sshd[12430]: input_userauth_request: invalid user simulation
| Aug 10 03:55:02 webhost sshd[12430]: Connection closed by 106.187.90.33
| Aug 10 04:01:33 webhost sshd[12505]: Connection closed by 128.199.147.79
| Aug 10 04:02:46 webhost sshd[12539]: reverse mapping checking getaddrinfo for new.jerl.im [128.199.254.179] failed - POSSIBLE BREAK-IN ATTEMPT!


I don't know enough about fail2ban to know what's wrong with my sshd filter. I would have thought the default config would have been enough? How do I fix this?







ssh fail2ban






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 21 '17 at 15:46









Eddie C.

403311




403311










asked Aug 13 '14 at 9:59









Aditya KAditya K

4262923




4262923












  • I think I'm having a similar experience here : serverfault.com/questions/632774/…

    – SteadH
    Oct 5 '14 at 14:32

















  • I think I'm having a similar experience here : serverfault.com/questions/632774/…

    – SteadH
    Oct 5 '14 at 14:32
















I think I'm having a similar experience here : serverfault.com/questions/632774/…

– SteadH
Oct 5 '14 at 14:32





I think I'm having a similar experience here : serverfault.com/questions/632774/…

– SteadH
Oct 5 '14 at 14:32










5 Answers
5






active

oldest

votes


















0














Check that you was enable IPTABLES jail and SSH filter. Also check f2b logs - is f2b trying to ban someone?






share|improve this answer























  • The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

    – Aditya K
    Aug 13 '14 at 10:40


















0














I don't know what log your using /var/log/secure or /var/log/auth.log but whatever one it is you need to tell fail2ban which one it should read from, also as mentioned if you have changed the default port for ssh(22) then again you need to tell fail2ban and open it in your firewall(iptables etc).
The regex IS working as intended, it IS matching the important lines in the log i.e



Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79


The others it has listed as missing are not important to fail2ban because they do not provided <HOST> or <IP> which fail2ban needs to enable banning of the client. So fail2ban is set up correctly for ssh so if all your definitions match your system set-up then it should be banning, remember you have to trigger the 'findtime' and 'maxretry' values to get banned. Don't forget to '$ fail2ban-client reload' after any changes.






share|improve this answer






























    0














    From my SysAdmin experience, please try systemdfor backend,
    and use banaction instead of action if you are using CentOS.



    For example,



    in your jail.local




    [DEFAULT]



    bantime = 4640000



    banaction = firewalld-custom



    backend = systemd




    let me know if this works.






    share|improve this answer






























      0














      When I ran across this problem it was because the "iptables" command was not working. I believe I could have fixed this by changing the line



      iptables = iptables <lockingopt>


      to



      iptables = /sbin/iptables <lockingopt>


      but, just to be on the safe side, and because I was only using iptables-allports.conf, I simply replaced all occurances of with /sbin/iptables in that file.






      share|improve this answer






























        0














        I noticed that if your jail name is too long, it wont be added to iptables.



        You can check that /var/log/fail2ban.log will contain a warning about the name being too long, and thus creating an error during iptables rule creation.



        This will allow fail2ban to detect and ban, however wont actually ban because the rule does not exists in the iptables config (iptables -v -x -n -L
        )






        share|improve this answer























          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f620091%2ffail2ban-is-not-adding-iptables-rules%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Check that you was enable IPTABLES jail and SSH filter. Also check f2b logs - is f2b trying to ban someone?






          share|improve this answer























          • The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

            – Aditya K
            Aug 13 '14 at 10:40















          0














          Check that you was enable IPTABLES jail and SSH filter. Also check f2b logs - is f2b trying to ban someone?






          share|improve this answer























          • The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

            – Aditya K
            Aug 13 '14 at 10:40













          0












          0








          0







          Check that you was enable IPTABLES jail and SSH filter. Also check f2b logs - is f2b trying to ban someone?






          share|improve this answer













          Check that you was enable IPTABLES jail and SSH filter. Also check f2b logs - is f2b trying to ban someone?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 13 '14 at 10:20









          Paul RudnitskiyPaul Rudnitskiy

          40324




          40324












          • The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

            – Aditya K
            Aug 13 '14 at 10:40

















          • The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

            – Aditya K
            Aug 13 '14 at 10:40
















          The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

          – Aditya K
          Aug 13 '14 at 10:40





          The jail is enabled, and no one is getting banned. It appears to be a filter problem, but I'm really not sure..

          – Aditya K
          Aug 13 '14 at 10:40













          0














          I don't know what log your using /var/log/secure or /var/log/auth.log but whatever one it is you need to tell fail2ban which one it should read from, also as mentioned if you have changed the default port for ssh(22) then again you need to tell fail2ban and open it in your firewall(iptables etc).
          The regex IS working as intended, it IS matching the important lines in the log i.e



          Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79


          The others it has listed as missing are not important to fail2ban because they do not provided <HOST> or <IP> which fail2ban needs to enable banning of the client. So fail2ban is set up correctly for ssh so if all your definitions match your system set-up then it should be banning, remember you have to trigger the 'findtime' and 'maxretry' values to get banned. Don't forget to '$ fail2ban-client reload' after any changes.






          share|improve this answer



























            0














            I don't know what log your using /var/log/secure or /var/log/auth.log but whatever one it is you need to tell fail2ban which one it should read from, also as mentioned if you have changed the default port for ssh(22) then again you need to tell fail2ban and open it in your firewall(iptables etc).
            The regex IS working as intended, it IS matching the important lines in the log i.e



            Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79


            The others it has listed as missing are not important to fail2ban because they do not provided <HOST> or <IP> which fail2ban needs to enable banning of the client. So fail2ban is set up correctly for ssh so if all your definitions match your system set-up then it should be banning, remember you have to trigger the 'findtime' and 'maxretry' values to get banned. Don't forget to '$ fail2ban-client reload' after any changes.






            share|improve this answer

























              0












              0








              0







              I don't know what log your using /var/log/secure or /var/log/auth.log but whatever one it is you need to tell fail2ban which one it should read from, also as mentioned if you have changed the default port for ssh(22) then again you need to tell fail2ban and open it in your firewall(iptables etc).
              The regex IS working as intended, it IS matching the important lines in the log i.e



              Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79


              The others it has listed as missing are not important to fail2ban because they do not provided <HOST> or <IP> which fail2ban needs to enable banning of the client. So fail2ban is set up correctly for ssh so if all your definitions match your system set-up then it should be banning, remember you have to trigger the 'findtime' and 'maxretry' values to get banned. Don't forget to '$ fail2ban-client reload' after any changes.






              share|improve this answer













              I don't know what log your using /var/log/secure or /var/log/auth.log but whatever one it is you need to tell fail2ban which one it should read from, also as mentioned if you have changed the default port for ssh(22) then again you need to tell fail2ban and open it in your firewall(iptables etc).
              The regex IS working as intended, it IS matching the important lines in the log i.e



              Aug 13 10:31:35 webhost sshd[15619]: Invalid user china from 128.199.147.79


              The others it has listed as missing are not important to fail2ban because they do not provided <HOST> or <IP> which fail2ban needs to enable banning of the client. So fail2ban is set up correctly for ssh so if all your definitions match your system set-up then it should be banning, remember you have to trigger the 'findtime' and 'maxretry' values to get banned. Don't forget to '$ fail2ban-client reload' after any changes.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 13 '14 at 17:27









              devatnulldevatnull

              965




              965





















                  0














                  From my SysAdmin experience, please try systemdfor backend,
                  and use banaction instead of action if you are using CentOS.



                  For example,



                  in your jail.local




                  [DEFAULT]



                  bantime = 4640000



                  banaction = firewalld-custom



                  backend = systemd




                  let me know if this works.






                  share|improve this answer



























                    0














                    From my SysAdmin experience, please try systemdfor backend,
                    and use banaction instead of action if you are using CentOS.



                    For example,



                    in your jail.local




                    [DEFAULT]



                    bantime = 4640000



                    banaction = firewalld-custom



                    backend = systemd




                    let me know if this works.






                    share|improve this answer

























                      0












                      0








                      0







                      From my SysAdmin experience, please try systemdfor backend,
                      and use banaction instead of action if you are using CentOS.



                      For example,



                      in your jail.local




                      [DEFAULT]



                      bantime = 4640000



                      banaction = firewalld-custom



                      backend = systemd




                      let me know if this works.






                      share|improve this answer













                      From my SysAdmin experience, please try systemdfor backend,
                      and use banaction instead of action if you are using CentOS.



                      For example,



                      in your jail.local




                      [DEFAULT]



                      bantime = 4640000



                      banaction = firewalld-custom



                      backend = systemd




                      let me know if this works.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 27 '15 at 9:44









                      MarkMark

                      4611410




                      4611410





















                          0














                          When I ran across this problem it was because the "iptables" command was not working. I believe I could have fixed this by changing the line



                          iptables = iptables <lockingopt>


                          to



                          iptables = /sbin/iptables <lockingopt>


                          but, just to be on the safe side, and because I was only using iptables-allports.conf, I simply replaced all occurances of with /sbin/iptables in that file.






                          share|improve this answer



























                            0














                            When I ran across this problem it was because the "iptables" command was not working. I believe I could have fixed this by changing the line



                            iptables = iptables <lockingopt>


                            to



                            iptables = /sbin/iptables <lockingopt>


                            but, just to be on the safe side, and because I was only using iptables-allports.conf, I simply replaced all occurances of with /sbin/iptables in that file.






                            share|improve this answer

























                              0












                              0








                              0







                              When I ran across this problem it was because the "iptables" command was not working. I believe I could have fixed this by changing the line



                              iptables = iptables <lockingopt>


                              to



                              iptables = /sbin/iptables <lockingopt>


                              but, just to be on the safe side, and because I was only using iptables-allports.conf, I simply replaced all occurances of with /sbin/iptables in that file.






                              share|improve this answer













                              When I ran across this problem it was because the "iptables" command was not working. I believe I could have fixed this by changing the line



                              iptables = iptables <lockingopt>


                              to



                              iptables = /sbin/iptables <lockingopt>


                              but, just to be on the safe side, and because I was only using iptables-allports.conf, I simply replaced all occurances of with /sbin/iptables in that file.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Apr 6 '17 at 1:07









                              davidgodavidgo

                              2,21711027




                              2,21711027





















                                  0














                                  I noticed that if your jail name is too long, it wont be added to iptables.



                                  You can check that /var/log/fail2ban.log will contain a warning about the name being too long, and thus creating an error during iptables rule creation.



                                  This will allow fail2ban to detect and ban, however wont actually ban because the rule does not exists in the iptables config (iptables -v -x -n -L
                                  )






                                  share|improve this answer



























                                    0














                                    I noticed that if your jail name is too long, it wont be added to iptables.



                                    You can check that /var/log/fail2ban.log will contain a warning about the name being too long, and thus creating an error during iptables rule creation.



                                    This will allow fail2ban to detect and ban, however wont actually ban because the rule does not exists in the iptables config (iptables -v -x -n -L
                                    )






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      I noticed that if your jail name is too long, it wont be added to iptables.



                                      You can check that /var/log/fail2ban.log will contain a warning about the name being too long, and thus creating an error during iptables rule creation.



                                      This will allow fail2ban to detect and ban, however wont actually ban because the rule does not exists in the iptables config (iptables -v -x -n -L
                                      )






                                      share|improve this answer













                                      I noticed that if your jail name is too long, it wont be added to iptables.



                                      You can check that /var/log/fail2ban.log will contain a warning about the name being too long, and thus creating an error during iptables rule creation.



                                      This will allow fail2ban to detect and ban, however wont actually ban because the rule does not exists in the iptables config (iptables -v -x -n -L
                                      )







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 24 at 11:43









                                      MiguelMiguel

                                      1113




                                      1113



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Server Fault!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f620091%2ffail2ban-is-not-adding-iptables-rules%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                                          Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                                          Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020