Created attachment 428318 [details, diff] Fixed a type check which was causing syntax/undefined errors in DenyHosts/report.py when switching between Python2 and Python3. When I upgraded to the current stable version for denyhosts, the service doesn't start. This is the error that appears in my logs: Mar 15 10:06:17 panza denyhosts.py[4757]: File "/usr/lib/python-exec/python2.7/d enyhosts.py", line 229, in <module> Mar 15 10:06:17 panza denyhosts.py[4757]: first_time, noemail, daemon, foregroun d) Mar 15 10:06:17 panza denyhosts.py[4757]: File "/usr/lib64/python2.7/site-packag es/DenyHosts/deny_hosts.py", line 77, in __init__ Mar 15 10:06:17 panza denyhosts.py[4757]: offset = self.process_log(logfile, las t_offset) Mar 15 10:06:17 panza denyhosts.py[4757]: File "/usr/lib64/python2.7/site-packages/DenyHosts/deny_hosts.py", line 488, in process_log Mar 15 10:06:17 panza denyhosts.py[4757]: self.__report.add_section(msg, new_denied_hosts) Mar 15 10:06:17 panza denyhosts.py[4757]: File "/usr/lib64/python2.7/site-packages/DenyHosts/report.py", line 41, in add_section Mar 15 10:06:17 panza denyhosts.py[4757]: if type(i) in (TupleType, ListType): Mar 15 10:06:17 panza denyhosts.py[4757]: NameError: global name 'TupleType' is not defined It's a known bug for upstream, and it's fixed with the attached patch.
Source: https://github.com/denyhosts/denyhosts/pull/47/commits/b5611dfa0510ec8fbaa2db4b6834d0bd7ecf0909 And when does this issue with switching python occur? Isn't denyhost in gentoo PYTHON_TARGETS="python2_7" only?
(In reply to Christoph Junghans from comment #1) > Source: > https://github.com/denyhosts/denyhosts/pull/47/commits/ > b5611dfa0510ec8fbaa2db4b6834d0bd7ecf0909 > > And when does this issue with switching python occur? Isn't denyhost in > gentoo PYTHON_TARGETS="python2_7" only? The switching refers to the developer's work to make denyhosts >= 3.0 run under Python 2 and 3. This bug only appears when denyhosts uses Python 2.7, and searches malicious IP addresses in the log file for the first time. like the current Gentoo default. The same code, without the patch, runs fine under Python 3.x.
commit cb232afaeddeec0d704a99e1c9ceb8d712d24ff2 Author: Christoph Junghans <ottxor@gentoo.org> Date: Wed Mar 16 14:33:25 2016 -0600 app-admin/denyhosts: fix bug #577502 Package-Manager: portage-2.2.26