Page 1 of 2
Inbound Email Configuration problem
Posted: Tue Apr 30, 2019 11:08 am
by stf_792
Hello,
NagiosXI 5.6 on CentOs 7.1 PHP 5.46
I am trying to configure inbound email under System Config-Email Settings. I put all values in (verified that nae and password work in browser), but when I click "Test Settings" I am getting
Code: Select all
Could not connect with the inbound settings given. Hide Details
Can't open mailbox {xxx.xxx.com:/imap}INBOX: invalid remote specification
Searching indicate possible problem with IMAP being enabled in PHP configuration.
I checked /etc/php.ini and did not find any mentioning of extensions. I do see imap.so and yum idicates that imap-php is installed.
Question:
How do I make inbound email work?
Thanks.
Re: Inbound Email Configuration problem
Posted: Tue Apr 30, 2019 3:01 pm
by npolovenko
Hello,
@stf_792. Can you run this command from the nagios server console and let me know if it fails or not?
/usr/local/nagios/libexec/check_email_delivery --mailto xxxxxxx --mailfrom xxxxxxx -H xx.xxx.xxx.xxx --smtp-server xx.xxx.xxx.xxx --smtp-username 'xxxxxxx' --smtp-password 'xxxxxxx ' --smtp-port 25 --imap-server xx.xxx.xxx.xxx --imap-username 'xxxxxxx' ---imap-password 'xxxxxxx ' --imap-port 143
Don't forget to replace all xxxx with the actual information.
Please upload: /var/log/maillog from the nagios server.
Re: Inbound Email Configuration problem
Posted: Tue Apr 30, 2019 3:11 pm
by jomann
The above post will check your connection settings, however I do believe that it's connecting properly. What email provider are you using and does the user that you are connecting with have a folder/mailbox called INBOX available? We don't do any polling for mailboxes, we currently only have it set up to use the INBOX mailbox and if one does not exist it will error. You should be able to create it if it doesn't exist though.
Re: Inbound Email Configuration problem
Posted: Tue Apr 30, 2019 4:21 pm
by stf_792
we are using our on-prem exchange server.
Sending is working fine, we can use 3rd party IMAP client to connect to mailbox.
please note that we trying to configure nagios xi 5.6 feature "acknowledge by email" by configuring inbound mail settings. php IMAP extension need to be enabled for that.
I do not think check_email_delivery applies in this case.
see screenshot
Re: Inbound Email Configuration problem
Posted: Wed May 01, 2019 10:31 am
by ssax
Please go to Admin > Manage Email Settings:
- Make sure Debug Log is checked
- Click the Update Settings button
Then edit this file:
Code: Select all
/usr/local/nagiosxi/html/includes/utils-email.inc.php
Change the
two imap_open lines in there from this:
Code: Select all
$conn = imap_open($conn_string."INBOX", $user, $pass);
To this:
Code: Select all
$conn = imap_open($conn_string."INBOX", $user, $pass, 0, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
Then change this line (around line 350):
To this:
Then run this tail command (and leave it running):
Code: Select all
tail -F /var/log/maillog /usr/local/nagiosxi/tmp/phpmailer.log /usr/local/nagiosxi/var/eventman.log /var/log/httpd/error_log /var/log/httpd/ssl_error_log
Then try it again and send us the full output from the screen and from the tail command above.
Thank you!
Re: Inbound Email Configuration problem
Posted: Wed May 01, 2019 10:48 am
by stf_792
here it is
Code: Select all
/var/log/httpd/error_log <==
[Wed May 01 10:42:43.756071 2019] [:error] [pid 5530] [client xx.xx.xx.xx:52934] PHP Warning: imap_open(): Couldn't open stream {mycasserver.mydomain.com:/imap/debug}INBOX in /usr/local/nagiosxi/html/includes/utils-email.inc.php on line 269, referer: http://myservername.mydomain.com/nagiosxi/admin/mailsettings.php
Re: Inbound Email Configuration problem
Posted: Wed May 01, 2019 4:54 pm
by tgriep
Edit the /usr/local/nagiosxi/html/includes/utils-email.inc.php file again and change this back, to the original setting.
Save the file and edit this file
Around line 589 you should see this line
Code: Select all
$msg_lines_count = count($msg_lines);
Add these lines below that line
Code: Select all
echo "msg_end: " . $msg_end;
echo "\nmsg_lines_count: " . $msg_lines_count;
echo "\nmsg_lines: " . var_dump($msg_lines);
echo "\nmsg: " . $msg;
Save the file.
Reply to an Notification with a valid command.
Check the /usr/local/nagiosxi/var/cleaner.log file for any errors when the system checks the inbound email account.
Re: Inbound Email Configuration problem
Posted: Wed May 01, 2019 7:03 pm
by stf_792
I updated to 5.61 - same error.
After taking 20th look, I relaized that IMAP port number need to be typed in, it looks like it prepopulated to 143, but it not.
After typing the port number and testing, error changed to
Code: Select all
SECURITY PROBLEM: insecure server advertised AUTH=PLAIN
Can not authenticate to IMAP server: AUTHENTICATE failed.
Since we only allow IMAP internally for selected mailboxes, I am not using any encryption for IMAP login. It is set to none.
I know that username and password are good - I can login to mailbox on other non-nagios applications.
I tried the following combinations for username:
domain\username
username
username@domain
Same error.
Is Nagios by default disables any plain text authentication?
SOLVED: Re: Inbound Email Configuration problem
Posted: Thu May 02, 2019 9:11 am
by stf_792
As I mentioned earlier, IMAP port was the 1st problem. Port Hint looks like port already entered, while it was blank
The second problem was "!" character in mailbox password. "!" used as delimiter in Nagios, so after password change it stop giving Authentication errors.
However,
Code: Select all
SECURITY PROBLEM: insecure server advertised AUTH=PLAIN
message still remaining. Hopefully it will be suppressed on next build.
Re: Inbound Email Configuration problem
Posted: Thu May 02, 2019 11:00 am
by tgriep
Thanks for letting is know about the Port Hint causing issues. I put in a request to get that changed to be blank.
The message
SECURITY PROBLEM: insecure server advertised AUTH=PLAIN
May not be so easily to remove. What that I read, it is nor really an error, it is just a warning that you are using PLAIN text authentication.
You should only see that message when testing the InBox connection.
I just want to verify, after all of the changes, it is working for you now?