Configuring Sendmail
Operating System: OpenBSD 4.4
Sendmail is configured and enabled by default in OpenBSD, but it only allows you to send mail out from the machine itself (on localhost, as it should). These steps will allow you to relay from the server and set relay restrictions.
As root, make a copy of the original localhost config file to one of your own.
cp openbsd-localhost.mc openbsd-myconfig.mc
Open the file you just created and comment out the line:
by adding dnl to the the front to read
Then modify this line so that Sendmail will listen on all interfaces rather than just local:
to read...
Now compile the configuration that you created and make it the default Sendmail config:
Open /etc/mail/relay-domains and add IP addresses/ranges that are allowed to relay through the server. The format used is: 192.168.1 which is equivalent to 192.168.1.0/24. This will allow other hosts on your network to relay mail through this server.
Modify /etc/rc.conf and replace:
with...
This will tell the flags to use our newly created .cf file we compiled earlier. I usually change the q30m (which means keep things in the queue for 30 minutes) to q2d, keeping the queue active for 2 days before ditching it.
Do a clean reboot and make sure the correct configuration comes up. You can test access by using a server with the same subnet as in your "relay-domains" file and telnet-ing to port 25.
You can restart Sendmail quickly by killing the process first...
...and then restarting:
/usr/sbin/sendmail $sendmail_flags





