Menu

#5359 fail2ban redifine errors

1.940
open
nobody
None
5
2020-04-21
2020-02-22
M.T.R
No

Hi, Jamie,

lots of fail2ban redefine errors found in new system installed on debian10/webmion:

Subroutine parse_config_file redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 155.
Subroutine split_directive_values redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 205.
Subroutine create_section redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 226.
Subroutine modify_section redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 239.
Subroutine delete_section redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 250.
Subroutine section_lines redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 274.
Subroutine directive_lines redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 287.
Subroutine save_directive redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 300.
Subroutine find_value redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 403.
Subroutine find redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 410.
Subroutine filename_to_name redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 420.
Subroutine find_jail_by_filter redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 430.
Subroutine find_jail_by_action redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 446.
Subroutine start_fail2ban_server redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 465.
Subroutine stop_fail2ban_server redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 484.
Subroutine restart_fail2ban_server redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 502.
Subroutine list_all_config_files redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 510.
Subroutine lock_all_config_files redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 526.
Subroutine unlock_all_config_files redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 534.
Subroutine get_fail2ban_version redefined at /usr/share/webmin/fail2ban/fail2ban-lib.pl line 544.

Hope this helps

cheers mike

Discussion

  • Jamie Cameron

    Jamie Cameron - 2020-02-28

    Odd, I can't see what could cause that. Those warnings are harmless though.

     
  • M.T.R

    M.T.R - 2020-02-28

    these messages are flooding the log file.
    would be helpfull to fix this, please.

    i replaced in fail2ban.lib.pl
    "use strict" with "require strict"

    This suppresses the warnings and shows you where the problem is, I hope.

    Hope this helps.

    Cheers mike

     
  • David

    David - 2020-04-15

    I have this problem as well. I'm also seeing a ton o messages about bind8

    Subroutine create_defttl redefined at /usr/share/webmin/bind8/records-lib.pl line 388.
    Subroutine modify_defttl redefined at /usr/share/webmin/bind8/records-lib.pl line 398.
    Subroutine delete_defttl redefined at /usr/share/webmin/bind8/records-lib.pl line 408.

     
  • Ilia

    Ilia - 2020-04-15

    Do you run latest Webmin 1.942?

     
  • David

    David - 2020-04-15

    1.941 is the latest version Webmin told me about, and in fact, I upgraded to that this morning. If I comment out the "use warnings;" line in fail2ban-lib.pl, the warnings disappear.

    Also, there's a bug in the upgrade process regarding a missing dependency for a mime type module. I don't recall the exact dependency name but I've seen you comment on it previously, asking Jamie to add it to the install instructions, which it still has not.

    Unless he's made some change to how he's calling fail2ban-lib.pl, its subroutines will continue to get redefined with Perl throwing warnings all the time.

     

    Last edit: David 2020-04-15
  • Ilia

    Ilia - 2020-04-15

    By looking at the code quickly, it seems that fail2ban-lib.pl is getting included more than once, and this is why your getting those harmless errors.

    I think replacing do 'fail2ban-lib.pl'; with require './fail2ban-lib.pl'; shold solve the problem.

    There are only few file that need to be edited:

    /fail2ban/backup_config.pl
    /fail2ban/install_check.pl
    /fail2ban/log_parser.pl
    /fail2ban/syslog_logs.pl
    

    If you have a chance to give it a try and report back, you're more than welcome.

     
  • Ilia

    Ilia - 2020-04-15

    Don't do require './fail2ban-lib.pl'; just

    require 'fail2ban-lib.pl';
    
     
  • David

    David - 2020-04-16

    Is there some reason these corrections can't be rolled out in the production code? I really -hate- modifying any part of a package like this, as I'll have to continually make those patches each time a new version is rolled out.

     
  • Ilia

    Ilia - 2020-04-16

    Is there some reason these corrections can't be rolled out in the production code?

    Yes, it could. I needed to run some tests first but my assumptions were right. Thanks for pointing this out. However, it only happens with Perl 5.28+ (like Debian 10 or Fedora 31).

    Here is the fix.

     
  • David

    David - 2020-04-21

    Great! When do you think this wil be rolled out to production version or when will the next version be officially released?

     
  • Ilia

    Ilia - 2020-04-21

    We are all working on different parts. I have to finish the part with languages for all modules and I plan to do this by the end of this week. Afterwards, it will depend on Jamie to make new releases, and Joe to push changes to Virtualmin repos.

     

Log in to post a comment.