Commit Graph

38 Commits

Author SHA1 Message Date
Dirk Brenken 2c6d5adac0
banip: update 0.9.5-3
* allow multiple protocol/port definitions per feed, e.g. 'tcp udp 80 443 50000'
* removed the default protocol/port limitation from asn feed

Signed-off-by: Dirk Brenken <dev@brenken.org>
2024-04-26 17:03:33 +02:00
Dirk Brenken fa80fefe22
banip: release 0.9.5-1
* added a DDoS protection rules in a new pre-routing chain to prevent common ICMP, UDP and SYN flood attacks and drop spoofed tcp flags & invalid conntrack packets, flood tresholds are configured via 'ban_icmplimit' (default 10/s), 'ban_synlimit' (default 10/s) and 'ban_udplimit' (default 100/s)
* the new pre-routing rules are tracked via named nft counters and are part of the standard reporting, set 'ban_logprerouting' accordingly
* block countries dynamically by Regional Internet Registry (RIR)/regions, e.g. all countries related to ARIN. Supported service regions are: AFRINIC, ARIN, APNIC, LACNIC and RIPE, set 'ban_region' accordingly
* it's now possible to always allow certain protocols/destination ports in wan-input and wan-forward chains, set 'ban_allowflag' accordingly - e.g. ' tcp 80 443-445'
* filter/convert possible windows line endings of external feeds during processing
* the cpu core autodetection is now limited to max. 16 cores in parallel, set 'ban_cores' manually to overrule this limitation
* set the default nft priority to -100 for banIP input/forward chains (pre-routing is set to -150)
* update readme
* a couple of bugfixes & performance improvements
* removed abandoned feeds: darklist, ipblackhole
* added new feeds: becyber, ipsum, pallebone, debl (changed URL)
* requires a LuCI frontend update as well (separate PR/commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2024-04-20 12:43:37 +02:00
Dirk Brenken 730ad59cb9
banip: release 0.9.4-1
* add support for destination port & protocol limitations for external feeds (see readme for details),
  useful for lan-forward ad- or DoH-blocking, e.g. only tcp ports 80 and 443
* add turris sentinel blocklist feed
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2024-03-02 09:28:39 +01:00
Dirk Brenken 5af101564a
banip: update 0.9.3-2
* rework the device/interface auto-detection (only layer-3 network devices will be detetcted correctly), disable the auto-detection e.g. for special tunnel interfaces
* supports now full gawk (preferred, if installed) and busybox awk
* raise the default boot timeout to 20 seconds (if 'ban_triggerdelay' is not set)
* various small fixes and improvements
* readme update

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-12-28 17:57:04 +01:00
Dirk Brenken df81585cea
banip: bump to release 0.9.3-1
* provides an option to transfer log events on remote servers via cgi interface (disabled by default), see readme for details
* refine the allowlist check to support IP intervals as well before adding an IP to the blocklist

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-12-11 17:35:40 +01:00
Dirk Brenken c4e8140740
banip: release 0.9.2-1
* the log file monitor now supports standard log files used by other log daemons like syslog-ng
  Set 'ban_logreadfile' accordingly, by default it points to /var/log/messages
* removed logd dependency, closes #21932

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-11-05 09:20:23 +01:00
Dirk Brenken 00cad2980c
banip: release 0.9.1-1
* drop packets silently on input and forwardwan chains or actively reject the traffic, set 'ban_blocktype' accordingly
* optimized banIP boot/reload handling
* removed pppoe quirk in device detection
* small fixes and optimizations

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-10-03 21:34:49 +02:00
Dirk Brenken 1c14eb6d8c
banip: release 0.9.0-1
* supports allowing / blocking of certain VLAN forwards in segregated network environments,
   set 'ban_vlanallow', ''ban_vlanblock' accordingly
* simplified the code/JSON to generate/parse the banIP status
* enclose nft related devices in quotation marks , e.g. to handle devices which starts with a number '10g-1'
* made the new vlan options available to LuCI (separate commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-07-16 07:32:48 +02:00
Dirk Brenken 68cdc3952d
banip: release 0.8.9-1
* added HTTP ETag or entity tag support to download only ressources that have been updated on the server side,
  to save bandwith and speed up banIP reloads
* added 4 new feeds: binarydefense, bruteforceblock, etcompromised, ipblackhole (see readme)
* updated the readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-07-07 18:28:58 +02:00
Dirk Brenken b9bd6cdb0d
banip: release 0.8.8-1
* Support MAC-/IPv4/IPv6 ranges in CIDR notation
* Support  concatenation of local MAC addresses with IPv4/IPv6 addresses, e.g. to enforce dhcp assignments (see readme)
* small fixes & cosmetics
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-06-21 10:53:43 +02:00
Dirk Brenken 767d1ec663
banip: release 0.8.7-1
* Optionally auto-add entire subnets to the blocklist Sets based on an additional RDAP request with the
   monitored suspicious IP, set 'ban_autoblocksubnet' accordingly (disabled by default).
   For more information regarding RDAP see
   https://www.ripe.net/manage-ips-and-asns/db/registration-data-access-protocol-rdap for reference.
* small fixes & cosmetics
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-06-05 17:20:42 +02:00
Dirk Brenken cf4ac0301d
banip: update 0.8.6-2
* fix/rework no-op loop
* small fixes & cosmetics
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-05-16 12:34:27 +02:00
Dirk Brenken 7ac5f0a3d9
banip: release 0.8.5-1
* add support for external allowlist URLs to reference additional IPv4/IPv6 feeds, set 'ban_allowurl' accordingly
* make download retries in case of an error configurable, set 'ban_fetchretry' accordingly (default 5)
* small fixes
* readme update
* LuCI update (separate commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-05-06 22:42:20 +02:00
Dirk Brenken 7e70de77d0
banip: update 0.8.4-5
* fix remaining small issues
* standardize log wording
* polished up for branch 23.x

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-05-04 22:40:48 +02:00
Dirk Brenken 829a9a61c2
banip: update 0.8.4-3
* add the option 'ban_autoallowuplink' to limit the uplink autoallow function: 'subnet' (default), 'ip' or 'disable'

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-05-02 21:43:13 +02:00
Dirk Brenken 16acda2262
banip: update 0.8.4-2
* fix domain lookup function (parse banIP config vars)
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-04-28 12:07:06 +02:00
Dirk Brenken c5d9b3ded2
banip: release 0.8.4-1
* add support for a custom feeds file (/etc/banip/banip.custom.feeds). Add new or edit existing banIP feeds on your own with the integrated custom feed editor (LuCI-component
* add a new option 'ban_blockpolicy' to overrule the default bblock policy (block all chains), see readme for details
* change the feed file format and add a new ipthreat feed, see readme
* refine (debug) logging
* multiple small fixes and improvements
* readme update
* luci update (separate commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-04-23 22:03:09 +02:00
Dirk Brenken c07fae25e7
banip: release 0.8.3-1
* add the new init command 'lookup', to lookup the IPs of domain names in the local lists and update them
* significant acceleration of the domain lookup function
* multiple small fixes and improvements
* readme update
* luci update (separate commit)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-04-06 19:43:46 +02:00
Dirk Brenken 1f5bc3f0f1
banip: update to 0.8.2-3
* raise max. timeouts from 10 to 30 seconds to stabilize the autodetection on slow hardware
* made interface trigger action configurable, set 'ban_triggeraction' accordingly (default: 'start')
* made E-Mail notifications configurable to receive status E-Mais with every banIP run,
  set 'ban_mailnotification' accordingly (default: disabled)
* small fixes & optimizations
* readme update

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-03-22 19:15:39 +01:00
Dirk Brenken d8b6e2ca2a
banip: update 0.8.2-2
* fix the auto-detection for pppoe and 6in4 tunnel interfaces
* add the new 'ban_nftpolicy' option to expose the nft set policy, values: memory (default), performance
* add the new 'ban_nftlogevel' option to expose the nft syslog level, values: emerg, alert, crit, err, warn (default),
  notice, info, debug, audit
* status optimizations
* logging optimizations
* update the readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-03-10 19:42:41 +01:00
Dirk Brenken 7c2296c891
banip: release 0.8.2-1
* major performance improvements: clean-up/optimize all nft calls
* add a new "ban_reportelements" option,
  to disable the (time consuming) Set element count in the report (enabled by default)
* update the readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-03-08 21:03:34 +01:00
Dirk Brenken 0b37036e5a
banip: update 0.8.1-3
* finalized the LuCI frontend preparation (this is the minmal version to use the forthcoming LuCI frontend)
* added a Set survey, to list all elements of a certain set
* changed the default logterm for asterisk
* update the readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-03-06 14:21:52 +01:00
Dirk Brenken 0706b1d2d9
banip: update 0.8.1-2
* add oisdbig as new feed
* LuCI frontend preparation:
  - the json feed file points always to /etc/banip/banip.feeds (and is no longer compressed)
  - supply country list in /etc/banip/banip.countries
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-02-26 08:16:15 +01:00
Dirk Brenken 02c2587f9d
banip: release 0.8.1-1
* add missing wan-forward chain (incl. report/mail adaption)
* changed options:
  - old: ban_blockforward, new: ban_blockforwardwan and ban_blockforwardlan
  - old: ban_logforward, new: ban_logforwardwan and ban_logforwardlan
* add missing dhcp(v6) rules/exceptions
* update readme

Previously run tested by certain forum users (and by me).

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-02-25 10:01:11 +01:00
Dirk Brenken 82a491bac8
banip: release 0.8.0 (nft rewrite)
- complete rewrite of banIP to support nftables
- all sets are handled in a separate nft table/namespace 'banIP'
- for incoming blocking it uses the inet input hook, for outgoing blocking it uses the inet forward hook
- full IPv4 and IPv6 support
- supports nft atomic set loading
- supports blocking by ASN numbers and by iso country codes
- 42 preconfigured external feeds are available, plus local allow- and blocklist
- supports local allow- and blocklist (IPv4, IPv6, CIDR notation or domain names)
- auto-add the uplink subnet to the local allowlist
- provides a small background log monitor to ban unsuccessful login attempts in real-time
- the logterms for the log monitor service can be freely defined via regex
- auto-add unsuccessful LuCI, nginx, Asterisk or ssh login attempts to the local blocklist
- fast feed processing as they are handled in parallel as background jobs
- per feed it can be defined whether the input chain or the forward chain should be blocked (default: both chains)
- automatic blocklist backup & restore, the backups will be used in case of download errors or during startup
- automatically selects one of the following download utilities with ssl support: aria2c, curl, uclient-fetch or wget
- supports a 'allowlist only' mode, this option restricts internet access from/to a small number of secure websites/IPs
- provides comprehensive runtime information
- provides a detailed set report
- provides a set search engine for certain IPs
- feed 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/status/report/search)
- procd network interface trigger support
- ability to add new banIP feeds on your own
- add a readme with all available options/feeds to customize your installation to your needs
- a new LuCI frontend will be available in due course

Signed-off-by: Dirk Brenken <dev@brenken.org>
2023-02-18 21:06:26 +01:00
Dirk Brenken 945513860d
banip: update 0.7.9
* add switch 'ban_fetchinsecure' to allow insecure downloads
  without certificate check (disabled by default)
* better explain 'ban_fetchparm' in readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-06-13 07:36:45 +02:00
Dirk Brenken 515397b009
banip: update to 0.7.7
* add a "whitelist only" mode, this option allows to restrict Internet
  access from/to a small number of secure websites/IPs, and block access
  from/to the rest of the Internet.

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-04-21 21:13:36 +02:00
Dirk Brenken 909a87c2f5
banip: update to 0.7.5-2
* refine the new dns resolving process
* add a caching mechanism for the resolved IPs, the detached name
  lookup takes place only during 'restart' or 'reload' action, 'start'
  and 'refresh' actions are using an auto-generated backup instead.
* update the readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-03-15 20:38:46 +01:00
Dirk Brenken b65353b4f7
banip: update to 0.7.3
* fix search string/pipe preparation for the background service
* fix IPSet maxelem limitation, made it more flexible
* fix potential error during resume action
* add Cisco Talos IP blacklist
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-02-20 10:26:16 +01:00
Dirk Brenken 55d663d291
banip: update to 0.7.2
* add scanning for suspicious nginx events
* add a log counter to track the number of the failed requests
  or login repetitions of the same ip in the log before banning,
  defaults are: ssh (3), luci (3), nginx (5)
* optimize the background service handling
* add 'greensnow' as a new source
* update readme and LuCI frontend regarding the new log count options

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-02-17 21:24:44 +01:00
Dirk Brenken 34d5fcb109
banip: release 0.7.1
* add 'ban_extrasources' to handle banIP-unrelated sets for reporting
  and queries
* add set timeouts for local sources (maclist, whitelist, blacklist)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-02-07 08:30:54 +01:00
Dirk Brenken cadaedbfb2
banip: release 0.7.0
* major rewrite
* add support for multiple chains
* add mac whitelisting
* add support for multiple ssh daemons in parallel
* add an ipset report engine
* add mail notifications
* add suspend/resume functions
* add a cron wrapper to set an ipset related auto-timer for
  automatic blocklist updates
* add a list wrapper to add/remove blocklist sources
* add 19.x and Turris OS 5.x compatibility code
* sources stored in an external compressed json file
  (/etc/banip/banip.sources.gz)
* change Country/ASN download sources (faster/more reliable)
* fix DHCPv6/icmpv6 issues

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-02-04 21:18:02 +01:00
Richard Gering 29a4f8bbb7 banip: Added packet logging feature. Resolved shellcheck warnings.
Signed-off-by: Richard Gering <rg4github@dutchies.us>
2020-10-24 16:20:21 -07:00
Dirk Brenken ff8b853a6d
banip: update 0.3.0
* new 'ca-bundle' dependency as all https connections
  are now validated by default
* automatically select the download utility: 'aria2', 'curl',
  'uclient-fetch' with libustream-* or wget are supported
* track & ban failed LuCI login attempts as well
* add a small log/banIP background monitor to block
  SSH/LuCI brute force attacks in realtime (disabled by default)
* add a config version check (please update your default config!)
* made the automatic wan detection more stable
* fix the IPv6 logfile parser
* fix the service status message
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-10-04 10:16:20 +02:00
Dirk Brenken 5f49601e63
banip: update 0.2.0
* remove 'http-only' mode, all sources are now fetched from https sites
* the backup mode is now mandatory ('/tmp' is the default backup
  directory), always create and re-use backups if available.
  To force a re-download take the 'reload' action.
* support 'sshd' in addition to 'dropbear' for logfile parsing
  to detect break-in events
* always update the black-/whitelist with logfile parsing results
  in 'refresh' mode (no new downloads)
* rework the return code handling
* tweak procd trigger
* various small fixes
* (s)hellsheck cosmetics

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-09-09 21:11:10 +02:00
Dirk Brenken c8e161343d
banip: update 0.1.5
* add extra options to control auto-addons to
  blacklist & whitelist ('ban_autoblacklist' & 'ban_autowhitelist',
  both enabled by default). If disabled auto-addons are only stored
  temporary in the black/whitelist ipset but not in the list itself,
  fixes #9631
* remove old, no longer needed procd workaround
* remove 'zeus' source from default config (discontinued)

Signed-off-by: Dirk Brenken <dev@brenken.org>

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-08-06 15:53:46 +02:00
Dirk Brenken 72df8e4c66 banIP: release 0.1.0
* add automatic blocklist backup & restore, they will be used
  in case of download errors or during startup in backup mode
* add a 'backup mode' to re-use blocklist backups during startup,
  get fresh lists via reload or restart action
* procd interface trigger now supports multiple WAN interfaces
* change URL for abuse.ch/feodo list source in default config
* small fixes
* update readme

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-01-05 16:28:44 +01:00
Dirk Brenken b17588a856 banip: new package to block incoming & outgoing ip addresses
a new script based package called "banIP" to block
incoming & outgoing ip adresses/subnets via ipset.

Features:
* a shell script which uses ipset and iptables
  to ban a large number of IP addresses
  published in various IP blacklists (bogon, firehol etc.)
* support blocking by ASN numbers
* support blocking by iso country codes
* support local white & blacklist (IPv4, IPv6 & CIDR notation)
* auto-add unsuccessful ssh login attempts to local blacklist
* auto-add the uplink subnet to local whitelist
* per source configuration of SRC (incoming) and DST (outgoing)
* supports IPv4 & IPv6

Strong LuCI support:
* easy interface to track & change all aspects of your ipset
  configuration on the fly
* integrated IPSet-Lookup
* integrated RIPE-Lookup
* Log-Viewer & online configuration of white- & blacklist

LuCI-Screenshots will follow in the second post.
Forum discussion:
https://forum.openwrt.org/t/banip-new-project-needs-testers-feedback/16985

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-11-10 11:01:45 +01:00