2011-01-28

FreeBSD - How to make changes to sendmail, FreeBSD styled

Sendmail is the default MTA in FreeBSD. FreeBSD has its own way in managing sendmail's configuration files. Instead of making changes to sendmail.mc, changes should be made to $(hostname).mc. Similarly for submit.mc, changes should be $(hostname).submit.mc.

Here's how :





Preparation for the first time

Before making changes to Sendmail for the first time, prepare the config files in /etc/mail:
cd /etc/mail
make
This will copy the freebsd.mc to $(hostname).mc and freebsd.submit.mc to $(hostname).submit.mc then generate the .cf files.

Subsequently

The previous step is only needed for the very first time before changing config files. Now, every time when changes are made to Sendmail config files, do the following :
  1. Edit hostname.mc or hostname.submit.mc
  2. Generate the necessary .cf files:
    make install
  3. Restart the Sendmail daemon :
    make restart

In fact, there are more options to manage Sendmail :
# The user-driven targets are:
#
# all - Build cf, maps and aliases
# cf - Build the .cf file from .mc file
# maps - Build the feature maps
# aliases - Build the sendmail aliases
# install - Install the .cf file as /etc/mail/sendmail.cf
#
# For acting on both the MTA daemon and MSP queue running daemon:
# start - Start both the sendmail MTA daemon and MSP queue running
# daemon with the flags defined in /etc/defaults/rc.conf or
# /etc/rc.conf
# stop - Stop both the sendmail MTA daemon and MSP queue running
# daemon
# restart - Restart both the sendmail MTA daemon and MSP queue running
# daemon
#
# For acting on just the MTA daemon:
# start-mta - Start the sendmail MTA daemon with the flags defined in
# /etc/defaults/rc.conf or /etc/rc.conf
# stop-mta - Stop the sendmail MTA daemon
# restart-mta - Restart the sendmail MTA daemon
#
# For acting on just the MSP queue running daemon:
# start-mspq - Start the sendmail MSP queue running daemon with the
# flags defined in /etc/defaults/rc.conf or /etc/rc.conf
# stop-mspq - Stop the sendmail MSP queue running daemon
# restart-mspq - Restart the sendmail MSP queue running daemon
#
# Calling `make' will generate the updated versions when either the
# aliases or one of the map files were changed.
#
# A `make install` is only necessary after modifying the .mc file. In
# this case one would normally also call `make restart' to allow the
# running sendmail to pick up the changes as well.
These options are taken from /etc/mail/Makefile. Take a look at it.

Ciao !!!

No comments: