# Help: Stop spam by blocking hosts

## eivinn

I have been using sendmail for a while, but after trying Gentoo on desktop I use it for server as well.

Quiestion is: How can I block certain hosts and networks from delivering mail to my domain   :Question: 

I do not want to use procmail, but refuse connection from these hosts / networks.

----------

## rizzo

Quick answer:  search google for "sendmail block spam".  There is an entire chapter in the sendmail online manual about it.

----------

## mglauche

best solution for sendmail ist spamassassin, spamd and spamd-milter with the sendmail milter interface  :Smile: 

----------

## delta407

 *eivinn wrote:*   

> I do not want to use procmail, but refuse connection from these hosts / networks.

 

I don't use sendmail, but there should be a hosts.deny option or similar. If all else fails you can use iptables and kill incoming connections from certain IPs/netblocks before sendmail hears anything.

----------

## eivinn

I have really been stupid here I think.

Rephrase the facts:

I have been using sendmail with spam-filters.

Now I'm using postfix and wonders if I can do a hosts.deny or something like in sendmail.

PS! Sendmail uses a db to store hosts, networks, e-mail adresses, etc and what to do with them (reject, forward, what error to return, ++).

----------

## rizzo

IIRC, hosts.deny is a linux thing, not specifically an MTA thing.  All applications/servers use the hosts.deny.  So it should work for you.

----------

## eivinn

Great, then I will do that. It's the most easy thing to do and would stop those f***** spammers.

----------

## token_nrg

actually, a really easy thing to do is setup an RBL (realtime Blackhole list) for   your MTA.  basically what this will do is query a specific dns server for whoever's trying to send you mail and based upon that response tell'em to get lost and or it'll allow it.   It's usually really easy to setup.   There are several of these out there.  Some free, some not.  The one I use is from five-ten-sg.    http://www.five-ten-sg.com

----------

## rizzo

trapni and I were just discussing the setup of RBL (I use MAPS) with postfix in this thread:  https://forums.gentoo.org/viewtopic.php?t=11688

----------

