LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Fail2ban-1.0.2 don't start anymore on current, please help (https://www.linuxquestions.org/questions/slackware-14/fail2ban-1-0-2-dont-start-anymore-on-current-please-help-4175736047/)

Eeel 04-15-2024 07:55 AM

Fail2ban-1.0.2 don't start anymore on current, please help
 
I use the Ponce Slackbuild to build version 1.0.2 from fail2ban but i realized it doesn't start anymore since ~ Apr 3

Code:

# /etc/rc.d/rc.fail2ban start
Starting fail2ban
Traceback (most recent call last):
  File "/usr/bin/fail2ban-client", line 34, in <module>
    from fail2ban.client.fail2banclient import exec_command_line, sys
  File "/usr/lib/python3.11/site-packages/fail2ban/client/fail2banclient.py", line 39, in <module>
    from ..server.utils import Utils
  File "/usr/lib/python3.11/site-packages/fail2ban/server/utils.py", line 56, in <module>
    for name, num in signal.__dict__.iteritems() if name.startswith("SIG"))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'iteritems'

I tried to replace iteritems() by items() but i have zero knowledge in python and it did not solve the issue.


Does anyone have experienced this error and have a fix ?


EDIT:
by the way there is a small typo in paths-slackware.conf from the Slackbuild:

Code:


apache_error_log = /var/log/httpd/*error.log
apache_access_log = /var/log/httpd/*access.log

should be:

apache_error_log = /var/log/httpd/*error_log
apache_access_log = /var/log/httpd/*access_log


ponce 04-15-2024 08:22 AM

sorry, I'm getting old and my mind is getting clouded, but where do I have updated it (the version on SBo is 0.11.2)?

Eeel 04-15-2024 08:24 AM

Spend more time to it and found the fix here

Edited the fail2ban.Slackbuild

Quote:

find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

./fail2ban-2to3

python setup.py install --root=$PKG
There is a build deprecation notice but it start fine

Quote:

/usr/bin/2to3:3: DeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
from lib2to3.main import main
Quote:

# fail2ban-client --test
OK: configuration test is successful

Eeel 04-15-2024 08:26 AM

Quote:

Originally Posted by ponce (Post 6496100)
sorry, I'm getting old and my mind is getting clouded, but where do I have updated it (the version on SBo is 0.11.2)?

I edited the version inside the .slackbuild and luckily it worked fine for some time.


There is a version for 1.0.2 on Slackers.it that have the same error on startup

ponce 04-15-2024 09:06 AM

as it was abandoned on SBo I took maintainership and pushed an update to 1.0.2 switching there too to python3, thanks for the heads-up!

fourtysixandtwo 04-15-2024 09:13 AM

Quote:

Originally Posted by Eeel (Post 6496102)
Spend more time to it and found the fix here

Edited the fail2ban.Slackbuild

Code:

python setup.py install --root=$PKG
There is a build deprecation notice but it start fine

The version on SBo hasn't been updated since 2018 and is meant to be built for python2 so it's not surprising. You should takeover the slackbuild and update it to 1.0.2 on SBo and make sure to change the setup.py line above to python3. (note that on current /usr/bin/python -> python3.11 which adds to the issue you are having)

fourtysixandtwo 04-15-2024 09:16 AM

hah, didn't see your post ponce...so nevermind then! :)

Eeel 04-15-2024 12:13 PM

Quote:

Originally Posted by fourtysixandtwo (Post 6496111)
The version on SBo hasn't been updated since 2018 and is meant to be built for python2 so it's not surprising. You should takeover the slackbuild and update it to 1.0.2 on SBo and make sure to change the setup.py line above to python3. (note that on current /usr/bin/python -> python3.11 which adds to the issue you are having)

Didn't mention i was talking about the Ponce repo version for current.

Starts fine now, i will post here if i encounter error on use.

Thank you for the update.

fourtysixandtwo 04-15-2024 01:30 PM

Quote:

Originally Posted by Eeel (Post 6496143)
Didn't mention i was talking about the Ponce repo version for current.

Starts fine now, i will post here if i encounter error on use.

Thank you for the update.

I understood, but it doesn't matter in this case. The basic rule is that if a fix can be made in the SBo 15.0 repo, it should be made there first, if not then ponce will fix it in his current repo.

The evidence ;)
https://git.slackbuilds.org/slackbui.../ponce/updates

Eeel 04-15-2024 03:08 PM

Quote:

Originally Posted by fourtysixandtwo (Post 6496156)
I understood, but it doesn't matter in this case. The basic rule is that if a fix can be made in the SBo 15.0 repo, it should be made there first, if not then ponce will fix it in his current repo.

The evidence ;)
https://git.slackbuilds.org/slackbui.../ponce/updates

The version on slackbuilds.org works fine with 1.0.2, i only need to change the $VERSION parameter.

theodore.s 04-22-2024 07:18 AM

Doesn't work in 15.0.
 
Quote:

Originally Posted by ponce (Post 6496110)
as it was abandoned on SBo I took maintainership and pushed an update to 1.0.2 switching there too to python3, thanks for the heads-up!

Hi,

Thank you for taking over the abandoned package, but it looks that it doesn't work in 15.0. After upgrading, running fail2ban-client returns this:

Code:

ERROR: No module named configparser
2024-04-22 15:09:03,771 fail2ban                [12149]: ERROR  Init of command line failed

After installing ConfigParser from slackbuilds, returns this:

Code:

ERROR: type object 'SafeConfigParser' has no attribute '_interpolate_some'
2024-04-22 14:57:58,795 fail2ban                [10749]: ERROR  Init of command line failed

I am not familiar with python and I can't troubleshoot further. Any help?

ponce 04-22-2024 08:14 AM

sorry theodore, I made a little oversight: please change line 75 of the SlackBuild from
Code:

python setup.py install --root=$PKG
to
Code:

python3 setup.py install --root=$PKG

theodore.s 04-22-2024 08:21 AM

Fixed.
 
Quote:

Originally Posted by ponce (Post 6497672)
sorry theodore, I made a little oversight: please change line 75 of the SlackBuild from
Code:

python setup.py install --root=$PKG
to
Code:

python3 setup.py install --root=$PKG

Yes, that worked, thank you!

Now I have one more reason besides white space to not like python, the v2/v3 problems... :)


All times are GMT -5. The time now is 09:03 AM.