Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acknowledgement comments with newlines break emails using default notify scripts. #7510

Closed
BuildTheRobots opened this issue Sep 18, 2019 · 8 comments · Fixed by #10061
Closed
Labels
area/notifications Notification events area/setup Installation, systemd, sample files bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@BuildTheRobots
Copy link

Describe the bug

Acknowledging a service or host problem with a comment containing a newline causes the notification email to be blank with an unnamed attachment.

If the comment contains a newline, the email seems to be encoded as base64 which breaks rendering in thunderbird, evolution and also iPhone. On the desktop it's possible to download the attachment and view in a text editor, however on iphone I'm not able to view the attachment so is impossible to read the ACK message.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Acknowledge a host or service problem with a comment and select send notification
  2. If the message does not contain newlines then it is displayed in email clients as text.
  3. If the message does contain a newline then the email client shows a blank message with an attachment.
    Evolution calls the attachment "attachment.dat", thunderbird shows it as an unnamed file. iPhone shows it as "mime-attachment".

Expected behaviour

Contents of the message to be part of the email body text (as it does when there's no newlines).

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • Icinga Web 2 version and modules (System - About):
    Icinga Web 2 Version: 2.7.1
    Git commit
    b0bf9c4b0637f6113adb788e78c2bcf619225dd8
    PHP Version
    7.1.8```
  • Web browser used: Firefox 69
  • Icinga 2 version used (icinga2 --version): r2.10.5-1
  • Server operating system and version:
    Centos 7 64bit (latest).
    user-agent: Heirloom mailx 12.5 7/5/10

Additional context

debug logs

No newline:

[2019-09-18 14:59:37 +0100] notice/Process: Running command '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '192.168.17.198' '-6' '' '-b' 'icingauser' '-c' 'host problem - no newline.' '-d' '2019-09-18 14:59:37 +0100' '-f' 'Icinga <icinga@mydomain.com>' '-l' 'df-testhost' '-n' 'df-testhost' '-o' 'CRITICAL - Plugin timed out' '-r' 'user@mydomain.com' '-s' 'DOWN' '-t' 'ACKNOWLEDGEMENT' '-v' 'false': PID 13656

With newline:

[2019-09-18 14:50:44 +0100] notice/Process: Running command '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '192.168.17.198' '-6' '' '-b' 'icingauser' '-c' 'host problem\r\nwith newline' '-d' '2019-09-18 14:50:44 +0100' '-f' 'Icinga <icinga@mydomain.com>' '-l' 'df-testhost' '-n' 'df-testhost' '-o' 'CRITICAL - Plugin timed out' '-r' 'user@mydomain.com' '-s' 'DOWN' '-t' 'ACKNOWLEDGEMENT' '-v' 'false': PID 29353

Email source

No newline:

To: user@mydomain.com
Subject: [ACKNOWLEDGEMENT] Current Load on df-testhost is
 CRITICAL!
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

***** Service Monitoring on icinga.mydomain.com *****

Current Load on df-testhost is CRITICAL!

Info:    connect to address 192.168.17.198 port 5666: Connection refuse=
d
connect to host 192.168.xx.xx port 5666: Connection refused

When:    2019-09-18 14:05:00 +0100
Service: Current Load
Host:    df-testhost
IPv4:    192.168.xx.x

Comment by icingauser:
  this is also an ack!=

with newline:

To: user@mydomain.com
Subject: [ACKNOWLEDGEMENT] ntp on df-testhost is CRITICAL!
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

KioqKiogU2VydmljZSBNb25pdG9yaW5nIG9uIGljaW5nYS5teWRvbWFpbi5jb20gKioqKioKCm50
cCBvbiBkZi10ZXN0aG9zdCBpcyBDUklUSUNBTCEKCkluZm86ICAgIGNvbm5lY3QgdG8gYWRkcmVz
cyAxOTIuMTY4Lnh4Lnh4IHBvcnQgNTY2NjogQ29ubmVjdGlvbiByZWZ1c2VkCmNvbm5lY3QgdG8g
aG9zdCAxOTIuMTY4Lnh4Lnh4IHBvcnQgNTY2NjogQ29ubmVjdGlvbiByZWZ1c2VkCgpXaGVuOiAg
ICAyMDE5LTA5LTE4IDE0OjA1OjEyICswMTAwClNlcnZpY2U6IG50cApIb3N0OiAgICBkZi10ZXN0
aG9zdApJUHY0OiAgICAxOTIuMTY4Lnh4Lnh4CgpDb21tZW50IGJ5IGljaW5nYXVzZXI6CiAgYW5k
IHRoaXMsIG9uY2UgYWdhaW4sIGlzIGFuIGFjay4KdGhpcyB0aW1lIHdpdGggYSBuZXdsaW5l

Hopefully my attempts to redact the information haven't caused any confusion

@dnsmichi dnsmichi transferred this issue from Icinga/icingaweb2 Sep 19, 2019
@dnsmichi dnsmichi added area/notifications Notification events area/setup Installation, systemd, sample files labels Sep 19, 2019
@dnsmichi
Copy link
Contributor

Thanks, we'll look into this after 2.11 has been released.

@dnsmichi dnsmichi self-assigned this Sep 19, 2019
@dgoetz
Copy link
Contributor

dgoetz commented Sep 19, 2019

We had similar problems with non-us-ascii characters and there are solutions tested in #6369. Can you @BuildTheRobots have a look into this and test if this also solves your problem? If so it would be a good reason to move this approach forward.

@BuildTheRobots
Copy link
Author

BuildTheRobots commented Sep 19, 2019

I've tested with the new mail-host-noficiation.sh script as linked in #6369 and it seems to make the situation significantly worse.

The standard host down notifications now include half the headers inside the email body (though all in ascii) and the multi-line ack now has ascii headers and a base64 encoded blob.

This is still on centos-7. The only change made is swapping out the host notify script.

Screenshots are from thunderbird, same display issues in Evolution and on iPhone.

icinga-hostdown

icinga-notification

@robert-scheck
Copy link
Contributor

From what I understand the reporter uses Icinga 2.10.5, while 2.11.0 got my fix #7184, which should address the reported issue. Further on the reporter refers to the body while #6369 refers to the headers. My suggestion would be to test my fix from #7184 on 2.10.5 as it's supposed to address it.

@BuildTheRobots
Copy link
Author

I'll be back in the office middle of next week and will test the fix in #7184 then. Thank you :)

@dnsmichi dnsmichi added the needs feedback We'll only proceed once we hear from you again label Sep 20, 2019
@dnsmichi dnsmichi removed their assignment Sep 20, 2019
@BuildTheRobots
Copy link
Author

Can confirm that the updated scripts in #7184 (which also seem to have mainlined into centos) seem to have fixed the newline issue.
Greatest of thanks :)

@dnsmichi dnsmichi removed the needs feedback We'll only proceed once we hear from you again label Sep 24, 2019
@sircubbi
Copy link

Unfortunately the bugfix got reverted in c783448 and the issue reappears on recent versions.

@julianbrost julianbrost reopened this Oct 19, 2021
@Al2Klimov Al2Klimov added the bug Something isn't working label Oct 26, 2021
@Al2Klimov
Copy link
Member

Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/notifications Notification events area/setup Installation, systemd, sample files bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants