A feature in the sendmail.cf configuration file for UnixWare 7 can be used to screen mail in order to verfify the envelope-sender address and reject email from sites that are known to be sources of spam.
This feature uses the sendmail check_mail ruleset to implement a check during the SMTP dialogue. The MAIL command in SMTP specifies the envelope sender's address:
MAIL From: <sender@host.domain>The check_mail ruleset is called immediately after the MAIL command is read, and is passed the sender's address. The check_mail ruleset does the following verification:
451 Domain must resolveBy default, this feature is disabled in sendmail.cf, which must be hand-altered to enable it. To enable check_mail, set the Check_Mail macro to a non-null value by changing the following line in sendmail.cf:
D{Check_Mail}
to the following:
D{Check_Mail} ON
To create a list of known spam sites from which mail is rejected, create the file /etc/mail/table/spammers, containing entries of the form:
hostname rejection message ip_address rejection messageThe left hand side specifies either the hostname or the IP address of the site from which the system refuses mail. The right hand side specifies a message to be sent to the original sender. This error message is also entered into the system log file. The left and right sides are separated by the <Tab> character.
For example, if you wish to reject all mail from hostname iam.aknown.spammer.com, you could add the following entry to /etc/mail/table/spammers:
iam.aknown.spammer.com Mail rejected, please contact postmaster@my.domain.comIf you want to reject mail from an IP number, an example entry might be:
132.147.193.96 Mail rejected, contact postmaster@my.domain.comYou can also use an asterisk (*) wildcard to match an entire domain or IP address range. For example:
*.spammer.com Mail rejected 132.147.193.* Mail rejectedWhen specifying wildcards for IP addresses, you must use an asterisk for each portion of the dotted quad which will be matched. For example, the following is valid syntax:
132.147.*.* Mail rejectedHowever, this is not:
132.147.* Mail rejectedThe list of known spammers is not mandatory.
After you have created file /etc/mail/table/spammers, you
must create its associated database by executing the following
command:
/etc/mail/makemap hash /etc/mail/table/spammers < /etc/mail/table/spammers
This command must be run after any modification of the spammers list.
As a final step, stop and restart the sendmail daemon to load all
of the configuration changes by executing the following commands:
/etc/mail/sendmailrc stop
/etc/mail/sendmailrc start