OpenMediaVault-Plugin-Developers/openmediavault-fail2ban

weird formatting in update log

rabelux opened this issue · 12 comments

I just updated via webgui and the output looks kinda weird. see attached log.
I tried to find where in this repo these strings are configured but didn't find a location.
As this is the only plugin where i noticed this issue I guess it has to be this repo where it has to be fixed.
@ryecoaaron do you know how/where this is generated?

�[0;32mraspberrypi:�[0;0m
�[0;32m----------�[0;0m
    �[0;32m      ID: remove_default_fail2ban_config�[0;0m
    �[0;32mFunction: file.absent�[0;0m
    �[0;32m    Name: /etc/fail2ban/jail.d/defaults-debian.conf�[0;0m
    �[0;32m  Result: True�[0;0m
    �[0;32m Comment: File /etc/fail2ban/jail.d/defaults-debian.conf is not present�[0;0m
    �[0;32m Started: 02:13:50.191689�[0;0m
    �[0;32mDuration: 2.535 ms�[0;0m
�[0;32m     Changes:   �[0;0m
�[0;32m----------�[0;0m
    �[0;32m      ID: configure_fail2ban�[0;0m
    �[0;32mFunction: file.managed�[0;0m
    �[0;32m    Name: /etc/fail2ban/jail.conf�[0;0m
    �[0;32m  Result: True�[0;0m
    �[0;32m Comment: File /etc/fail2ban/jail.conf is in the correct state�[0;0m
    �[0;32m Started: 02:13:50.194539�[0;0m
    �[0;32mDuration: 130.704 ms�[0;0m
�[0;32m     Changes:   �[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: remove_jail_conf_files�[0;0m
    �[0;36mFunction: module.run�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: file.find: ['/etc/fail2ban/jail.d/openmediavault-36b96e6c-9187-4b93-b0c6-05c6d3e29dc3.conf', '/etc/fail2ban/jail.d/openmediavault-4e3a2d25-326c-4dc8-bc05-22f303a62b75.conf.disabled', '/etc/fail2ban/jail.d/openmediavault-59650e01-5e07-4076-9b15-ce352f4b4356.conf', '/etc/fail2ban/jail.d/openmediavault-5f2b2d25-726c-5dc8-ac05-79f303a62b35.conf.disabled', '/etc/fail2ban/jail.d/openmediavault-645ae684-0950-4fcf-92fc-eba1b88775b1.conf.disabled', '/etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b21.conf.disabled', '/etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b60.conf.disabled', '/etc/fail2ban/jail.d/openmediavault-7e9a7d35-326c-4dc8-bc05-35f308a62b78.conf.disabled']�[0;0m
    �[0;36m Started: 02:13:50.328084�[0;0m
    �[0;36mDuration: 4.777 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mfile.find�[0;0m:
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-36b96e6c-9187-4b93-b0c6-05c6d3e29dc3.conf�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-4e3a2d25-326c-4dc8-bc05-22f303a62b75.conf.disabled�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-59650e01-5e07-4076-9b15-ce352f4b4356.conf�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-5f2b2d25-726c-5dc8-ac05-79f303a62b35.conf.disabled�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-645ae684-0950-4fcf-92fc-eba1b88775b1.conf.disabled�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b21.conf.disabled�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b60.conf.disabled�[0;0m
                  �[0;32m- /etc/fail2ban/jail.d/openmediavault-7e9a7d35-326c-4dc8-bc05-35f308a62b78.conf.disabled�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_36b96e6c-9187-4b93-b0c6-05c6d3e29dc3�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-36b96e6c-9187-4b93-b0c6-05c6d3e29dc3.conf�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-36b96e6c-9187-4b93-b0c6-05c6d3e29dc3.conf updated�[0;0m
    �[0;36m Started: 02:13:50.333235�[0;0m
    �[0;36mDuration: 27.318 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_59650e01-5e07-4076-9b15-ce352f4b4356�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-59650e01-5e07-4076-9b15-ce352f4b4356.conf�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-59650e01-5e07-4076-9b15-ce352f4b4356.conf updated�[0;0m
    �[0;36m Started: 02:13:50.360870�[0;0m
    �[0;36mDuration: 17.666 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_645ae684-0950-4fcf-92fc-eba1b88775b1�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-645ae684-0950-4fcf-92fc-eba1b88775b1.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-645ae684-0950-4fcf-92fc-eba1b88775b1.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.378856�[0;0m
    �[0;36mDuration: 17.546 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_6e3a7d25-326c-4dc8-bc05-63f303a62b60�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b60.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b60.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.396721�[0;0m
    �[0;36mDuration: 17.547 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_6e3a7d25-326c-4dc8-bc05-63f303a62b21�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b21.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-6e3a7d25-326c-4dc8-bc05-63f303a62b21.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.414587�[0;0m
    �[0;36mDuration: 18.207 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_7e9a7d35-326c-4dc8-bc05-35f308a62b78�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-7e9a7d35-326c-4dc8-bc05-35f308a62b78.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-7e9a7d35-326c-4dc8-bc05-35f308a62b78.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.433172�[0;0m
    �[0;36mDuration: 17.592 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_4e3a2d25-326c-4dc8-bc05-22f303a62b75�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-4e3a2d25-326c-4dc8-bc05-22f303a62b75.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-4e3a2d25-326c-4dc8-bc05-22f303a62b75.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.451080�[0;0m
    �[0;36mDuration: 17.742 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: configure_fail2ban_jail_5f2b2d25-726c-5dc8-ac05-79f303a62b35�[0;0m
    �[0;36mFunction: file.managed�[0;0m
    �[0;36m    Name: /etc/fail2ban/jail.d/openmediavault-5f2b2d25-726c-5dc8-ac05-79f303a62b35.conf.disabled�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: File /etc/fail2ban/jail.d/openmediavault-5f2b2d25-726c-5dc8-ac05-79f303a62b35.conf.disabled updated�[0;0m
    �[0;36m Started: 02:13:50.469195�[0;0m
    �[0;36mDuration: 17.981 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mdiff�[0;0m:
                  �[0;32mNew file�[0;0m
              �[0;36mmode�[0;0m:
                  �[0;32m0644�[0;0m�[0;0m
�[0;36m----------�[0;0m
    �[0;36m      ID: start_fail2ban_service�[0;0m
    �[0;36mFunction: service.running�[0;0m
    �[0;36m    Name: fail2ban�[0;0m
    �[0;36m  Result: True�[0;0m
    �[0;36m Comment: Service restarted�[0;0m
    �[0;36m Started: 02:13:50.623599�[0;0m
    �[0;36mDuration: 4137.358 ms�[0;0m
�[0;36m     Changes:   
              �[0;36m----------�[0;0m
              �[0;36mfail2ban�[0;0m:
                  �[0;1;33mTrue�[0;0m�[0;0m
�[0;36m
Summary for raspberrypi
-------------�[0;0m
�[0;32mSucceeded: 12�[0;0m (�[0;32mchanged=10�[0;0m)
�[0;36mFailed:     0�[0;0m
�[0;36m-------------
Total states run:     12�[0;0m
�[0;36mTotal run time:    4.427 s�[0;0m

Those weird symbols are what normally colorizes the output. Not sure why they are showing up in the web interface. I will have to try it when I get a chance. Not sure there is anything the plugin can do about it though.

Agree, it's probably OMV that should ignore it. When checking logs in the web interface it also shows these symbols:

grafik

viewing the logfile in terminal looks good though an contains the mentioned colouring:

grafik

According to https://github.com/OpenMediaVault-Plugin-Developers/openmediavault-fail2ban/blob/master/usr/share/openmediavault/engined/inc/90fail2ban.inc#L25 the content comes directly from the log file. If those characters are in the file, why should OMV filter them?

If you like to get it filtered you could try to use journalctl like this here. Maybe SYSTEMD_COLORS=0 will do the job. If it works you're welcome to open a PR that will fix it.

@ryecoaaron If you call salt-call somewhere in the code you can use --no-color to suppress the color output. Maybe openmediavault/openmediavault@71bd988 will help you, too.

@votdev None of the plugins use salt-call. So, we should be ok there. I remember the colors causing issues. I just need to look at how fail2ban logs now.

thanks guys for looking into this

I don't see any way to get fail2ban to not log in color to its log file though.

I don't see any way to get fail2ban to not log in color to its log file though.

Where or what is creating this content? It looks like output from Salt. Is it `omv-salt?

@votdev /usr/bin/fail2ban-server logs to the /var/log/fail2ban.log file. There is no argument to remove the colorization.

Closing due to age.