Next Previous Contents

6. The local mailer daemon

6.1 Enabling alias files

This document only describes modifying sendmail. Many people prefer qmail.

Out of the box, sendmail does not come with the "pipe to program" feature enabled. Rightly so, this feature is a security risk. It enambles users to have their mail fed to a program instead of appended to a file. (Users can configure this in thier .forward file.)

Please don't believe me. Test your own system first. Much of this chapter might not be needed by you.

6.2 Documentation

IMHO, sendmail installs with woefully insufficient documentation.

http://www.sendmail.org/ ca/email/doc/op-sh-5.html describes the syntax of sendmail.cf. I hope you don't have to use it.

This is a description of the features you are trashing in sendmail.mc http://www.sendmail.org/m4/features.html

Sendmail has a man page...

man sendmail

6.3 Recompiling your sendmail.cf file

To get the "pipe to program" stuff in the aliases file to work you need to modify the default sendmail.cf (by modifying the sendmail.mc) so that the restricted shell is not used. I suppose the proper solution would be to add the one program to the restricted shell list, but their was no man page on smrsh. Strangely, uncommenting the smrsh feature didn't work, I needed to change the shell from /usr/sbin/smrsh to /bin/bash. Yeah, this is slightly risky, but it was not an issue on my machine. Without this change I kept getting a "Service unavailable" error message in the /var/log/maillog file.

The header of /etc/senmail.mc of RedHat-6 has a bug. The proper command line is...

m4 /etc/sendmail.mc >/etc/sendmail.cf
You need to do this when you change sendmail.mc. Hopefully, RedHat will extend the super cool Makefile idea in /etc/mail You will need to install sendmail-cf.something.rpm first. e.g. ...
rpm -i sendmail-cf-8.9.3-10.i386.rpm 

Whenever you modify the sendmail.cf file, you should restart sendmail...

/etc/rc.d/init.d/sendmail restart

6.4 Creating a mail alias

Instead of creating a new user account, we will only create an alias.

When modifying the /etc/aliases file, the double quotes are required. There cannot be a space between the first double quotes and the | (pipe) character, or sendmail will complain "User unknown"

Add a line like ...

confctrl:   "| /usr/local/bin/mail2news.pl ietf.confctrl "

Whenever you modify the /etc/aliases file you need to notify sendmail.

sendmail -bi

6.5 Did it work?

Check the /var/log/maillog to see if it worked, or for error messages. I found it useful to open up another terminal (ssh) window to watch the log with

tail -f /var/log/maillog

6.6 Unprivledged

If you are having trouble, and create an e-mail alias with a different (simpler) target program to test it, remember that sendmail runs the program as an unprivledged user, who probably doesn't have privledges to write anywhere except globally writable directories such as /tmp.


Next Previous Contents