Forum Moderators: open
I've decided to allow access to the Scandanavian countries, which I've long had denied.
The difficulty in the 3200+IP ranges lies in the translation and/or conversion from the "ranges desired to allow" versus creating the blacklisting Rewrites with the ranges excluded.
Although I realize that "reaching for a straw", I'm wondering if anybody has any suggestions over and above manual creation?
EX:
193.17.188.0193.17.188.255
193.17.202.0193.17.202.255
193.17.206.0193.17.206.255
193.17.207.0193.17.207.255
193.17.211.0193.17.211.255
193.17.218.0193.17.218.255
193.17.231.0193.17.231.255
193.17.67.0193.17.67.255
193.17.72.0193.17.72.255
The above ranges result in this long line (not to mention time consuming to create)(that only leaves 3,199+ lines)
93\.17\.([0-9]¦[1-5][0-9]¦6[0-6]¦6[89]¦7[01]¦7[3-9]¦[89][0-9]¦1[0-7][0-9]¦18[0-7]¦189¦19[0-9]¦20[01]¦20[345]¦20[89]¦210¦21[2-7]¦219¦22[0-9]¦230¦23[2-9]¦2[45][0-9])\.
For the chronically regex-challenged amongst us...
When I see a bunch of bad neighboring IPs, I note the CIDRs, then use the invaluable ip2cidr.com to combine smaller 'deny from' ranges into ever larger blocks. Not too time-consuming and a LOT less error-prone. And a lot easier on the eyes!
1.) I don't know what you mean by 'nothing' but in case it helps, here are the standard 'deny from' conversions for the ranges you provided in your OP (to which I added dashes and ordered low-to-high):
193.17.67.0 - 193.17.67.255
deny from 193.17.67.0/24
(in-between: deny from 193.17.68.0/22)
193.17.72.0 - 193.17.72.255
deny from 193.17.72.0/24
-----
193.17.188.0 - 193.17.188.255
deny from 193.17.188.0/24
193.17.202.0 - 193.17.202.255
deny from 193.17.202.0/24
193.17.206.0 - 193.17.206.255
deny from 193.17.206.0/24
193.17.207.0 - 193.17.207.255
deny from 193.17.207.0/24
193.17.211.0 - 193.17.211.255
deny from 193.17.211.0/24
193.17.218.0 - 193.17.218.255
deny from 193.17.218.0/24
193.17.231.0 - 193.17.231.255
deny from 193.17.231.0/24
The shortest forms would be to simply lop off the final ".0/24" parts -- e.g., deny from 193.17.231 -- unless doing so would be less efficient? CUE jdM:)
2.) I know you're looking to pick-and-choose but ALL of that latter. bigger bunch, including all in-betweens, can be denied in three lines:
deny from 193.17.188.0/22
deny from 193.17.192.0/19
deny from 193.17.224.0/21
3.) About the 192s: Unless you're really keen on picking through them, you could consider simply rewriting ^192 to a special page where any legit visitor could e-mail you (via a reCAPTCHA'd address if desired) for access.
(Aside: It's interesting to hear you've been beset by bad Scandinavian visitors. Compared to a region like Australasia, I have little to no trouble with Nordic countries. (knocks wood) Mostly with just a few .se Hosts that I selectively rewrite.)
mod_access is NOT an option.
The range examples I've provided are ALLOW ranges.
Since your the only response to this thread, I'm going to assume that an alternative (other than manual creation) does not exist (which I was already keen on).
3.) About the 192s: Unless you're really keen on picking through them, you could consider simply rewriting ^192 to a special page where any legit visitor could e-mail you (via a reCAPTCHA'd address if desired) for access.
Doesn't CAPTCHA require Java?
My sites do not utilize any Java and/or scripts (by design).
(Aside: It's interesting to hear you've been beset by bad Scandinavian visitors. Compared to a region like Australasia, I have little to no trouble with Nordic countries. (knocks wood) Mostly with just a few .se Hosts that I selectively rewrite.)
Early on with my sites, I grew weary rapidly on non-NA regions crawling my sites while I was sleeping. And reacted accordingly.
I've even had some of the countries duplicate materials from my sites with little chance of compromise for removal. In addition, I neither speak or read any language other than English. The online translators, (as improved as they are), are still in effective.
I may be wasting my time with this effort, however many Scandinavian's are aware of me, my sites and their content, whether this will make any difference today and my presence as it was in 2000-01 is unknown.
As an aside, I've grown quite accustomed to NOT having to bother with the many, many types of Bots and other UA's that come from Euro countries and I'm sure to find that frustrating.
Generally speaking, (and even though Oceanic and Scandinavian countries offer a bigger market share (for my widgets) than most of the western US Time Zones, I don't visit their sites, and only very, very rarely do I make an exception. ("goose and gander").
After I bid adieu to mail forms a while back, I opted to use a graphic address on most pages and the e-mail version of reCAPTCHA for pages I know bots like to go. (I only wish I could get my brain around combining reCAPTCHA w/ a complicated Perl form.) Anyway...
2.) Right now I apply specific sets of Geo IP ranges from the first link; perhaps you might find the latter workable?
www countryipblocks.net/country-blocks/htaccess-deny-format/
www countryipblocks.net/country-blocks/htaccess-allow-format/
(not live-linked per policy req.)
3.) If you (or anyone else out there -- hello? Hellllo?) ever comes up with a non-regex solution for cherry picking aye-and-nay ranges, please reply here. Thanks:)
CAPTCHA - I've never got around to implementing this but I did come across a CSS solution a year or so back. Fairly easy to bypsas, I suspect, but may be suitable for some circumstances.
Don't be hard on people who turn off javascript. I always used to complain about them until the new wave of JS exploits became rife. Now I block JS on all sites except a very few that I need.
I now use NoScript in Firefox and recommend all my customers and contacts to do the same. So far, using it has blocked one injection attempt for me and not using it has let through an exploit on my brothers machine. :(