Limit IP downloads in Apache – Save Bandwidth Published: Nov 04, 2005
  • Rating

    5/5

There are few simple steps you can follow to minimize the amount of spam you receive to your inbox with Cpanel. We cover email filtering, spamassasin, default address and more tools.

There are few simple steps you can follow to minimize the amount of spam you receive to your inbox.

Don't Accept Mail to Users Mailboxes That Don't Exist! - Default Address
By default all unrouted email will be directed to your main mailbox, where it will use disk space and resources of your account. This means that someone can send to anything@yourcompany.com and you'll still receive it to inbox@yourcompany.com (where inbox is your Cpanel username). This is how spammers send out mass messages as well as viruses. A common practice between worms, viruses and spammers is to generate or create a false email address they think you'll receive.

Login to your Cpanel, click on Mail, Default Address, at the bottom click  Set Default Address

Select the domain in the drop down menu, I recommend repeating this for all domains listed.
In the to: field - enter
:fail: no such address here

Click on Change to save your changes.

 

Filter Your Mail Automatically - Cpanel E-mail Filtering
Cpanel also has the ability to use Mail Filters - a nice little addon that will examine all your messages, sort them, do the action you tell it ad delivery you the results. This is an excellent method and often unused tool that can save you hours and hours of browsing spam. For example the Sober viruses sends out a series of messages that all have common subjects, you can completely delete anything that meets those exact subjects, preventing your inbox building up with spam and protecting you from viruses.

Login to your Cpanel, click on Mail, E-mail Filtering, at the bottom top click  Add Filter.
In the Filter section you have two drop downs, the first is what you are filtering.
Subject, From, To, Body, Any Header, SpamAssasin Spam Header.

The next drop down is how you are filtering it.
contains, equals, matches regex, and begins with.

The input box is the filter. Enter the text you want to filter here.

For example, I keep getting spam messages with the same subject and I want to filter them. The spam messages have the subject line: Ultimate Online Pharmaceutical

I'd create a filter as follows:

What? Subject
How? Equals
Filter? Ultimate Online Pharmaceutical
Destination? Discard

This now automatically deletes any messages that I receive with the subject: Ultimate Online Pharmaceutical
so they never even get to my inbox, perfect!

Once you've added a filter you can test it, enter a message that you think you want to filter in the test window, with subject, from address and body to make sure the filter works the way you want.

WARNING - setting up filters incorrectly can reslt in mail never received and the sender will never know. If you setup filters wrong then valid email can be deleted as well so be careful.

 

Accept from Trusted Senders Only
BoxTrapper Spam Trap is a tool that can help reduce spam significantly. Someone emails you, if they're not on your white list then they must reply to a message they receive after emailing you. After replying they are put on a white list so they don't have to respond every time they send you a message to validate the email. Basically you give them the big OK that the sender is a person and not a virus or spammer - they usually never respond so this cuts down spam a lot.

 

Flag Mail As Spam using SpamAssasin
SpamAssasin is another tool you can use which helps score or rate messages as potential spam. We'll come back and cover SpamAssasin more at a later date.

  • Rating

    5/5

Related Articles

Comments (16)

  • Gravatar - David K
    David K 20:31, December 19, 2005
    Thaks for this walkthru--I've implemented it on my Apache 2.0 runing on Win2K server and it works perfectly.<br />
    The only issue I saw was that .rm files weren't recognized as video, so I removed the <br />
    OnlyIPLimit audio/mpeg video<br />
    line in <Location /...><br />
    Thaks again!
  • Gravatar - Mih
    Mih 21:02, December 26, 2005
    I have also implemented on RHE3 Cpanel it but on my folder i have downloads stuff like .rar exe zip or pdf files. <br />
    <br />
    I would like to know what i write instead this syntax:<br />
    <br />
    OnlyIPLimit audio/mpeg video<br />
    <br />
    Thanks for your co operation and your efforts are appreciable.
  • Gravatar - MrPC
    MrPC 05:41, January 4, 2006
    I get this when type "make". Can some1 help me out?<br />
    ===================<br />
    root@home [~/mod_limitipconn-0.22]# make<br />
    /usr/local/apache/bin/apxs -c mod_limitipconn.c<br />
    gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DMOD_SSL=208125 -DUSE_HSREGEX -DEAPI -fpic -DSHARED_MODULE -I/usr/local/apache/include -c mod_limitipconn.c<br />
    mod_limitipconn.c:34:20: ap_mpm.h: No such file or directory<br />
    mod_limitipconn.c:35:25: apr_strings.h: No such file or directory<br />
    mod_limitipconn.c:41: error: syntax error before "limitipconn_module"<br />
    mod_limitipconn.c:41: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:47: error: syntax error before "apr_array_header_t"<br />
    mod_limitipconn.c:47: warning: no semicolon at end of struct or union<br />
    mod_limitipconn.c:49: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:51: error: syntax error before '}' token<br />
    mod_limitipconn.c:51: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:53: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `limitipconn_create_dir_config':<br />
    mod_limitipconn.c:55: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:55: error: (Each undeclared identifier is reported only once<br />
    mod_limitipconn.c:55: error: for each function it appears in.)<br />
    mod_limitipconn.c:55: error: syntax error before ')' token<br />
    mod_limitipconn.c:60: error: `p' undeclared (first use in this function)<br />
    mod_limitipconn.c: In function `limitipconn_handler':<br />
    mod_limitipconn.c:69: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:69: error: syntax error before ')' token<br />
    mod_limitipconn.c:70: error: request for member `module_index' in something not a structure or union<br />
    mod_limitipconn.c:89: error: `worker_score' undeclared (first use in this function)<br />
    mod_limitipconn.c:89: error: `ws_record' undeclared (first use in this function)<br />
    mod_limitipconn.c:100: error: too many arguments to function `ap_sub_req_lookup_uri'<br />
    mod_limitipconn.c:174: error: `SERVER_IDLE_KILL' undeclared (first use in this function)<br />
    mod_limitipconn.c:176: error: `SERVER_CLOSING' undeclared (first use in this function)<br />
    mod_limitipconn.c:184: warning: passing arg 5 of `ap_log_rerror' from incompatible pointer type<br />
    mod_limitipconn.c: In function `limit_config_cmd':<br />
    mod_limitipconn.c:198: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:198: error: syntax error before ')' token<br />
    mod_limitipconn.c: In function `no_limit_config_cmd':<br />
    mod_limitipconn.c:216: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:216: error: syntax error before ')' token<br />
    mod_limitipconn.c:218: warning: assignment makes pointer from integer without a cast<br />
    mod_limitipconn.c: In function `excl_limit_config_cmd':<br />
    mod_limitipconn.c:226: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:226: error: syntax error before ')' token<br />
    mod_limitipconn.c:228: warning: assignment makes pointer from integer without a cast<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:235: error: initializer element is not constant<br />
    mod_limitipconn.c:235: error: (near initialization for `limitipconn_cmds[0].name')<br />
    mod_limitipconn.c:237: error: initializer element is not constant<br />
    mod_limitipconn.c:237: error: (near initialization for `limitipconn_cmds[0].func')<br />
    mod_limitipconn.c:239: error: initializer element is not constant<br />
    mod_limitipconn.c:239: error: (near initialization for `limitipconn_cmds[0].cmd_data')<br />
    mod_limitipconn.c:240: warning: braces around scalar initializer<br />
    mod_limitipconn.c:240: warning: (near initialization for `limitipconn_cmds[0].req_override')<br />
    mod_limitipconn.c:240: warning: initialization makes integer from pointer without a cast<br />
    mod_limitipconn.c:241: error: initializer element is not constant<br />
    mod_limitipconn.c:241: error: (near initialization for `limitipconn_cmds[0]')<br />
    mod_limitipconn.c:244: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `limitipconn_init':<br />
    mod_limitipconn.c:246: error: `s' undeclared (first use in this function)<br />
    mod_limitipconn.c:248: error: `AP_MPMQ_HARD_LIMIT_THREADS' undeclared (first use in this function)<br />
    mod_limitipconn.c:249: error: `AP_MPMQ_HARD_LIMIT_DAEMONS' undeclared (first use in this function)<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:253: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `register_hooks':<br />
    mod_limitipconn.c:255: error: `APR_HOOK_MIDDLE' undeclared (first use in this function)<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:259: error: syntax error before "limitipconn_module"<br />
    mod_limitipconn.c:260: error: `STANDARD20_MODULE_STUFF' undeclared here (not in a function)<br />
    mod_limitipconn.c:260: error: initializer element is not constant<br />
    mod_limitipconn.c:260: error: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:261: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:261: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:262: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:262: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:263: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:263: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:264: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:264: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:265: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:265: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:267: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:267: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:267: warning: data definition has no type or storage class<br />
    apxs:Break: Command failed with rc=1<br />
    make: *** [mod_limitipconn.so] Error 1<br />
  • Gravatar - Nick
    Nick 16:23, January 31, 2006
    Thank you very much man. I have some DOS attacks in my server those days, and this is really helpfull :)
  • Gravatar - Frosty
    Frosty 09:55, February 23, 2006
    Very helpful there too :-)<br />
    Many thanks.
  • Gravatar - konnor
    konnor 15:16, April 17, 2006
    Wow! Man, really really thank you for this stuff! It works perfectly! (After I set up the ExtendedStatus directive ;))<br />
    Last night I had a bloody DOS attack on my web server - I hope this stuff protect my server in the future. Thanks again!
  • Gravatar -  A server admin
    A server admin 13:34, July 28, 2006
    How do you make this if you have direct physical access to the webserver. And do not need to login to the server. Specifically on a Windows apache server.??
  • Gravatar - kon
    kon 12:10, March 18, 2007
    I am guessing this is only for a full Server root access and not for someone who is on shared hosting...?
  • Gravatar - fabiOne
    fabiOne 12:04, May 4, 2007
    Good, good, good. You have complete a perfect job for many people.<br />
    Many thanks.
  • Gravatar - RTG (Asia) Network
    RTG (Asia) Network 15:51, August 21, 2007
    The link no longer works.<br />
  • Gravatar - NobodyHasGottaBodyLikeMe
    NobodyHasGottaBodyLikeMe 23:18, June 16, 2008
    One thing I found: You may get a lot of false positives if you have KeepAlive enabled in Apache, since by default it keeps each connection open for 15 seconds. So if the user hits several pages in succession while using a lame browser, they may get a 503 error when they aren't doing anything objectionable.<br />
  • Gravatar - lovelu
    lovelu 20:20, October 30, 2008
    its work for mp3 file. but it does not working for pdf file. what to do?
  • Gravatar - Farzin Sadeghi
    Farzin Sadeghi 08:39, January 2, 2010
    Thanks man. you saved my life !! :D <br />
    it works like a charm. :D<br />
    <br />
    -------------<br />
    to lovelu<br />
    if u want to limit other file types<br />
    u should add the extension to your active mime.conf and then add the disable extension with a "space" , like this :<br />
    OnlyIPLimit audio/mpeg video aplication/pdf extension1 extension2 ... and so on.<br />
    or every thing esle u defined in mime.conf :D
  • Gravatar - Farzin
    Farzin 16:50, January 17, 2010
    hi , thanks for great post.<br />
    <br />
    is it possible to limit connections per file ? for example limiting ip to 2 , but also letting them download 5 files at the same time.<br />
    that counts 10 connections.<br />
    but it is devided between 5 files automatically. <br />
    can it be possible ?
  • Gravatar - John
    John 20:07, October 13, 2010
    Hello,

    How to uninstall this ?

    Thanks in advance

Add Your Thoughts

WebHostGear.com is a hosting directory, not a web host.

Copyright © 1998-2014 WebHostGear.com