Postfix for smartd and mdadm
If you are using mdadm and smartd to monitor your hdd and raid, you probably want to be informed if they find any errors or so. So there is postfix which can send mails via sendmail to your e-mail address. It is quite useful to get one of a free webmail service. Would be better to encrypt them though.
First of all, you will need to install postfix (this one is for arch linux, the configuration is the same for ubuntu).
# pacman -S postfix
Now you need to edit the main.cf file, to configure postfix.
# sets gmail as relay
relayhost = [smtp.gmail.com]:587
# use tls
# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes
# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
# eliminates default security options which are incompatible with gmail
Next thing to do is to give your credentials in a postfix readable form. So write them into /etc/postfix/sasl_passwd:
With it gets into a .db file:
# postmap /etc/postfix/sasl_passwd
After a (re-)start of the postfix deamon:
# rc.d start postfix
you can check via:
# echo ‘hello world!’ | mail -s ‘first email’ firstname.lastname@example.org
if it worked.
After that bit is done, you can configure the other deamons to work with your e-mail address. For mdadm you have to add in your /etc/mdadm/mdadm.conf the
option. There can only be one. With
# mdadm –monitor –scan –test
You can check if the mail will be delivered. Now be sure that the demon runs on startup with your pc.
For smartd you need to modify the /etc/smartd.conf like:
DEVICESCAN -a -n standby,15,q -m email@example.com -M test
If you (re-)start the daemon, you will get a test mail, so after it worked, just delete ‘-M test’ in the config. After -n are options to prevent the disks from idling for a test.