python updated now getting errors with fail2ban

Discussion in 'Installation/Configuration' started by conny2540, May 16, 2019.

  1. conny2540

    conny2540 Member

    I've updated the Ubuntu package to latest files in that package. Now I'm getting the following error for all clients on the server:

    2019-05-16 00:03:53,234 fail2ban.filter [12468]: ERROR Unable to open /var/www/clients/client1/web1/log/20190514-access.log
    2019-05-16 00:03:53,235 fail2ban.filter [12468]: ERROR [Errno 2] No such file or directory: '/var/www/clients/client1/web1/log/20190514-access.log'
    Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/fail2ban/server/", line 665, in getFailures
    has_content =
    File "/usr/lib/python3/dist-packages/fail2ban/server/", line 766, in open
    self.__handler = open(self.__filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/var/www/clients/client1/web1/log/20190514-access.log'

    How to debug this ? From what I know the access logs are on ISPCONFIG folders /var/log/ispconfig/.... and /var/log/apache2 and not where python3 is searching for them.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Which package? How was it updated? What was the old version and what is the new version?
    I doubt updating some package makes that log file disappear. Have you checked whether that file/directory exists or not?
    Besides, it is fail2ban error, probably nothing to do with python execpt that fail2ban is written in python. Check what you have in fail2ban setup for logpath, that may explain why fail2ban tries to read that logfile.
    Have you tried restarting fail2ban?
    systemctl restart  fail2ban.service 
  3. conny2540

    conny2540 Member

    Yes, I restarted fail2ban several times with other errors on filters (bad regex added by myself). So I turned all them back to original files.
    Package is Ubuntu 16.04. update with apt-get upgrade and apt-get dist-ugrade. Before upgrade python version was 2.7. now 3.
    Ispconfig version 3.1.13 patch 1. When I installed ISPCONFIG I installed also fail2ban. The version that time was 0.9. Now it is outdated (1.1). Could be this the problem ? Unfortunately fail2ban is not included in the ispconfig package, so it is a problem to maintain this as part. The same is for clamav package. To don't update the OS it's a security risk and why I'm updating the OS from time to time.
  4. conny2540

    conny2540 Member

    logpaths are:
    backend = auto
    logpath = %(apache_error_log)s
    and others.

    The only using access_log is the bad-bots
    enabled = true
    # Ban hosts which agent identifies spammer robots crawling the web
    # for email addresses. The mail outputs are buffered.
    port = http,https
    logpath = %(apache_access_log)s
    maxretry = 3

    enabled = true
    port = http,https
    filter = webexploits
    logpath = %(apache_access_log)s
    maxretry = 3

    And last one, but this is set to false
    enabled = false
    port = http,https
    logpath = %(apache_access_log)s
    maxretry = 1
    ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot <ip>
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Are you still with Ubuntu 16.04? Verify with
    lsb_release -a
    If you are still with Ubuntu 16.04 Xenial Xerus, python 2 is version 2.7. There is also python3 available, but merely running apt-get dist-upgrade does not change to python3. fail2ban uses python3, but that is also installed so nothing to worry about.
    What shows
    ls -lhR /var/www/clients/client1/web1/log/
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Also, what shows
    apt-cache policy fail2ban
  7. conny2540

    conny2540 Member

    1) Yes I'm on Ubuntu 16.04.
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.6 LTS
    Release: 16.04
    Codename: xenial

    -rw-r--r-- 1 xxxxx xxxx 517 May 16 00:03 20190514-access.log.gz
    -rw-r--r-- 1 xxxxx xxxx 1.2K May 15 19:42 20190515-access.log
    -rw-r--r-- 1 xxxxx xxxx 601 May 16 14:36 20190516-access.log
    lrwxrwxrwx 1 xxxxx xxxx 19 May 16 09:31 access.log -> 20190516-access.log

    Installed: 0.9.3-1
    Candidate: 0.9.3-1
    Version table:
    *** 0.9.3-1 500
    500 xenial/universe amd64 Packages
    500 xenial/universe i386 Packages
    100 /var/lib/dpkg/status
     python -V
    Python 2.7.12

    Strange that yesterday when I checked I saw somewhere python3...
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    There is python3 installed, but the name of the package is python3 and command is python3.
    type -a python3
    apt-cache policy python3
    Now that you finally did what I asked for in #2, namely
    you can see that file /var/www/clients/client1/web1/log/20190514-access.log does not exist. There is 20190514-access.log.gz but since it has .gz appended, file name is different.
  9. conny2540

    conny2540 Member

    1) I have /var/www/DOMAINS, ISPCONFIG, CLIENTS, HTML
    Folder /var/www/clients have than client 1, etc.... (so /var/www/clients/client1, etc) and than subfolders of each client for their domains hosted. Folder /var/www/clients/client1/web1/log is available ! and also the log files are there. So why the error ?
    /var/www/clients/client1/web1/log# dir
    20190504-access.log.gz 20190513-access.log.gz error.log.2.gz
    20190505-access.log.gz 20190514-access.log.gz error.log.3.gz
    20190506-access.log.gz 20190515-access.log error.log.4.gz
    20190507-access.log.gz 20190516-access.log error.log.5.gz
    20190508-access.log.gz access.log error.log.6.gz
    20190509-access.log.gz error.log error.log.7.gz
    20190510-access.log.gz error.log.10.gz error.log.8.gz
    20190511-access.log.gz error.log.11.gz error.log.9.gz
    20190512-access.log.gz error.log.1.gz yesterday-access.log

    2) python3 is /usr/bin/python3

    3) python3:
    Installed: 3.5.1-3
    Candidate: 3.5.1-3
    Version table:
    *** 3.5.1-3 500
    500 xenial/main amd64 Packages
    100 /var/lib/dpkg/status
    Last edited: May 16, 2019
  10. conny2540

    conny2540 Member

    Seems problem is solved. I rebooted the server. I don't know why all these mass error-logs, if all is OK. Seems that something has stucked during the upgrade process. Now no errors anymore. Thank you for your help Till. Next time I will reboot again instead of to only stop and restart services. This seems to be not enough when several upgrades were done at once.

Share This Page