banIP support thread

Just installed banIP, but I get an error when trying to enable it. Also the interface looks broken. How can I fix that?

1 Like

I don't know. Probably you are using an ancient firmware release from gl.inet!? Please provide the output of cat /etc/openwrt_release and the output of uclient-fetch.

2 Likes

Try upgrading to the v3 firmware from GL.iNet ("testing") -- based on the host name and 192.168.8.1

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='Chaos Calmer'
DISTRIB_REVISION='r47065'
DISTRIB_CODENAME='chaos_calmer'
DISTRIB_TARGET='ar71xx/generic'
DISTRIB_DESCRIPTION='OpenWrt Chaos Calmer 15.05'
DISTRIB_TAINTS='busybox'

Ah, it wasn't installed. Thanks. Now banIP is running, but the interface is still broken and the test IP (104.31.67.136
) from the blacklist can still be accessed. See the screenshot

I've tried, but it worked very slow. So I had to revert back to the latest non-testing version of v2.

The LuCI part of banIP is not compatible with Chaos Calmer based distributions, that's for sure. Regarding your blacklist problem. Did you refresh/reload the lists after adding this IP to your blacklist? Anyway, to debug any banIP problems, please enable debug in banIP and send back the log of a full run (logread -e "banIP").

Here's the log

Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: ipset v6.24: Error in line 1: Syntax error: cannot parse 21:14:07: resolving to IPv6 address failed
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:27 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:28 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:29 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:30 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: ip6tables v1.4.21: unknown option "/usr/sbin/ip6tables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `ip6tables -h' or 'ip6tables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: iptables v1.4.21: unknown option "/usr/sbin/iptables"
Mon Aug  5 00:10:31 2019 daemon.err banip.sh[14582]: Try `iptables -h' or 'iptables --help' for more information.

Just recently discovered this package and I've got it set up just fine, it just works! Very pleased with it and I really like the number of sources we can select from. :grinning::+1:

I might have missed this but do the source lists auto-update? Or is that something I have to do (and could possibly therefore automate using a cron job)?

Then banIP is not compatible with your ancient firmware release - I can't help. In master iptables is v1.8.3 and ipset is v7.3.

Please define a simple cron job for this, you'll find an example in the online readme (see first post).

1 Like

Perfect, thank you!

Hi dibdot, great app as always! :slight_smile:

Quick question regarding country blocking:
If I only want to allow remote access from my country, would you advise to block all other countries?
Would this have a negative impact on my internet performance somehow?

My plan is to add all countries of this list, excluding my own country:

If a feature request is allowed: A country whitelisting option would be awesome!

If you ask me I would clearly say "No"! :wink:
IMHO the automatic blacklist of actual break-in attempts is much more useful ... even if they come from my own country.

Sounds doable, I'll put it on my todo list.

1 Like

Hi dibdot, what exactly do you mean with the "automatic blacklist of actual break-in attempts"? Probably the other blocklists (firehol1, firehol2, etc.)?

I would feel really secure with this setup, I guess:

  • Whitelisting only the countries from which I access my WAN interface (Guess this blocks many potential attempts)
  • Adding Firehol1 and Firehol2 with a cronjob to update each 24 hours
  • Using custom ports for services, for which I configured Port Forwarding

There was a time when I did not do this. Oh boy, that was a bad time. :smiley:
So thumbs up to BanIP, it's an awesome little tool for securing my network. :+1:

1 Like

With every run banIP scans the log buffer for unsuccessful ssh login attempts and add those ips to your local blacklist.

When someone does more than 4 unsuccessful attempts, it doesn't block that IP immediately on my side, it does block it after I restart banip (through "service banip restart"). Is that as expected? I know that Arokh used a fail2ban script waaaaay back and that blocked the IP right after the last incorrect attempt. Hence my question.

I tested this with my mobile phone.

banIP runs via cron (no daemon), when it runs it inspects the log for ssh brute force attacks and blocks via ipset.

Maybe it would be better then to a have extra argument for banip like fail2ban:
/etc/init.d banip fail2ban - Updates Fail2Ban entries.
So it is possible to update the fail2ban entries without updating the block lists?
Or is possible already? with reload?

At this stage it isn't that flexible ... I'll put it on the todo list as well, it's always a pleasure to have a big backlog ... :wink:

1 Like

I've installed banip as a fail2ban replacement but it appears to have many more features.
How do I setup the ban_autoblacklist option? The docs make mention of it, but I couldn't find more information on enabling/configuring it?

No setup, it's always active/enabled. :wink:
Of course, you could fine tune this option, e.g. if auto addons will be saved permanently (which is the default) or only temporary in the current ipset.

1 Like