mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-06-27 19:21:04 +00:00
revert: robustness and platform changes as per maintainer feedback
This commit is contained in:
parent
c3fdd03e1b
commit
4b1ffbe52e
10 changed files with 11 additions and 15 deletions
|
|
@ -19,8 +19,6 @@ ver. 1.1.1-dev-1 (20??/??/??) - development nightly edition
|
|||
|
||||
### Fixes
|
||||
* Potential SQL injection in database.py using parameterized queries
|
||||
* setup.py crash on Windows due to symlink privilege requirements
|
||||
* Bare except blocks replaced with Exception to improve signal handling
|
||||
* fixes `systemd` bug with missing journal descriptor after rotation by reopening of journal if it is recognized as not alive (gh-3929)
|
||||
* improve threaded clean-up of all filters, new thread functions `afterStop` (to force clean-up after stop) and `done`, invoking `afterStop` once
|
||||
* ensure journal-reader is always closed (additional prevention against leaks and "too many open files"), thereby avoid sporadic segfault
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ kill-mode =
|
|||
|
||||
# intern conditional parameter used to provide killing mode after ban:
|
||||
_kill_ =
|
||||
_kill_ss = if [ "<restored>" != "1" ]; then ss -K dst "[<ip>]" || [ $? -eq 1 ]; fi
|
||||
_kill_conntrack = if [ "<restored>" != "1" ]; then conntrack -D -s "<ip>" || [ $? -eq 1 ]; fi
|
||||
_kill_ss = ss -K dst "[<ip>]"
|
||||
_kill_conntrack = conntrack -D -s "<ip>"
|
||||
|
||||
# Option: kill
|
||||
# Notes.: can be used to specify custom killing feature, by default depending on option kill-mode
|
||||
|
|
|
|||
|
|
@ -202,11 +202,11 @@ after = 1.conf
|
|||
rplcmnt = 1
|
||||
try: # set it in map-vars (consider different python versions):
|
||||
defaults[sopt] = v
|
||||
except Exception:
|
||||
except:
|
||||
# try to set in first default map (corresponding vars):
|
||||
try:
|
||||
defaults._maps[0][sopt] = v
|
||||
except Exception: # pragma: no cover
|
||||
except: # pragma: no cover
|
||||
# no way to update vars chain map - overwrite defaults:
|
||||
self._defaults[sopt] = v
|
||||
return rplcmnt
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import importlib
|
|||
try:
|
||||
import ctypes
|
||||
_libcap = ctypes.CDLL('libcap.so.2')
|
||||
except Exception:
|
||||
except:
|
||||
_libcap = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ R_MAP = {
|
|||
try:
|
||||
re.search("^re(?i:val)$", "reVAL")
|
||||
R_GLOB2LOCFLAGS = ( re.compile(r"(?<!\\)\((?:\?:)?(\(\?[a-z]+)\)"), r"\1:" )
|
||||
except Exception:
|
||||
except:
|
||||
R_GLOB2LOCFLAGS = ()
|
||||
|
||||
def mapTag2Opt(tag):
|
||||
|
|
|
|||
|
|
@ -1314,7 +1314,7 @@ try:
|
|||
md5sum = hashlib.md5
|
||||
# try to use it (several standards like FIPS forbid it):
|
||||
md5sum(' ').hexdigest()
|
||||
except Exception: # pragma: no cover
|
||||
except: # pragma: no cover
|
||||
md5sum = hashlib.sha1
|
||||
except ImportError: # pragma: no cover
|
||||
# hashlib was introduced in Python 2.5. For compatibility with those
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover
|
|||
ja = self.__jrnlargs
|
||||
super(journal.Reader, self.__journal).__init__(
|
||||
ja.get('flags', 0), ja.get('path'), ja.get('files'), ja.get('namespace'))
|
||||
except Exception:
|
||||
except:
|
||||
# cannot reopen in that way, so simply recreate reader:
|
||||
self.closeJournal()
|
||||
self.__journal = journal.Reader(**self.__jrnlargs)
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class DNSUtils:
|
|||
# try to obtain from network interfaces if possible (implemented for this platform):
|
||||
try:
|
||||
ips = IPAddrSet([a for ni, a in DNSUtils._NetworkInterfacesAddrs()])
|
||||
except Exception:
|
||||
except:
|
||||
ips = IPAddrSet()
|
||||
# cache and return :
|
||||
DNSUtils.CACHE_nameToIp.set(DNSUtils._getNetIntrfIPs_key, ips)
|
||||
|
|
@ -257,7 +257,7 @@ class DNSUtils:
|
|||
with open('/proc/sys/net/ipv6/conf/all/disable_ipv6', 'rb') as f:
|
||||
# if 1 - disabled, 0 - enabled
|
||||
return not int(f.read())
|
||||
except Exception:
|
||||
except:
|
||||
pass
|
||||
s = None
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -939,7 +939,7 @@ class Server:
|
|||
os.close(fd)
|
||||
except OSError: # ERROR (ignore)
|
||||
pass
|
||||
except Exception:
|
||||
except:
|
||||
try:
|
||||
maxfd = os.sysconf("SC_OPEN_MAX")
|
||||
except (AttributeError, ValueError):
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ def updatePyExec(bindir, executable=None):
|
|||
bindir = os.path.realpath(bindir)
|
||||
if executable is None:
|
||||
executable = sys.executable
|
||||
if sys.platform == 'win32':
|
||||
return
|
||||
pypath = os.path.join(bindir, 'fail2ban-python')
|
||||
# if not exists or point to another version - update link:
|
||||
isfile = os.path.isfile(os.path.realpath(pypath))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue