Created Friday 18/12/1998
The only disadvantage is that some versions of sendmail will only load the aliases on sendmail startup
BSD sendmail(1) can be reconfigured to read any mail you want simply by recompiling /etc/mail/aliases.db. It is typically best not to arrouse suspicion when doing this, as otherwise any sysadmin worth their salt will simply re-recompile the aliases, thereby nuking your definitions. Perhaps the best approach is the clandestine one, where mail aliases are simply re-directions to yourself and the original receipient, like so:
user_of_interest: user_of_interest, me
This type of alias simply sends a copy of the mail to the original recipient and user me. The sendmail aliases are contained in a binary file and so recompiling them from (any old) text file will re-compile the binary file /etc/mail/aliases.db. The date and size will change. It is possible that a sysadmin is running some sort of notification program for file changes (e.g., tripwire or similar).
Assuming that you've edited the aliases to do whatever nasty thing you want (say in /tmp/aliases - this can be copied from /etc/mail/aliases). Be sure not to specify the -C option, which is used to specify a different location of sendmail.cf as you won't be able to recompile /etc/mail/aliases.db if you do (sendmail won't run as root). The sendmail options -bi instruct sendmail to run as the program newaliases(1) and the -o option with the alias directive tells sendmail to use the alias file definitions in the location specified on the rhs of the directive. E.g., the command
bash $ /usr/sbin/sendmail -bi setalias -o AliasFile=/tmp/aliases
Will recompile the sendmail aliases database from the text file /tmp/aliases
The sendmail instance can be used to relay to another mail host. This is done by configuring the smart relay host in /etc/mail/sendmail.cf. For example, to forward all mail to host mail-relay.foo.com, add the line
DSmail-relay.foo.com
Many linux distributions like Fedora Core use m4(1) to regenerate /etc/mail/sendmail.cf. The sendmail configuration is created from /etc/mail/sendmail.mc which is the m4 configuration and is used to create /etc/mail/sendmail.cf. All changes should be made to the m4 configuration file. Recompilation is done with the command:
bash # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
create /etc/mail/auth/client-info with auth tokens compile auth info to binary to create /etc/mail/auth/client-info.db Add new 'feature' in sendmail m4 config to refer to auth db. FEATURE(`authinfo', `hash /etc/mail/auth/client-info')dnl regenerate sendmail.cf from m4 config: ''' m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf '''
Stuart Moorfoot © 18 Dec 1998 foo@bund.com.au