other solution
is popb4smtp.pl found in www.freshmeat.net
for me is the best solution in otherwise apply iptables
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 25 --syn -j DENY
Only local clients use port 25.
Main Topics
Browse All Topics





by: jleviePosted on 2003-05-31 at 12:00:16ID: 8620956
There are two parts to solution. The first is to prevent users or web sites from sending outbound email
except through a designated mail server. That can most easily be done by configuring the gateway router
to only allow outbound SMTP traffic from a designated mail server. The designated mail server must be a
different system from the web hosting server(s). The web host server(s) mail configuration is changed
to use the designated mail server as a Smart Host so that all outbound mail will flow through the designated
mail server.
If you don't have a gateway router than can implement ACL's on traffic to limit outbound SMTP to the
designated mail server you could use an IPtables rule set on the web hosting server(s) to accomplish the
same thing.
With this configuration a user on the web server is now forced to relay outbound mail via the designated
server. They can't get cute and try to open an SMTP connection to some other MTA because the gateway router
or IPtables rule set blocks that.
The second part of the solution is a bit more involved. What is needed is a addition to the check_compat()
function in sendmail or a libmilter filter. The filter code examines the message and if the Received: header
is the local host or one of the web hosting servers it requires that the From: contain an address in your
allowed list. If those conditions aren't statisfied for outgoing mail it rejects the message. It would be also
possible to implement this functionality by creative hacking on one of the anti-spam pckages like MimeDefang
or MailScanner.