1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-19 23:28:39 +02:00
openwrt-packages/net/banip/files
Dirk Brenken fcea2f75c3
banip: update 0.3.5
* fix race condition in download utility detection during boot
* fix multiple possible bugs in ipset creation
* prevent parallel service starts
* refine service trigger handling
* add ssh daemon auto detection
* print to stdout if 'logger' is not available

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-03 16:44:22 +01:00
..
banip.blacklist banip: new package to block incoming & outgoing ip addresses 2018-11-10 11:01:45 +01:00
banip.conf banip: update 0.3.1 2019-10-09 14:07:05 +02:00
banip.hotplug banip: update 0.2.0 2019-09-09 21:11:10 +02:00
banip.init banip: update 0.3.5 2019-11-03 16:44:22 +01:00
banip.service banip: update 0.3.5 2019-11-03 16:44:22 +01:00
banip.sh banip: update 0.3.5 2019-11-03 16:44:22 +01:00
banip.whitelist banip: new package to block incoming & outgoing ip addresses 2018-11-10 11:01:45 +01:00
README.md banip: update 0.3.0 2019-10-04 10:16:20 +02:00

banIP - ban incoming and/or outgoing ip adresses via ipsets

Description

IP address blocking is commonly used to protect against brute force attacks, prevent disruptive or unauthorized address(es) from access or it can be used to restrict access to or from a particular geographic area — for example.

Main Features

  • support many IP blocklist sources (free for private usage, for commercial use please check their individual licenses):
  • zero-conf like automatic installation & setup, usually no manual changes needed
  • automatically selects one of the following download utilities: aria2c, curl, uclient-fetch, wget
  • Really fast downloads & list processing as they are handled in parallel as background jobs in a configurable 'Download Queue'
  • full IPv4 and IPv6 support
  • ipsets (one per source) are used to ban a large number of IP addresses
  • supports blocking by ASN numbers
  • supports blocking by iso country codes
  • supports local white & blacklist (IPv4, IPv6 & CIDR notation), located by default in /etc/banip/banip.whitelist and /etc/banip/banip.blacklist
  • auto-add unsuccessful LuCI and ssh login attempts via 'dropbear' or 'sshd' to local blacklist (see 'ban_autoblacklist' option)
  • auto-add the uplink subnet to local whitelist (see 'ban_autowhitelist' option)
  • provides a small background log monitor to ban unsuccessful login attempts in real-time
  • per source configuration of SRC (incoming) and DST (outgoing)
  • integrated IPSet-Lookup
  • integrated RIPE-Lookup
  • blocklist source parsing by fast & flexible regex rulesets
  • minimal status & error logging to syslog, enable debug logging to receive more output
  • procd based init system support (start/stop/restart/reload/refresh/status)
  • procd network interface trigger support
  • automatic blocklist backup & restore, they will be used in case of download errors or during startup
  • output comprehensive runtime information via LuCI or via 'status' init command
  • strong LuCI support
  • optional: add new banIP sources on your own

Prerequisites

  • OpenWrt, tested with the stable release series (19.07) and with the latest snapshot
  • download utility: 'uclient-fetch' with one of the 'libustream-*' ssl libraries, 'wget', 'aria2c' or 'curl' is required

Installation & Usage

  • install 'banip' (opkg install banip)
  • at minimum configure the needed IP blocklist sources, the download utility and enable the banIP service in /etc/config/banip
  • control the banip service manually with /etc/init.d/banip start/stop/restart/reload/refresh/status or use the LuCI frontend

LuCI banIP companion package

  • it's recommended to use the provided LuCI frontend to control all aspects of banIP
  • install 'luci-app-banip' (opkg install luci-app-banip)
  • the application is located in LuCI under 'Services' menu

banIP config options

  • usually the pre-configured banIP setup works quite well and no manual overrides are needed

  • the following options apply to the 'global' config section:

    • ban_enabled => main switch to enable/disable banIP service (bool/default: '0', disabled)
    • ban_automatic => determine the L2/L3 WAN network device automatically (bool/default: '1', enabled)
    • ban_iface => space separated list of WAN network interface(s)/device(s) used by banIP (default: not set, automatically detected)
    • ban_realtime => a small log/banIP background monitor to block SSH/LuCI brute force attacks in realtime (bool/default: 'false', disabled)
  • the following options apply to the 'extra' config section:

    • ban_debug => enable/disable banIP debug output (bool/default: '0', disabled)
    • ban_nice => set the nice level of the banIP process and all sub-processes (int/default: '0', standard priority)
    • ban_triggerdelay => additional trigger delay in seconds before banIP processing begins (int/default: '2')
    • ban_backupdir => target directory for banIP backups (default: '/tmp')
    • ban_sshdaemon => select the SSH daemon for logfile parsing, 'dropbear' or 'sshd' (default: 'dropbear')
    • ban_starttype => select the used start type during boot, 'start', 'refresh' or 'reload' (default: 'start')
    • ban_maxqueue => size of the download queue to handle downloads & IPSet processing in parallel (int/default: '4')
    • ban_fetchutil => name of the used download utility: 'uclient-fetch', 'wget', 'curl', 'aria2c' (default: not set, automatically detected)
    • ban_fetchparm => special config options for the download utility (default: not set)
    • ban_autoblacklist => store auto-addons temporary in ipset and permanently in local blacklist as well (bool/default: '1', enabled)
    • ban_autowhitelist => store auto-addons temporary in ipset and permanently in local whitelist as well (bool/default: '1', enabled)

Examples

receive banIP runtime information:


/etc/init.d/banip status
::: banIP runtime information
  + status     : enabled
  + version    : 0.3.0
  + util_info  : /usr/bin/aria2c, true
  + ipset_info : 10 IPSets with overall 106729 IPs/Prefixes
  + backup_dir : /tmp
  + last_run   : 03.10.2019 19:15:25
  + system     : UBNT-ERX, OpenWrt SNAPSHOT r11102-ced4c0e635

cronjob for a regular IPSet blocklist update (/etc/crontabs/root):


0 06 * * *    /etc/init.d/banip reload

Support

Please join the banIP discussion in this forum thread or contact me by mail dev@brenken.org

Removal

  • stop all banIP related services with /etc/init.d/banip stop
  • optional: remove the banip package (opkg remove banip)

Have fun!
Dirk