Commit 18ccab3c authored by Vitaly Lipatov's avatar Vitaly Lipatov

0.11-alt1: bump version, add IPv6 whitelist checks

- spec: bump to 0.11, add whitelist.txt to common package - eterban.sh: add IPv6 whitelist check, improve check output - eterban_api.py: fix whitelist check for IPv6 addresses
parent 9ac5f230
# eterban whitelist
# One IPv4/IPv6 address or CIDR network per line.
# Lines starting with '#' and blank lines are ignored.
# Entries in this file are never banned (ban requests for them are skipped,
# and matching source traffic is ACCEPTed before DNAT to ban_server).
#
# Examples:
#10.0.0.0/8
#192.168.0.0/16
#172.16.0.0/12
#127.0.0.1
#::1
#fd00::/8
%define defphp php%php_defver %define defphp php%php_defver
Name: eterban Name: eterban
Version: 0.10 Version: 0.11
Release: alt1 Release: alt1
Summary: Etersoft ban service Summary: Etersoft ban service
...@@ -108,6 +108,7 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/ ...@@ -108,6 +108,7 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
%files common %files common
%config(noreplace) /etc/%name/settings.ini %config(noreplace) /etc/%name/settings.ini
%config(noreplace) /etc/%name/whitelist.txt
%files gateway %files gateway
%systemd_unitdir/eterban.service %systemd_unitdir/eterban.service
...@@ -134,6 +135,10 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/ ...@@ -134,6 +135,10 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
%config(noreplace) /etc/fail2ban/action.d/eterban.conf %config(noreplace) /etc/fail2ban/action.d/eterban.conf
%changelog %changelog
* Tue Jul 08 2026 Vitaly Lipatov <lav@altlinux.ru> 0.11-alt1
- gateway: support list of WAN interfaces via i_interfaces config option
- spec: add whitelist.txt to common package
* Thu Jan 29 2026 Vitaly Lipatov <lav@altlinux.ru> 0.10-alt1 * Thu Jan 29 2026 Vitaly Lipatov <lav@altlinux.ru> 0.10-alt1
- eterban_switcher.py: return error on redis connection error - eterban_switcher.py: return error on redis connection error
- add auto-unban with exponential backoff - add auto-unban with exponential backoff
......
...@@ -43,6 +43,10 @@ if [ "$command" = "check" ] ; then ...@@ -43,6 +43,10 @@ if [ "$command" = "check" ] ; then
echo "$ip is BANNED (in $setname_ipv6)" echo "$ip is BANNED (in $setname_ipv6)"
found=1 found=1
fi fi
if ipset test eterban_white_ipv6 "$ip" 2>/dev/null ; then
echo "$ip is WHITELISTED (in eterban_white_ipv6)"
found=1
fi
else else
# IPv4 # IPv4
if ipset test $setname "$ip" 2>/dev/null ; then if ipset test $setname "$ip" 2>/dev/null ; then
...@@ -54,7 +58,7 @@ if [ "$command" = "check" ] ; then ...@@ -54,7 +58,7 @@ if [ "$command" = "check" ] ; then
found=1 found=1
fi fi
if ipset test eterban_white "$ip" 2>/dev/null ; then if ipset test eterban_white "$ip" 2>/dev/null ; then
echo "$ip is WHITELISTED" echo "$ip is WHITELISTED (in eterban_white)"
found=1 found=1
fi fi
fi fi
......
...@@ -16,6 +16,7 @@ IPSET_V4 = 'eterban_1' ...@@ -16,6 +16,7 @@ IPSET_V4 = 'eterban_1'
IPSET_V6 = 'eterban_1_ipv6' IPSET_V6 = 'eterban_1_ipv6'
IPSET_FIREHOL = 'firehol_level1' IPSET_FIREHOL = 'firehol_level1'
IPSET_WHITE = 'eterban_white' IPSET_WHITE = 'eterban_white'
IPSET_WHITE_V6 = 'eterban_white_ipv6'
path_to_config = '/etc/eterban/settings.ini' path_to_config = '/etc/eterban/settings.ini'
...@@ -54,7 +55,9 @@ def check_ip(ip_str): ...@@ -54,7 +55,9 @@ def check_ip(ip_str):
result['firehol'] = ipset_test(IPSET_FIREHOL, ip_str) result['firehol'] = ipset_test(IPSET_FIREHOL, ip_str)
# Check whitelist # Check whitelist
if isinstance(addr, ipaddress.IPv4Address): if isinstance(addr, ipaddress.IPv6Address):
result['whitelisted'] = ipset_test(IPSET_WHITE_V6, ip_str)
else:
result['whitelisted'] = ipset_test(IPSET_WHITE, ip_str) result['whitelisted'] = ipset_test(IPSET_WHITE, ip_str)
return result return result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment