Make sendmail require authentication for mail from local domains

authenticationsendmailsmtp

Server is running sendmail 8.14

From any machine:

$ telnet mydomain.com 25
HELO mydomain.com
MAIL FROM: <me@mydomain.com>
RCPT TO: <me@mydomain.com>
DATA
this is spam
.

How do I require authentication for any mail that claims to be from a local domain?

This seems like a no-brainer anti-spam feature.

FROM         TO           RESULT
any          non-local    "Relaying denied. Proper authentication required."
non-local    local        success [1]
local        local        success [2]

[1] This is acceptable. Outsiders can send to local users without any kind of authentication. Various DNS checks can be done.

[2] This is the problem. Why should I allow anyone to mail a local user while claiming to be a local user?

Best Answer

As noted here:

You can require the use of SMTP AUTH for relaying by simply turning off other means of relaying for incoming mail, e.g., the access map or class R. That is, if you have my.domain in /etc/mail/relay-domains or "my.domain RELAY" in the access map, then remove the entry from class R (/etc/mail/relay-domains) and use "To:my.domain RELAY" in the access map.