Commit Graph

42 Commits

Author SHA1 Message Date
Oskari Rauta 1441366364 banip: update nginx matching
Currently banip matches nginx log entries starting with
nginx[number]:...

I am running a containerized nginx with alpine as base, which
ends up adding log entries without [number] part..
like this:
nginx:...

This patch updates regex for nginx log entry search to include
both versions.

Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
2021-12-03 05:15:00 +02:00
Dirk Brenken f630037043
banip: update 0.7.10-2
* optimize dns resolve function
* cosmetics

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-09-07 21:16:08 +02:00
Dirk Brenken 8ac0103cbd
banip: update 0.7.10
* switch to unencrypted http downloads for ipdeny.com due to persistant certificate issues
* compact json generator code (tested with report files > 2MB)
* various code cleanups and optimizations

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-08-29 17:16:59 +02:00
Dirk Brenken 0c16840e26
banip: refine/fix nginx search pattern
* fix issue with nginx search pattern reported in forum support thread

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-06-17 22:23:24 +02: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 1402b3b56d
banip: update to 0.7.8
* fix pid file processing of the background monitor plus child
  processes (bug reported in the forum)
* made the enabled/disabled switch of the background monitor functional

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-05-04 18:44:26 +02:00
Dirk Brenken 7cfb0f4657
banip: fix housekeeping
* fix whitelist housekeeping if you switch between normal- and
  'whitelist only' mode

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-04-23 15:03:53 +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 86a20c7955
banip: bugfix 0.7.6-2
* fix housekeeping of external list sources

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-04-03 19:16:39 +02:00
Dirk Brenken 1235acdde6
banip: update to 0.7.6
* rework the central iptables function to significantly
  reduce the code complexity and the overall number of iptables calls
* check early and only once in the chain for ctstate NEW and
  return otherwise (thanks @ldir-EDB0)
* made the whitelist ordering within the chain more flexible

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-03-28 17:07:28 +02:00
Dirk Brenken fb4bfd259d
banip: update to 0.7.5-4
* fix another IPv4/IPv6 related iptables chain creation problem
* fix counter during ipset creation
* fix regex for debug counters
* fix ipset housekeeping for local sources

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-03-26 19:19:57 +01:00
Dirk Brenken 80466dd045
banip: update 0.7.5-3
* fix iptables/chain creation in setups without IPv6 support

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-03-19 20:49:59 +01: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 804249a571
banip: bump to 0.7.5
* black- and whitelist now supporting domain names as well - the
corresponding IPs (IPv4 & IPv6) will be resolved in a detached
background process and added to the IPsets

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-03-14 06:07:07 +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 e461c5e88c
banip: bugfix
* fix a stale pid file during package update

Signed-off-by: Dirk Brenken <dev@brenken.org>
2021-02-12 20:44:11 +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
Dirk Brenken 33ed1eff57
banip: DHCPv6 bugfix
* ignore local DHCPv6 related and local icmpv6 traffic in banIP chain

Signed-off-by: Dirk Brenken <dev@brenken.org>
2020-12-30 20:02:40 +01:00
Javier Marcet a627e1f6c7 banip: removed logd check since logd dep has been dropped
Signed-off-by: Javier Marcet <javier@marcet.info>
2020-11-10 08:34:56 +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 e97f350a00
banip: update 0.3.11
* fix ssh daemon autodetection
* fix 'sshd' logfile parsing

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-30 19:31:14 +01:00
Dirk Brenken de149441a4
banip: update 0.3.10
* add missing logd dependency
* check if logd is enabled during runtime
* some more init tweaks

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-15 16:19:40 +01:00
Dirk Brenken e38810f38e
banip: update 0.3.9
* fix 'enabled' service check

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-10 18:55:21 +01:00
Dirk Brenken 0dee2a92de
banIP: update 0.3.8
* limit firewall hotplug trigger to certain wan 'INTERFACE' as well,
  to prevent possible race conditions during boot

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-09 06:40:40 +01:00
Dirk Brenken 49b43b81e8
banip: update 0.3.7
* fix a logical glitch in the hotplug event handler
* properly handle fatal iptables errors - even in subshells

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-08 18:40:30 +01:00
Dirk Brenken 72fba3a17b
banip: update 0.3.6
* more startup tweaks
* re-use f_log function in helper scripts
* small fixes / polish up for forthcoming 19.07 release

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-11-06 20:45:20 +01:00
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
Dirk Brenken 70ab67649b
banip: update 0.3.1
* the WAN auto detection now supports multiple interfaces, too
* no longer filter out possible LAN devices
* add a new DoH (DNS over HTTPS) blocklist source with public
  DoH DNS server addresses, to effectively block client side DoH
  communication, e.g. via Firefox or Chrome

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-10-09 14:07:05 +02: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 04bd683af8
banip: update 0.2.1
* fix for #9954

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-09-10 19:34:49 +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 f8f539e21c
banip: update 0.1.4
* refine 'refresh' mode, add normal processing/download as fallback
* remove needless reload trigger
* fix various ipset warnings
* fix timer in 'refresh' mode
* adapt ssbl regex to new source list format

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-06-18 22:23:17 +02:00
Dirk Brenken f5de0439c1
banip: update 0.1.3
* change iptables whitelist target from 'ACCEPT' to 'RETURN'
  to stop traversing the banIP chain and resume at the next chain
* cosmetics

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-05-30 16:30:39 +02:00
Dirk Brenken 21f5f357e0
banip: update 0.1.2
* add more IPv4 & IPv6 consistency checks
* various cleanups

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-05-27 06:22:34 +02:00
Dirk Brenken f3ece9653d
banip: update 0.1.1
* remove needless sort step to reduce system load
* change maxqueue default in backend and LuCI frontend
  to '4' to reduce (default) system load
* cosmetics

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-05-16 11:16:03 +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 939979a7a9 banip: release 0.0.7
* determine L3 and L2 network devices to support pppoe interfaces
correctly

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-12-26 21:52:26 +01:00
Dirk Brenken dcaddb5297 banip: update 0.0.6
* support multiple WAN interfaces in iptables rules,
  set 'ban_iface' option accordingly (as space separated list)
  or use the LuCI frontend
* add new "refresh" mode while triggered by fw changes (no download)
* add required ip dependency
* fix wrong 'settype' definition for firehol1 in config

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-11-17 16:30:52 +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