Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail2ban does not work on Centos 7 #150

Open
spawnzao opened this issue May 12, 2020 · 0 comments
Open

Fail2ban does not work on Centos 7 #150

spawnzao opened this issue May 12, 2020 · 0 comments

Comments

@spawnzao
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.12
  • Ruby:
  • Distribution: CentOS Linux release 7.7.1908 (Core)
  • Module version: 3.2.0
  • Fail2ban version: 0.10.5

How to reproduce (e.g Puppet code you use)

class { 'fail2ban':
    config_dir_purge     => false,
    email                => "it@localdomain.local",
    action               => "action_mwl",
    bantime              => 600,
    maxretry             => 5,
    whitelist            => ['127.0.0.1/8','192.168.0.0/24'],
    jails                => ['recidive','ssh','ssh-ddos','apache-auth','apache-badbots','apache-noscript','apache-overflows','apache-nohome','apache-botsearch','apache-fakegooglebot','apache-modsecurity','apache-shellshock','php-url-fopen'],
}

What are you seeing

I updated the fail2ban module and fail2ban, but I had many errors later and the original configuration file (jail.conf) of the package was all deteriorated.

I believe that the way the module is configured, is not ideal. Jail.conf will always be modified by new versions and distributions, and the demand for new changes to the module will always be very high as jail.conf evolves.

Wouldn't it be better if the module kept the jail.conf intact and created a jail.local (example) with all the customized settings? The module would be cleaner and without the need for updating because of new versions.

The module turned my jail.conf into a Frankenstein and it doesn't even work. And look that there are few configurations and very simple.

I debugged the puppet agent and pasted it into pastebin for you to see all the modifications to the jail.conf file.

Output log

May 11 21:04:02 server puppet-agent[28991]: (/Stage[main]/Fail2ban::Service/Service[fail2ban]/ensure) ensure changed 'stopped' to 'running'
May 11 21:04:02 server fail2ban-server[29647]: 2020-05-11 21:04:02,115 fail2ban.configreader [29647]: ERROR Found no accessible config files for 'filter.d/sshd-ddos' under /etc/fail2ban
May 11 21:04:02 server fail2ban-server[29647]: 2020-05-11 21:04:02,115 fail2ban.jailreader [29647]: ERROR Unable to read the filter 'sshd-ddos'
May 11 21:04:02 server fail2ban-server[29647]: 2020-05-11 21:04:02,115 fail2ban.jailsreader [29647]: ERROR Errors in jail 'sshd-ddos'. Skipping...
May 11 21:04:02 server fail2ban-server[29647]: 2020-05-11 21:04:02,141 fail2ban [29647]: ERROR Failed during configuration: Bad value substitution:
May 11 21:04:02 server fail2ban-server[29647]: section: [recidive]
May 11 21:04:02 server fail2ban-server[29647]: option : action
May 11 21:04:02 server fail2ban-server[29647]: key : port
May 11 21:04:02 server fail2ban-server[29647]: rawval : ", protocol="%(protocol)s", chain="%(chain)s"]
May 11 21:04:02 server fail2ban-server[29647]: %(mta)s-whois-lines[name=%(name)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s"]
May 11 21:04:02 server fail2ban-server[29647]: 2020-05-11 21:04:02,146 fail2ban [29647]: ERROR Async configuration of server failed
May 11 21:04:02 server systemd[1]: fail2ban.service: main process exited, code=exited, status=255/n/a
May 11 21:04:02 server fail2ban-client[29653]: 2020-05-11 21:04:02,201 fail2ban [29653]: ERROR Failed to access socket path: /var/run/fail2ban/fail2ban.sock. Is fail2ban running?
May 11 21:04:02 server systemd[1]: fail2ban.service: control process exited, code=exited status=255
May 11 21:04:02 server systemd[1]: Unit fail2ban.service entered failed state.
May 11 21:04:02 server systemd[1]: fail2ban.service failed.
May 11 21:04:04 server puppet-agent[28991]: Applied catalog in 11.04 seconds

Any additional information you'd like to impart

https://pastebin.com/bMw3mwpR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant