LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How do I delete all incoming email? (https://www.linuxquestions.org/questions/linux-networking-3/how-do-i-delete-all-incoming-email-75874/)

360 07-25-2003 12:28 PM

How do I delete all incoming email?
 
Hi,

Running RH 7.2

How can I get sendmail to quietly delete or discard all email coming from the internet yet still run local email?

or better yet... I process all email for a domain and all it's sub domains. I need to quietly delete or discard all email comming in to this domain and all it's subdomains.

Thanks,

360

js_530 07-25-2003 04:12 PM

You can use a residential gateway, configure it to block whatever port your using for email so only local computers behind the residential gateway can access the mail server. If you don't feel like getting a residential gateway, you can use the linux firewall to block everything except 192.168.x.x (if you're using a NAT router).

Looking_Lost 07-25-2003 06:43 PM

Try adding appropriate entries to hosts.allow and hosts.deny for sendmail

Works on RH 8 & 9 but may be off the mark for 7

howlingyeti 07-25-2003 11:02 PM

I don't know the exact commands but I bet one or two iptable lines could reject all incoming packets except ones from the range of your network. Try the command man iptables for more information.

360 07-26-2003 01:46 AM

Ok... thanks for all the great ideas...

Here is some more details about what I'm trying to do:

I want to accept the message but disrcard it after accepting it.
I know that /etc/access can do this with incoming messages based on the senders domain name, but I need to discard the message based on the recipients domain name.

In the /etc/aliases file I have put this but haven't tested it yet...
domain_of_recipent.com: /dev/null

Anybody know how /dev/null works? I don't know.

Thanks,

360

howlingyeti 07-26-2003 03:30 AM

/dev/null is basicly a black hole. Redirecting outside email there would be the same as deleting it.

Bebo 07-26-2003 04:23 AM

I'm filtering spams with procmail. It will read scripts that you have in or call from .procmailrc in your home directory. The syntax can be pretty horrible, but I got it to work. Read more about it at the Procmail Documentation Project web site.

To kill mails that don't come from domains that you like, the $HOME/.procmailrc file should contain these lines:

Code:

:0h
* ! ^From:.*\/(allowed.domain.no1|allowed.domain.no2|and.so.on)
/dev/null

If you have only one domain that you like to get mails from and you know that those email addressed have the structure "friend@allowed.domain.foo", then you can change it to

Code:

:0h
* ! ^From:.*@allowed.domain.foo
/dev/null

Be warned however: (1) This will kill the email completely. The general advice seems to save at least the header of every mail somewhere. This is what the change in warn item (2) will do :) (2) I'm a bit rusty when it comes to procmail scripting, so I'm not entirely sure if this does the right thing. You should test the script by changing the ":0h" to ":0fw:", and change /dev/null to some email folder, e.g. $HOME/Mail/Test if your mail directory is $HOME/Mail.

Also, that's a ZERO not an O on the first line!

Anyone, please correct me if this is wrong :)

360 07-26-2003 05:01 AM

Ok, here is what I did...
In this file /etc/mail/access
I added this line...
*. DISCARD


seemed to work.

Thanks,

360


All times are GMT -5. The time now is 06:56 PM.