Notifications - Unhandled exception: sendmail returned with exit code: 1

#1

hi all,

I have since apt update & upgrade an issue with notifications, as site user I can send emails via sendmail but when Check_MK want use it I get below exception in the notify.log:

/omd/sites/xxxx/local/share/check_mk/notifications/mail
2019-07-07 11:33:01 Output: Unhandled exception: sendmail returned with exit code: 1
2019-07-07 11:33:01 Plugin exited with code 2

Does any one know why? Or any suggestions ?

Thanks in advance

Regards
Neeloj

(Philipp Näther) #2

Try to find the function “send_mail_sendmail” in the notify script in ~/share/check_mk/notifications.
There is the commandline defined. Add the “-d” switch to the commandline “/usr/sbin/sendmail” to run sendmail in debug mode and see if it logs something useful.

1 Like
#3

thanks for your answer @TheLucKy

when I add -d to the /usr/sbin/sendmail -d
in notify.log

2019-07-11 11:14:34 executing /omd/sites/xxx/local/share/check_mk/notifications/mail
2019-07-11 11:14:35 Output: Unable to fetch number of graphs: Unable to fetch graph infos:

XML file “/omd/sites/xxx/var/pnp4nagios/perfdata/localhost/Check_MK_Discovery.xml” not found. <a href=“http://docs.pnp4nagios.org/faq/6”>Read FAQ online</a>


2019-07-11 11:14:35 Output: Exim version 4.90_1 uid=999 gid=1001 pid=29185 D=fbb95cfd
2019-07-11 11:14:35 Output: Berkeley DB: Berkeley DB 5.3.28: (September 9, 2013)
2019-07-11 11:14:35 Output: Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open
2019-07-11 11:14:35 Output: Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
2019-07-11 11:14:35 Output: Authenticators: cram_md5 plaintext
2019-07-11 11:14:35 Output: Routers: accept dnslookup ipliteral manualroute queryprogram redirect
2019-07-11 11:14:35 Output: Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
2019-07-11 11:14:35 Output: Fixed never_users: 0
2019-07-11 11:14:35 Output: Configure owner: 0:0
2019-07-11 11:14:35 Output: Size of off_t: 8
2019-07-11 11:14:35 Output: Compiler: GCC [7.3.0]
2019-07-11 11:14:35 Output: Library version: Glibc: Compile: 2.27
2019-07-11 11:14:35 Output: Runtime: 2.27
2019-07-11 11:14:35 Output: Library version: GnuTLS: Compile: 3.5.18
2019-07-11 11:14:35 Output: Runtime: 3.5.18
2019-07-11 11:14:35 Output: Library version: PCRE: Compile: 8.39
2019-07-11 11:14:35 Output: Runtime: 8.39 2016-06-14
2019-07-11 11:14:35 Output: Total 13 lookups
2019-07-11 11:14:35 Output: WHITELIST_D_MACROS: “OUTGOING”
2019-07-11 11:14:35 Output: TRUSTED_CONFIG_LIST: “/etc/exim4/trusted_configs”
2019-07-11 11:14:35 Output: changed uid/gid: forcing real = effective
2019-07-11 11:14:35 Output: uid=0 gid=0 pid=29185
2019-07-11 11:14:35 Output: auxiliary group list:
2019-07-11 11:14:35 Output: seeking password data for user “uucp”: cache not available
2019-07-11 11:14:35 Output: getpwnam() succeeded uid=10 gid=10
2019-07-11 11:14:35 Output: configuration file is /var/lib/exim4/config.autogenerated
2019-07-11 11:14:35 Output: log selectors = 0000cffc 1c640402
2019-07-11 11:14:35 Output: /usr/sbin/sendmail -d -F myemail@example.com -f myemail@example.com -i myemail2@example.com,myemail3@example.com
2019-07-11 11:14:35 Output: exim: debugging permission denied
2019-07-11 11:14:35 Output: Unhandled exception: sendmail returned with exit code: 1
2019-07-11 11:14:35 Plugin exited with code 2

Output: exim: debugging permission denied but why I can send emails when I use sendmail as site user

(Philipp Näther) #4

Could you run some ls -l as I did in the following example please:
(your links might differ from what I have on my system)

[root@icinga: ~]# ll /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21  6. Jan 2015  /usr/sbin/sendmail -> /etc/alternatives/mta

[root@icinga: ~]# ll /etc/alternatives/mta
lrwxrwxrwx. 1 root root 27  6. Jan 2015  /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail

[root@icinga: ~]# ll /usr/sbin/sendmail.sendmail
-rwxr-sr-x. 1 root smmsp 833512 11. Nov 2010  /usr/sbin/sendmail.sendmail
1 Like
#5

Here you go :slight_smile:
root@parac:~# ll /usr/sbin/sendmail
-rwsr-sr-x 1 root root 1140200 Jul 8 13:38 /usr/sbin/sendmail*

root@parac:~# ll /etc/alternatives/mta
ls: cannot access ‘/etc/alternatives/mta’: No such file or directory

root@parac:~# ll /usr/sbin/sendmail.sendmail
ls: cannot access ‘/usr/sbin/sendmail.sendmail’: No such file or directory

(Philipp Näther) #6

Could you try to unset the setuid and setgid bit on the sendmail binary?

1 Like
#7

here:

root@parac:/usr/sbin# ll sendmail
-rwxr-sr-x 1 root root 1140200 Jul 8 13:38 sendmail*

Ill test that now…

Thanks for your help :slight_smile:

#8

root@parac:/usr/sbin# chmod g+s sendmail
root@parac:/usr/sbin# ll sendmail
-rwxr-sr-x 1 root root 1140200 Jul 8 13:38 sendmail*

I still get:

2019-07-16 08:21:48 Output: cwd=/ 9 args: /usr/sbin/sendmail -v -dd -F myemail@example.com -f ,myemail@example.com -i ,myemail2@example.com,myemail3@example.com
2019-07-16 08:21:48 Output: exim: debugging permission denied
2019-07-16 08:21:48 Output: Unhandled exception: sendmail returned with exit code: 1
2019-07-16 08:21:48 Plugin exited with code 2

When I send email as site user I get below error;

Data file name: /var/spool/exim4//input//1hnH2j-0001ja-VZ-D
LOG: MAIN PANIC DIE
Failed setting ownership on spool file /var/spool/exim4//input//1hnH2j-0001ja-VZ-D: Operation not permitted
2019-07-16 08:34:29 1hnH2j-0001ja-VZ Failed setting ownership on spool file /var/spool/exim4//input//1hnH2j-0001ja-VZ-D: Operation not permitted
2019-07-16 08:34:29 1hnH2j-0001ja-VZ Failed setting ownership on spool file /var/spool/exim4//input//1hnH2j-0001ja-VZ-D: Operation not permitted


Now when I set the permissions to
chmod +s and run the same command as site user I can send an email.

but Check_MK cannot send emails I still get

2019-07-16 08:21:48 Output: cwd=/ 9 args: /usr/sbin/sendmail -v -dd -F ,myemail@example.com -f myemail@example.com -i ,myemail2@example.com,myemail3@example.com
2019-07-16 08:21:48 Output: exim: debugging permission denied
2019-07-16 08:21:48 Output: Unhandled exception: sendmail returned with exit code: 1
2019-07-16 08:21:48 Plugin exited with code 2

is there anything else to check ?

(Philipp Näther) #9

Hm, I am running out of ideas. Did you set the notify log level to “full dump” in global settings? If not, maybe this will show something more.

1 Like
#10

I did that before but nothing new… I think my issue is with sendmail application and not Check_MK:
from notify:

2019-07-16 11:56:12 Preparing rule based notifications
2019-07-16 11:56:12 Found 0 user specific rules
2019-07-16 11:56:12 Global rule ‘Notify all contacts of a host/service via HTML email’…
2019-07-16 11:56:12 -> matches!
2019-07-16 11:56:12 - skipping contact testuser: he/she has disabled notifications
2019-07-16 11:56:12 - adding notification of cmkadmin via mail
2019-07-16 11:56:12 Executing 1 notifications:
2019-07-16 11:56:12 * notifying cmkadmin via mail, parameters: (no parameters), bulk: no
2019-07-16 11:56:12 executing /omd/sites/mysite/local/share/check_mk/notifications/mail
2019-07-16 11:56:12 Output: Exim version 4.90_1 uid=999 gid=1001 pid=35720 D=fbb95cfd
2019-07-16 11:56:12 Output: Berkeley DB: Berkeley DB 5.3.28: (September 9, 2013)
2019-07-16 11:56:12 Output: Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open
2019-07-16 11:56:12 Output: Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
2019-07-16 11:56:12 Output: Authenticators: cram_md5 plaintext
2019-07-16 11:56:12 Output: Routers: accept dnslookup ipliteral manualroute queryprogram redirect
2019-07-16 11:56:12 Output: Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
2019-07-16 11:56:12 Output: Fixed never_users: 0
2019-07-16 11:56:12 Output: Configure owner: 0:0
2019-07-16 11:56:12 Output: Size of off_t: 8
2019-07-16 11:56:12 Output: Compiler: GCC [7.3.0]
2019-07-16 11:56:12 Output: Library version: Glibc: Compile: 2.27
2019-07-16 11:56:12 Output: Runtime: 2.27
2019-07-16 11:56:12 Output: Library version: GnuTLS: Compile: 3.5.18
2019-07-16 11:56:12 Output: Runtime: 3.5.18
2019-07-16 11:56:12 Output: Library version: PCRE: Compile: 8.39
2019-07-16 11:56:12 Output: Runtime: 8.39 2016-06-14
2019-07-16 11:56:12 Output: Total 13 lookups
2019-07-16 11:56:12 Output: WHITELIST_D_MACROS: “OUTGOING”
2019-07-16 11:56:12 Output: TRUSTED_CONFIG_LIST: “/etc/exim4/trusted_configs”
2019-07-16 11:56:12 Output: changed uid/gid: forcing real = effective
2019-07-16 11:56:12 Output: uid=0 gid=0 pid=35720
2019-07-16 11:56:12 Output: auxiliary group list:
2019-07-16 11:56:12 Output: seeking password data for user “uucp”: cache not available
2019-07-16 11:56:12 Output: getpwnam() succeeded uid=10 gid=10
2019-07-16 11:56:12 Output: configuration file is /var/lib/exim4/config.autogenerated
2019-07-16 11:56:12 Output: log selectors = 0000cffc 1c640402
2019-07-16 11:56:12 Output: cwd=/ 9 args: /usr/sbin/sendmail -v -dd -F ,myemail@example.com -f myemail@example.com -i ,myemail2@example.com,myemail3@example.com
2019-07-16 11:56:12 Output: exim: debugging permission denied
2019-07-16 11:56:12 Output: Unhandled exception: sendmail returned with exit code: 1
2019-07-16 11:56:12 Plugin exited with code 2

thanks for your help

#11

solved, by reinstall exim4

1 Like