Sample Header Ad - 728x90

How to configure smartd, s-nail and selinux to get sending mails to work?

2 votes
0 answers
270 views
I am trying to configure smartd to send mails via s-nail on Fedora 41. I created a .mailrc file (in which I have set the mta variable to directly send via smtps, there is no sendmail installed) in roots home directory and can successfully send mails via: echo "Test" | mail -s Test I also managed to send mails in a bash script started by a custom systemd service. But smartd isn't able to send mails. The following error is shown in the log: Executing test of /usr/libexec/smartmontools/smartdnotify to ... Test of /usr/libexec/smartmontools/smartdnotify to produced unexpected output (163 bytes) to STDOUT/STDERR: s-nail: Cannot start /usr/sbin/sendmail: executable not found (adjust *mta* variable) s-nail: Cannot save to $DEAD: Permission denied s-nail: ... message not sent Selinux is blocking the access to the .mailrc file (therefore s-nail is trying /usr/sbin/sendmail as a default fallback): type=AVC msg=audit(1744370186.375:606): avc: denied { read } for pid=42644 comm="mail" name=".mailrc" dev="nvme0n1p3" ino=140324 scontext=system_u:system_r:smartdwarn_t:s0 tcontext=unconfined_u:object_r:mail_home_t:s0 tclass=file permissive=0 I tried the suggested ausearch -c 'mail' --raw | audit2allow -M my-mail semodule -X 300 -i my-mail.pp systemctl restart smartd.service a couple of times until no new selinux errors appeared. Now I get the following error: Test of /usr/libexec/smartmontools/smartdnotify to produced unexpected output (130 bytes) to STDOUT/STDERR: s-nail: could not initiate TLS connection: error:00000000:lib(0)::reason(0) /root/dead.letter 23/578 s-nail: ... message not sent s-nail now can access the .mailrc file and can connect to the server. But no successfull communication with the server (Error 0 ?). The content of the mail is written to the dead.letter file instead. What could be the reason for this? Is it an improper selinux config? Am I missing an selinux option? Do I have to switch mta client?
Asked by AckderIII (21 rep)
Apr 10, 2025, 09:17 PM
Last activity: Apr 11, 2025, 11:55 AM