Blocking Traffic

He has: 688 posts

Joined: Feb 2001

I've got a problem with particular spammers constantly promoting Russian and Ukranian flower sales on my forums. I've tried everything to keep them out (registration with confirmed email is required) but nothing works because they use different emails and domains. So I was wondering if there is some way that I can possibly block all visitors from certain countries.

their email addresses usually come from .ru with an occasional .su, although they promote .com sites. Can these TLD's be blocked from visiting my site? (If you start mentioning .htaccess I'll say right now that I don't fully understand how that stuff works). But it is worthwhile to note that when I look at my traffic logs I see lots and lots of different countries but I don't ever see any traffic from .ru or .su. However I do have about 10% traffic from "unknown" (ip). So is there anything I can do?

Busy's picture

He has: 6,151 posts

Joined: May 2001

block them by IP - there is a range for Romania

Bad side is there are some honest Romanians out there, believe we have some members from there on here, and also some of the brighter spam/scammers (1%) will use proxies

He has: 77 posts

Joined: Apr 2005

Sounds to me like you've got yourself a bouncer. I'm sure they aren't actually from the IP that they sound like they're from. You're going to have trouble with this one bud. I'd try blocking Romania for now and work on a better future solution as the spammer will come through again if they are bouncing or using a proxy as was said before.

He has: 688 posts

Joined: Feb 2001

Actually it's Russia (.ru) and Ukraine (.su). I can't tell what IP they are using but if certain IP ranges are associated with those nations, how do I find out the correct ranges and how do I then block them?

If it matters I have cpanel. Also, my website in question has a handful of international users but is 99.9% targeted to a specific US location, so if done correctly, blocking all Russian and Ukrainian traffic shouldn't affect my targeted visitors.

Thanks.

He has: 688 posts

Joined: Feb 2001

Sorry to resurect an old post but my problem won't go away. Now I'm getting different type of on-site spam but there's still a russian / ukranian connection. I still can't find specific IP addresses and email addresses vary, but is there any way for me to just ban an entire country or area of the world? My particular site doesn't sell anything and 99.9% of my users are US and Canada, so I don't mind disallowing access to other continents if it's possible. Any ideas?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

How are you determining that they are from russia? Is it just based on the email they submit? Do you have log files? ANytime someone signs up for something on our sites, the two key extras we store are a time/date of signup and the IP#.

-Greg

He has: 688 posts

Joined: Feb 2001

I have cPanel access to my logs but I wouldn't know what to do with them. My past problem with forum spam, I could tell where they were from based on both their signup email addresses and the content of their posts (links to Russian websites). My new problem is with signing comments to my news script, where they post links to russian websites selling stuff completley unrelated to my website subject. My guess is that this is all automated because they keep spamming the same news article (which has a unique url) and not the newer news articles.

AyntRyte's picture

He has: 145 posts

Joined: Jun 2004

Do you have ftp access? (probably a stupid question, but you never know Laughing out loud )
Do you have some patience and the willingness to do some htaccess mods?

I, personally, can't go any further unless you can answer yes to both. With the scripts you are running, there is a good possibility that you already have a htaccess file on your server now. After making a backup copy of that file, a little experimenting will never hurt.

(disclaimer: I'm not an expert on the subject, but after a quick support ticket to my host to get the correct switches for the mod, I was able to get it in place in just few minutes.)

\\// Robert

The grass is always greener on the other side -- but that's because they use more manure.

He has: 688 posts

Joined: Feb 2001

Yes and Yes. I do have some htaccess files but the extent of my knowledge about them is that if I type "-la" into WS_FTP then I can see them on my server. That's about all I know about them. Shocked

AyntRyte's picture

He has: 145 posts

Joined: Jun 2004

The next thing I would do is ask your host their preferred method of blocking IPs through htaccess. I say this because in my first try, I googled for some code to add to the file and hosed my site (which is why having a backup to restore is so important. htaccess mods are unforgiving in their syntax.)

Next, ftp to your server logs (ususally a level or two up from your root directory) and transfer the daily log(s) from the date that the spammer visited to your computer. Open it up (WordPad is best for this IMO) and get familiar with the columns of info. This is where the patience comes in. Log layouts differ from one host/server to next. If you're lucky, there'll be a column header at the top. One of the first columns will be the visitors' IPs. Also close by will be the column for visit time and date. It can get tricky here if your host is in a different time zone, but the important thing is being able to find the row (hit) from your spammer. Also, you said it only hits one article, so if you have that address, you should be able find it in the column that lists the page that was visited (normally near the end of the row.)

Once you determine the offending IP, copy and save it somewhere. In subsequent visits from the spammer, you can compare the IPs.

Next, transfer (ftp, always ftp) your current htaccess file in the root directory to your computer. {very important} Save a backup as another name (ie: 1.htaccess) If you hose something, delete the file on the server, upload the backup and rename it ".htaccess". (you wont really hose anything, you'll just get a 500 error)

Now, if you don't have a recommendation from your host, open the ".htaccess" (not the backup) with a text editor and add something like the following to the top of the file:

order allow,deny
deny from '203.156.187.225
allow from all

(replace the IP above with the one you isolated) Save it and ftp it to the root directory. Visit your site; if it loads, then the syntax was right. If you get an error, replace with the backup as noted above to make the site viewable again. Google "htaccess block ip", look for some samples and experiment with them.

The location you place the code may be important. I had to place mine below:

To deny a range of IPs, take the above as an example, Change it to:
203.156.187 (this denies 0 through 255)
Depending on your server settings, this may need to be listed as:
203.156.187.*

Remember: YMMV
and I suggest waiting a day or two so the other members can pick this apart (I'm sure there are others who know more on the subject than I)

\\// Robert

The grass is always greener on the other side -- but that's because they use more manure.

SearchBliss's picture

He has: 267 posts

Joined: Feb 2005

Good advice. I'm commenting mainly because I receive several website submissions to SearchBliss from Russian sites that also "sell flowers", but MOST of the flower selling sites are from India. What is with the flowers? Is this a cover for something else?
Anyway, I can't stand spam! - like most of us. I finally implimented a filter to delete the spams automatically. Your site is a forum and probably runs on PHP. I use ASP (NT Server), and cannot run PHP so I never bothered to learn. I'm sorry I can't help, but the above advise sounds good. Let us know how it works out.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.