If I have a list of trusted email servers, is it possible to configure my sendmail server to accept emails only from the trusted severs? How do I do that?
Asked
Active
Viewed 1,029 times
-1
-
What is your definition of "accept emails"? Do you want to deny an connection at all from untrusted sources? Or prevent unauthorized servers from relaying through sendmail to third party domains? – Mike B Feb 13 '15 at 23:15
-
@MikeB I think both are okay, because what I want is that emails from untrusted sources are not stored in the mailboxes in my server. – npcode Feb 14 '15 at 11:51
1 Answers
5
The simplest is to set up a firewall and only open TCP port 25 for the servers on your list.
The sendmail native way would be for instance to use /etc/mail/access
:
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
# Allow Connect from trusted server IPs
Connect:10.9.8.7 OK
Connect:192.168.1.2 OK
# Since Sendmail does not support CIDR expansion list all ranges explicitly
# block 1.0.0.0/8 :
Connect:1 REJECT
# block 2.0.0.0/8 :
Connect:2 REJECT
Connect:3 REJECT
...
Connect:254 REJECT
Alternatively, set up your own DNS blacklist/whitelist.

HBruijn
- 77,029
- 24
- 135
- 201