modoboa / modoboa-installer

An installer for Modoboa
MIT License
255 stars 135 forks source link

Centos 7 modoboa 2y old - upgrade using script fails at fail2ban #483

Closed ionescu77 closed 1 year ago

ionescu77 commented 1 year ago

Impacted versions

Steps to reproduce

Full trace using --debug option or current behaviour

[root@hermes01 modoboa-installer]# sudo ./run.py --upgrade my-domain.com
Welcome to Modoboa installer!

Your mail server is about to be upgraded and the following components will be impacted:
modoboa automx amavis clamav dovecot nginx razor postfix postwhite spamassassin uwsgi radicale opendkim
Do you confirm? (Y/n) Y
The process can be long, feel free to take a coffee and come back later ;)
Starting...
Installing amavis
Installing spamassassin
Installing razor
Installing clamav
Installing fail2ban
Traceback (most recent call last):
  File "/usr/lib64/python3.6/configparser.py", line 846, in items
    d.update(self._sections[section])
KeyError: 'fail2ban'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./run.py", line 257, in <module>
    main(sys.argv[1:])
  File "./run.py", line 241, in main
    scripts.install(appname, config, args.upgrade, args.restore)
  File "/root/modoboa-installer/modoboa_installer/scripts/__init__.py", line 29, in install
    getattr(script, appname.capitalize())(config, upgrade, archive_path).run()
  File "/root/modoboa-installer/modoboa_installer/scripts/base.py", line 190, in run
    self.install_config_files()
  File "/root/modoboa-installer/modoboa_installer/scripts/base.py", line 146, in install_config_files
    context = self.get_template_context()
  File "/root/modoboa-installer/modoboa_installer/scripts/base.py", line 113, in get_template_context
    for option, value in self.config.items(self.appname):
  File "/usr/lib64/python3.6/configparser.py", line 849, in items
    raise NoSectionError(section)
configparser.NoSectionError: No section: 'fail2ban'

Video/Screenshot link (optional)

ionescu77 commented 1 year ago

Workaround

Conclusion

I must have used an older modoboa-installer version, which did not include the fail2ban setup section. I installed manually fail2ban and set my own jails for email (I have fail2ban on all my servers)

I'll try to investigate why the installer could not pick-up on the installed fail2ban version

ionescu77 commented 1 year ago

Closing notes

I might drop the upgrade thing, things seem to old.

I have checked the virtualenv in /srv and it looks like it's python2 πŸ˜„ 😒