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 log file contains ERROR test -e /proc/net/xt_recent/fail2ban-ssh #15

Open
jlerbsc opened this issue Jan 4, 2017 · 16 comments
Open

Comments

@jlerbsc
Copy link

jlerbsc commented Jan 4, 2017

What's the meaning of this errors in fail2ban log?
and why /proc/net/xt_recent is not created with debops fail2ban installation?

ERROR test -e /proc/net/xt_recent/fail2ban-ssh returned 100
ERROR Invariant check failed. Trying to restore a sane environment
ERROR echo / > /proc/net/xt_recent/fail2ban-ssh
iptables -D INPUT -m recent --update --seconds 604800 --name fail2ban-ssh --jump REJECT --reject-with icmp-admin-prohibited returned 100

@drybjed
Copy link
Member

drybjed commented Jan 9, 2017

Not sure... Do you run the debops.fail2ban role with DebOps playbooks or as standalone? If you use a custom playbook, did you enable the become: True option on the playbook level so that the role will be run with root privileges?

@jlerbsc
Copy link
Author

jlerbsc commented Jan 9, 2017

It's a custom playbook, I'm going to try become: True. Thanks

@jhilden
Copy link

jhilden commented Jul 7, 2017

@jlerbsc did you find a solution for this error? We are seeing the same thing. /proc/net/xt_recent/ is just empty on the servers.

@drybjed I'm not sure how to add become: true "on the playbook level", since we have the role directly in our site.yml like this:

--
- hosts: all
  remote_user: root
  roles:
    - debops.fail2ban

Adding become: true here did not help.

Any help would be appreciated.

@drybjed
Copy link
Member

drybjed commented Jul 7, 2017

@jhilden What happens when you install fail2ban package by hand on that host, does it work correctly?

@jhilden
Copy link

jhilden commented Jul 7, 2017

@drybjed yes, wehen I install it manually on that host (sudo apt-get install fail2ban) it works just fine.

@drybjed
Copy link
Member

drybjed commented Jul 7, 2017

@jhilden In that case I suppose it might be some configuration applied by the role. You could try commenting out the sections that the role adds and see if you find out which one is the culprit.

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

@hi drybjec, I always have this log when using debops.fail2ban role with a custom playbooks and become: yes option on the playbook level like this. Do you have an idea?

  • hosts : tag_managed_ansible:&tag_role_nginx_front:&tag_target_{{target}}
    become : yes
    user: xxx
    tags:

    • nginx_front
    • fail2ban
      vars_files:
    • "{{inventory_dir}}/vars/fail2ban-nginx.yml"
    • "{{inventory_dir}}/vars/fail2ban-default.yml"

    roles:

    • { role : debops.fail2ban }

ERROR test -e /proc/net/xt_recent/fail2ban-ssh returned 100
ERROR Invariant check failed. Trying to restore a sane environment
ERROR echo / > /proc/net/xt_recent/fail2ban-ssh
iptables -D INPUT -m recent --update --seconds 604800 --name fail2ban-ssh --jump REJECT --reject-with icmp-admin-prohibited returned 100

@drybjed
Copy link
Member

drybjed commented Nov 24, 2017

This seems to be an error from the fail2ban service itself, perhaps an issue with the configuration. What happens when you try to restart the service by hand?

@drybjed
Copy link
Member

drybjed commented Nov 24, 2017

@jlerbsc Is that the same error that you started this issue thread with?

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

Yes it's the same error. I think the origi of the error is related to the fact that the file fail2ban-ssh in /proc/net/xt_recent directory is not found and the command sudo echo / > /proc/net/xt_recent/fail2ban-ssh throws /proc/net/xt_recent/fail2ban-ssh: No such file or directory

@drybjed
Copy link
Member

drybjed commented Nov 24, 2017

Do you have the xt_recent module loaded in the kernel? Check with:

lsmod | grep recent

What kind of host is this, is is a container, a VM?

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

When i restart fail2ban by hand, i have the same errors (Fail2ban v0.8.13).

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

lsmod | grep recent
xt_recent 17246 0
x_tables 27111 3 xt_recent,ip_tables,iptable_filter

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

The host is an AWS/EC2 server

@drybjed
Copy link
Member

drybjed commented Nov 24, 2017

@jlerbsc Well, I have the same suggestion as last time - try installing a fail2ban package manually on a clean host to see if it works at all. If it does, configure it with debops.fail2ban and try commenting out or moving away parts of the configuration until it works again. That way you can find out what caused the issue.

@jlerbsc
Copy link
Author

jlerbsc commented Nov 24, 2017

When i re install fail2ban from scratch it works perfectly with default configuration.
sudo apt-get purge fail2ban
sudo apt-get install fail2ban

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

3 participants