Report this

What is the reason for this report?

The VPS iptables records limit (numiptent) might affect the work of Plesk's Fail2Ban.

Posted on February 28, 2020

Hi, I had a situation with my previous Plesk install on VPS which could be the result of iptables records limit was exceeded. Can you please advise how can this get resolved to re-enable proper function of my fail2ban firewall?

fail2ban.utils [2399]: ERROR 7efd4c087210 – returned 1 fail2ban.CommandAction [2399]: ERROR Invariant check failed. Trying to restore a sane environment fail2ban.utils [2399]: Level 39 7efd4c1a95e0 – exec: iptables -w -D INPUT -p tcp -m multiport --dports smtp,smtps,submission -j f2b-plesk-postfix iptables -w -F f2b-plesk-postfix iptables -w -X f2b-plesk-postfix fail2ban.utils [2399]: ERROR 7efd4c1a95e0 – stderr: “iptables v1.6.1: Couldn’t load target f2b-plesk-postfix':No such file or directory" fail2ban.utils [2399]: ERROR 7efd4c1a95e0 -- stderr: '' fail2ban.utils [2399]: ERROR 7efd4c1a95e0 -- stderr: "Try iptables -h’ or ‘iptables --help’ for more information.” fail2ban.utils [2399]: ERROR 7efd4c1a95e0 – stderr: ‘iptables: No chain/target/match by that name.’ fail2ban.utils [2399]: ERROR 7efd4c1a95e0 – stderr: ‘iptables: No chain/target/match by that name.’ fail2ban.utils [2399]: ERROR 7efd4c1a95e0 – returned 1 fail2ban.utils [2399]: Level 39 7efd4c087210 – exec: iptables -w -n -L INPUT | grep -q ‘f2b-plesk-postfix[ \t]’ 915 fail2ban.utils [2399]: ERROR 7efd4c087210 – returned 1 915 fail2ban.CommandAction [2399]: CRITICAL Unable to restore environment 915 fail2ban.actions [2399]: ERROR Failed to execute ban jail ‘plesk-postfix’ action ‘iptables-multiport’ info



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

The error messages you provided suggest that Fail2Ban is trying to manipulate an iptables chain called “f2b-plesk-postfix” which doesn’t exist, causing the iptables commands to fail. It could be because Fail2Ban is misconfigured or the iptables chain was deleted manually or by some other process.

However, your original concern was about the limit of iptables records (numiptent) affecting the work of Plesk’s Fail2Ban. If the number of iptables rules has exceeded the limit set by the kernel, it can certainly cause issues. Fail2Ban won’t be able to add new rules to ban IP addresses, and you might see errors in your logs.

To resolve this issue, here are a few suggestions:

  • Optimize your iptables rules: Check your iptables rules to see if there are any unnecessary or duplicate rules that you could remove to reduce the total number of entries.

Optimize Fail2Ban: You might be able to reduce the number of iptables rules created by Fail2Ban by adjusting its settings. For example, you could increase the “bantime” parameter to ban IP addresses for a longer period, thus reducing the churn of adding and removing rules. You could also adjust the “findtime” and “maxretry” parameters to be more forgiving and generate fewer bans.

  • Use ipset with iptables: If you’re dealing with a large number of IP addresses to ban, consider using ipset in conjunction with iptables. Ipset is designed to handle large numbers of entries more efficiently than plain iptables. There’s a Fail2Ban action called “iptables-ipset-proto6-allports” which uses ipset.

  • Investigate the issue with the “f2b-plesk-postfix” chain: To address the error messages you provided, you might need to investigate why the “f2b-plesk-postfix” chain is missing. You can start Fail2Ban in debug mode to get more detailed logs which might help identify the issue.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.