Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: simmaster on December 21, 2009, 04:47:52 AM

Title: Proxy Blocker
Post by: simmaster on December 21, 2009, 04:47:52 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2329)

Proxy Blocker Mod by simmaster07

Compatibility:
SMF 1.1
SMF 2.0

Configuration:
SMF 1.1: Features and Options
SMF 2.0: Configuration > Modification Settings

Killswitch:
If you are blocked from your own forum, add
$kill_proxyblocker = true;
somewhere into your Settings.php file.

The Proxy Blocker mod allows you to disable users on proxies from registering or viewing the entire forum altogether. This helps prevent banned users from trying to re-register, or spambots from trying to use proxies to attack, with the disadvantages of blocking school/corporate connections that use proxies, cell phones and primitive browsers.

Tested on proxies:
* HideMyAss
* ProxEasy
* The-Cloak
* Proxify
* WinkProxy

Tested on browsers:
* Google Chrome
* Mozilla Firefox 3.5
* Microsoft Internet Explorer 8

Changelog

[+] - Added feature
[-] - Removed feature
[*] - Bugfix
[%] - Security patch/new blocked proxy

v1.0
[+] Created mod from core code

v1.0.1
[*] Removed brackets { } to make code more consistent with SMF style
[*] Removed one condition that caused regular clients to be killed off

v1.1
[%] Blocks Tor exit nodes
[+] Now 1.1 compatible
[*] Caching hostname into variable
[*] Prevent run-on language strings by placing new language strings on a new line
[+] Added language strings:
     [++] Spanish (PARTIAL)
     [++] Spanish-UTF8 (PARTIAL)
     [++] English-UTF8
     [++] English_GB
     [++] English_GB-UTF8
[+] Block the entire forum
[+] Setting control

v1.1.1
[*] Condense file edits
[*] Complete Spanish translations (thanks to DrHouse and qtime!)

v1.1.2
[*] Code edits suggested by Arantor for performance

v1.1.3
[*] Stops flooding the error logs in 2.0

v1.1.4
[*] modSetting variables are now checked with empty()
[+] Kill switch in Settings.php file in case you get blocked
[+] Redirect to settings on installation
[+] Include a readme


Translations:

Please translate:

$txt['on_proxy'] = 'Sorry, but the administrator has blocked registration from proxies. Other causes of this error include using an intranet (school connections), registering on a cell phone, or using a browser that does not support compression or does not accept encoding.';
$txt['proxyblock_reg'] = 'Block registration if using proxy';
$txt['proxyblock_index'] = 'Block forum if using proxy';


Planned Features:

Special Thanks to:

This mod makes no template edits and should work on all SMF 1.1/2.0 forums on any themes that aren't modded excessively.
Title: Re: Proxy Blocker
Post by: Boby_ on December 21, 2009, 08:03:15 AM
Sounds useful.
Have you tested it on http://www.torproject.org/ ?
Title: Re: Proxy Blocker
Post by: Arantor on December 21, 2009, 08:04:15 AM
/me thinks it probably wouldn't work on Tor because of how Tor works... but hasn't tested it on that. I just tested it on The Cloak and the above two.
Title: Re: Proxy Blocker
Post by: BrianVB on December 21, 2009, 01:12:34 PM
This is really a great mod, thanks! ;)
Title: Re: Proxy Blocker
Post by: DoctorMalboro on December 21, 2009, 01:28:53 PM
I ♥ U!!!  ;D thank you soo much!!!

spanish translation

$txt['on_proxy'] = 'Lo sentimos, el administrador bloqueo el registro desde este proxy. si usted nunca tuvo acceso a este foro, el problema se debe a una conexión local, uso desde un celular o imcompatibilidad por parte de su navegador.';
Title: Re: Proxy Blocker
Post by: Arantor on December 21, 2009, 01:37:52 PM
English-UTF8, English_British and English_British-UTF8 all use the same wording as your existing one, btw.
Title: Re: Proxy Blocker
Post by: Vekseid on December 21, 2009, 02:52:56 PM
Quote from: Boby_ on December 21, 2009, 08:03:15 AM
Sounds useful.
Have you tested it on http://www.torproject.org/ ?

You can check for this by looking up tor-exit in the hostname.

Really, between that, this and say, checking for IE 6 or under, you could stop most spam by requiring such users to prove that they are human. I don't really want to block such registrations entirely : /
Title: Re: Proxy Blocker
Post by: simmaster on December 21, 2009, 04:26:20 PM
Thanks for the translations. They will be added ASAP and will add them into the next patch (1.0.2)

@Vekseid: It's not just the fact that they need to prove that they're human. Some webmasters (like myself) would prefer blocking proxies in their entirety so banned members don't rise from the dead, spambots don't attack continuously, etc.

@The Grinch: I will test it on Tor and post my results. If it fails, I'll try patching it up.
Title: Re: Proxy Blocker
Post by: Vekseid on December 21, 2009, 04:46:20 PM
Yes, but if I wanted to block all access I would have done years ago.

Err, just match for tor-exit in the hostname, I mean. You'll want to do a hostname lookup for that though. Tor exit nodes don't have port 80 open.
Title: Re: Proxy Blocker
Post by: simmaster on December 21, 2009, 04:52:18 PM
Quote from: Vekseid on December 21, 2009, 04:46:20 PM
Yes, but if I wanted to block all access I would have done years ago.

Err, just match for tor-exit in the hostname, I mean. You'll want to do a hostname lookup for that though. Tor exit nodes don't have port 80 open.

Well, it's not really that hard to do a hostname lookup. Thank you, gethostbyaddr()! ::)
Title: Re: Proxy Blocker
Post by: Arantor on December 21, 2009, 04:55:22 PM
You could even cache the hostname into a variable instead of calling it multiple times, just as a thought.
Title: Re: Proxy Blocker
Post by: simmaster on December 22, 2009, 04:24:57 PM
Proxy Blocker 1.1 should be out within the week.

Changelog

[+] - Added feature
[-] - Removed feature
[*] - Bugfix
[%] - Security patch

v1.1
[+] Blocks Tor exit nodes
[+] Now 1.1 compatible
[*] Caching hostname into variable
[+] Added language strings:
     [++] Spanish
     [++] Spanish-UTF8
     [++] English-UTF8
     [++] English_GB
     [++] English_GB-UTF8
[+] Block the entire forum
[+] Setting control
Title: Re: Proxy Blocker
Post by: qtime on December 23, 2009, 01:04:33 AM
I really like to see this mod for 1.1.11, according to the small code, I hope it's not too much work??
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 05:47:57 AM
It's working with 1.1.11 and should be out later in the day. I just need to fix the issue where blocking the forum blocks everyone.
Title: Re: Proxy Blocker
Post by: qtime on December 23, 2009, 05:51:37 AM
Quote from: simmaster on December 23, 2009, 05:47:57 AM
It's working with 1.1.11 and should be out later in the day. I just need to fix the issue where blocking the forum blocks everyone.
great I will look forward to it and will test it at a very busy  board
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 06:24:31 AM
Before I release 1.1, can someone translate these strings into Spanish:

$txt['proxyblock_reg'] = 'Block registration if using proxy';
$txt['proxyblock_index'] = 'Block forum if using proxy';


No, I didn't fix the issue yet.
Title: Re: Proxy Blocker
Post by: Arantor on December 23, 2009, 06:47:28 AM
Btw, someone has just commented that the edits to the language files should really have a new line above them to prevent run-on from the previous line.

No biggie, just would be good to keep tidy.
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 06:54:09 AM
Quote from: The Grinch on December 23, 2009, 06:47:28 AM
Btw, someone has just commented that the edits to the language files should really have a new line above them to prevent run-on from the previous line.

No biggie, just would be good to keep tidy.

Noticed that myself and fixed it in 1.1.
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 07:08:14 AM
Proxy Blocker 1.1 is out and fully functional, with the exception of Spanish language strings, which still need the two new language strings translated. Major features are blocking the entire forum, blocking Tor nodes and SMF 1.1 compatibility!
Title: Re: Proxy Blocker
Post by: qtime on December 23, 2009, 07:10:30 AM
great news!!! I will test it within a few hours, I asked for a spanish member to help to translate, unfortunately no responds, yet...
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 07:22:14 AM
Quote from: qtime on December 23, 2009, 07:10:30 AM
great news!!! I will test it within a few hours, I asked for a spanish member to help to translate, unfortunately no responds, yet...

Let me know when he gets a translation, because I need one ASAP. ;)
I'm going to be in school until 3:40 so I might not be online. (unless I manage to sneak in through the library connection :D)
Title: Re: Proxy Blocker
Post by: qtime on December 23, 2009, 09:39:06 AM
 Block registration if using proxy
bloquear registro si usas proxy

Block forum if using proxy
bloquear foro si usas proxy
Title: Re: Proxy Blocker
Post by: qtime on December 23, 2009, 01:36:57 PM
Tested it at my forum and it's blocking great, the proxy sites and proxies added to the browser!!! Thanks a lot.
Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 02:05:56 PM
Actually, there's an error in your coding of the index.php file.  It places the IsTorExitPoint() function at the bottom of the file, outside of the close php script statement ?>

Caused a blank white screen for me, and the error logs stated a call to undefined function in index.php, which made me look at it for the error.  I just simply moved the ?> to after the function and the forum lit right back up.

You might want to check this in the modification.xml file.

Thanks tho.  Really needed this.  In the past month, we've had over 1500 registrations all from proxies.

cheers and happy holidays!

-mark
Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 03:38:00 PM
Quote from: markd on December 23, 2009, 02:05:56 PM
Actually, there's an error in your coding of the index.php file.  It places the IsTorExitPoint() function at the bottom of the file, outside of the close php script statement ?>

Caused a blank white screen for me, and the error logs stated a call to undefined function in index.php, which made me look at it for the error.  I just simply moved the ?> to after the function and the forum lit right back up.

You might want to check this in the modification.xml file.

Thanks tho.  Really needed this.  In the past month, we've had over 1500 registrations all from proxies.

cheers and happy holidays!

-mark

Odd issue you have there. I'm not sure if this is a glitch in your package manager since qtime and I installed it fine, but the install xml files place the edits at the end of the file before ?> (<search position="end" />)
Title: Re: Proxy Blocker
Post by: Tokzu on December 23, 2009, 03:49:23 PM
Nice mod, thanks. ;D

By the way, what theme is that of this (http://custom.simplemachines.org/mods/index.php?action=download;mod=2329;id=128714;image) image? I am looking for a theme to change the design of my web and that I liked it. =P
Title: Re: Proxy Blocker
Post by: Arantor on December 23, 2009, 03:50:40 PM
That appears to be a WordPress theme, Arclite, spliced into SMF.

Oh, random thought. I see in the latest code, you have a large block of conditions, which amounts to (condition || condition || condition) && condition.

Since it requires the last part to be true, put that first. If it fails, the rest of the stuff is never executed, so it's faster.


Also:
function IsTorExitPoint()
{
if (
gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")
== "127.0.0.2"
)
return true;
else
return false;
}


Can be simplified without any loss of functionality or meaning:
function IsTorExitPoint()
{
return (
gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")
== "127.0.0.2"
);
}
Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 04:18:11 PM
Hmm.. the error log is being flooded now.  What browser did you test this on?

The httpd server variables:

$_SERVER['HTTP_X_FORWARDED_FOR']
                || $_SERVER['HTTP_X_FORWARDED']
                || $_SERVER['HTTP_FORWARDED_FOR']
                || $_SERVER['HTTP_VIA']
$_SERVER['HTTP_CONNECTION']

are not being passed by the browsers (most likely firefox), thus resulting in undefined index errors in the SMF error log with EVERY CLICK (log is up to 1000 pages as I type this).  I even tried turning registered globals on, and making adjustments to your code to no avail.

Any insight into this?

-mark

edit:  it appears that REMOTE_ADDR is empty, thus causing the undefined errors.  looking into a fix.

Title: Re: Proxy Blocker
Post by: Arantor on December 23, 2009, 04:25:27 PM
!empty($_SERVER['HTTP_X_FORWARDED_FOR'])
                || !empty($_SERVER['HTTP_X_FORWARDED'])
                || !empty($_SERVER['HTTP_FORWARDED_FOR'])
                || !empty($_SERVER['HTTP_VIA'])
!empty($_SERVER['HTTP_CONNECTION'])

^^ might do the trick.

empty() should be checked in more places than it is right now, really. If there's a chance the variable doesn't exist, check with empty() first.
Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 04:38:32 PM
okay, I edited my post above to state that it appears as if REMOTE_ADDR is always empty.

I added the empty check to all the statements and the errors ceased, and i also had to add it to $modSettings['proxyblock_index'].  I also had to make the changes in Register.php too.

Now, I just kinda wonder if it's broken and won't work anyway if REMOTE_ADDR is always empty.

Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 04:52:41 PM
nevermind.. REMOTE_ADDR is being populated.  it was the empty check.  If someone is using a proxy those variables will be present (not empty)

Thank you.

-mark

Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 05:00:10 PM
and it works.. caught one right away!  :)

IP address     Display name     Message     Date
91.77.195.249    Guest    Sorry, but the administrator has blocked access by proxies. Other causes of this error include using an intranet (school connections), registering on a cell phone, or using a browser that does not support compression or does not accept encoding.
?action=register    Today at 04:51:22 PM
Title: Re: Proxy Blocker
Post by: markd on December 23, 2009, 05:16:54 PM
ugh.. now its blocking all registrations, even for me.

back to square one.  :)

Title: Re: Proxy Blocker
Post by: simmaster on December 23, 2009, 10:29:42 PM
Quote from: The Grinch on December 23, 2009, 03:50:40 PM
That appears to be a WordPress theme, Arclite, spliced into SMF.
Correctomundo.
Quote
Oh, random thought. I see in the latest code, you have a large block of conditions, which amounts to (condition || condition || condition) && condition.

Since it requires the last part to be true, put that first. If it fails, the rest of the stuff is never executed, so it's faster.

Will do.

Quote
Also:
function IsTorExitPoint()
{
if (
gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")
== "127.0.0.2"
)
return true;
else
return false;
}


Can be simplified without any loss of functionality or meaning:
function IsTorExitPoint()
{
return (
gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")
== "127.0.0.2"
);
}


Arantor, you're better at fixing my code than I am ::)

Quote from: markd on December 23, 2009, 05:16:54 PM
ugh.. now its blocking all registrations, even for me.

back to square one.  :)

Manually remove every edit from the mod, uninstall the package and delete it, then get the newest package and reinstall that. I accidentally uploaded a premature package that blocked everyone and took it down within a few minutes, but you may have downloaded it.
Title: Re: Proxy Blocker
Post by: DarkLite on December 24, 2009, 05:27:21 AM
So have the Firefox bugs been fixed?
Title: Re: Proxy Blocker
Post by: simmaster on December 24, 2009, 10:04:22 AM
As of Firefox 3.5.5 and Proxy Blocker 1.1.2, Firefox isn't blocked. Yet, it wasn't blocked to begin with.
Title: Re: Proxy Blocker
Post by: DoctorMalboro on December 24, 2009, 10:04:56 AM
the new spanish translation  ;D

$txt['proxyblock_reg'] = 'Bloquear registro si usan proxy';
$txt['proxyblock_index'] = 'Bloquear foro si usan proxy';
Title: Re: Proxy Blocker
Post by: ddarrell on December 24, 2009, 03:58:31 PM
Installed 1.1.2 version of this mod.  Within a couple of hours, error log flooded (60 pages).
It appears to generate an error with every click.  I saw my own errors generated with
Firefox 3.5.6.  I didn't study the others before clearing the error log.

Uninstalled this mod.

Hope you get it fixed, good idea. Although it appears to have the potential to be wormy as is.

:)

Title: Re: Proxy Blocker
Post by: simmaster on December 24, 2009, 04:25:35 PM
Yeah, SMF 2.0 seems to make an undefined index error for empty $_SERVER variables.
Title: Re: Proxy Blocker
Post by: Arantor on December 24, 2009, 04:57:01 PM
Of course it does. It's a regular variable. You still need to check if it's empty or not.
Title: Re: Proxy Blocker
Post by: simmaster on December 24, 2009, 05:14:05 PM
Anyway, why uninstall the mod when there are a bunch of other undefined index errors? The ones that really need to be focused on are the critical errors. Still, on active forums, it's error log overkill. :P
Title: Re: Proxy Blocker
Post by: Arantor on December 24, 2009, 05:16:38 PM
Don't forget that error log is DB stored, so every error being logged is another query that could be saved for real use...
Title: Re: Proxy Blocker
Post by: simmaster on December 24, 2009, 06:36:46 PM
Which is why I'm looking into a way to check if the SERVER variables are empty without causing the server to query itself to death.
Title: Re: Proxy Blocker
Post by: Arantor on December 24, 2009, 06:41:00 PM
You mean like empty($_SERVER['parameter']) ?
Title: Re: Proxy Blocker
Post by: simmaster on December 24, 2009, 09:16:25 PM
Already did that in 1.1.2 with the index.php edit. Being the idiot I am, I didn't adapt it to Register.php. Odd part is that I see the errors, and they're coming from index.php ._.
Title: Re: Proxy Blocker
Post by: Mr. Pirate on December 25, 2009, 01:10:36 AM
so the mod installed perfectly i fixed the index.php thing were the code was going after the "?>", and i moved it before.

(http://i46.tinypic.com/309rivm.png)

but when i go to hidemyass.com or any other proxy blocker it doesnt block it, on firefox or internet explorer.

(http://i45.tinypic.com/97rybn.png)

why is this happening??
Title: Re: Proxy Blocker
Post by: simmaster on December 25, 2009, 03:47:29 PM
Did you switch the settings on? I added a configuration section to the description.
Title: Re: Proxy Blocker
Post by: DarkValentine on December 25, 2009, 04:29:24 PM
I seem to get the following error when I use this plugin.


Undefined index: proxyblock_index
File: /home/generati/public_html/forum/index.php
Line: 180


When I check this line, this is what I see on that exact line

(http://i49.tinypic.com/j94upd.jpg)

It seems that while this error is in place, switching the configuration on for this plugin does not work. As it will not block any proxies. My only guess, is because of the error on line 180
Title: Re: Proxy Blocker
Post by: Arantor on December 25, 2009, 04:30:48 PM
Instead of just $modSettings['proxyblock_index'], use
!empty($modSettings['proxyblock_index'])
Title: Re: Proxy Blocker
Post by: DarkValentine on December 25, 2009, 04:45:45 PM
Seems like that did the trick, because the error appears on Register.php now.

So, I applied what you said for that too, the errors went away in both areas fully :)

Thanks. I'll post if I find any other problems.
Title: Re: Proxy Blocker
Post by: dzinerfusion on December 25, 2009, 07:44:33 PM
Wow what a great mod! Amazing how you can make ti detect proxies!  ::) ;D
Title: Re: Proxy Blocker
Post by: Arantor on December 25, 2009, 07:47:13 PM
It doesn't detect every single proxy, just a decent percentage of them.
Title: Re: Proxy Blocker
Post by: simmaster on December 25, 2009, 11:58:28 PM
Quote from: Arantor on December 25, 2009, 07:47:13 PM
It doesn't detect every single proxy, just a decent percentage of them.

Just about most of the web-based ones with common cloaking techniques that leave dead giveaways like empty hostnames ::)

And 1.1.3 (I seriously need a new versioning method, because this is moving too fast) should stop Proxy Blocker from flooding the error log.
Title: Re: Proxy Blocker
Post by: Arantor on December 26, 2009, 07:10:49 AM
Depends mostly how intelligent the proxy is, really. This is better than most other attempts I've seen.
Title: Re: Proxy Blocker
Post by: DarkLite on December 26, 2009, 10:00:17 AM
Impressive work! Quick question: did you fix Firefox-related false positives? Just a friend of mine got "caught" with the earliest version :/
Title: Re: Proxy Blocker
Post by: simmaster on December 26, 2009, 01:13:31 PM
Quote from: Arantor on December 26, 2009, 07:10:49 AM
Depends mostly how intelligent the proxy is, really. This is better than most other attempts I've seen.

Most of the "intelligent" and "anonymous" proxies leave dead giveaways that this mod captures. Maybe that's because they're all using software like Glype (WinkProxy: Blocked), CGIProxy (Proxify) and PHProxy (HideMyAss).

Quote from: DarkLite on December 26, 2009, 10:00:17 AM
Impressive work! Quick question: did you fix Firefox-related false positives? Just a friend of mine got "caught" with the earliest version :/

The Firefox false positive should be solved. I've tested the mod on Firefox 3.5.5 and have not received a false positive.
Title: Re: Proxy Blocker
Post by: iNumberS on December 26, 2009, 08:19:19 PM
just installed the mod and it blocked me out of my forums even though i'm not using proxy. How can i remove this because i'm totally blocked from my forums now.. I NEED HELP
Title: Re: Proxy Blocker
Post by: simmaster on December 26, 2009, 11:29:32 PM
Quote from: iNumberS on December 26, 2009, 08:19:19 PM
just installed the mod and it blocked me out of my forums even though i'm not using proxy. How can i remove this because i'm totally blocked from my forums now.. I NEED HELP

Manually remove the edits to the index.php file and uninstall the mod. I'll work on a kill switch in the Settings.php file.
Title: Re: Proxy Blocker
Post by: Arantor on December 27, 2009, 08:34:15 AM
If you do add a kill-switch, please ensure it is added via the correct functions, concerning updateDBSettings and updateSettingsFile.
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 11:40:35 AM
Quote from: Arantor on December 27, 2009, 08:34:15 AM
If you do add a kill-switch, please ensure it is added via the correct functions, concerning updateDBSettings and updateSettingsFile.

Well yes, but wouldn't it be odd to have the killswitch in the Admin panel when you're blocked from it? :P
Title: Re: Proxy Blocker
Post by: markd on December 27, 2009, 12:50:17 PM
Quote from: Arantor on December 25, 2009, 04:30:48 PM
Instead of just $modSettings['proxyblock_index'], use
!empty($modSettings['proxyblock_index'])


--------
edit:  ignore this below.. proxyblock_reg was being set, but proxyblock_index was not.. but see the next post as to why and how to stop the errors
--------

here's the problem tho, even if checked in the admin menu, $modSettings['proxyblock_index'] appears to always be empty, so as soon as the script hits the condition check, it won't block any proxies whether or not you've selected it in the admin menu.  Sure the errors go away, but like I said, it's because the variable is always empty.

The main problem is that when you save the settings out of the admin menu, the values for $modSettings['proxyblock_index'] and $modSettings['proxyblock_reg'] are not being saved.

Create a php file somewhere under your web root, require the SSI.php, then in the script just add:
echo 'Proxy Index: ' . $modSettings['proxyblock_index'] . '\n';
echo 'Proxy Reg: ' . $modSettings['proxyblock_reg'];

You will notice that neither return a value.  With both options being checked in the admin menu, they should each return a value of 1.

Title: Re: Proxy Blocker
Post by: markd on December 27, 2009, 12:56:42 PM

ha!  guess what I just realized.  you should check both reg & index upon initial installation of the mod.  This will create the necessary database entries for both variables in the database.  then you can go uncheck either one (most likely the index one), and there will be no errors.

With this, you don't need to make modifications to the script (i.e., "!empty" empty, etc).

checking them both then unchecking either one to your liking will successfully block proxies.

:)



Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 01:08:54 PM
Quote from: markd on December 27, 2009, 12:56:42 PM

ha!  guess what I just realized.  you should check both reg & index upon initial installation of the mod.  This will create the necessary database entries for both variables in the database.  then you can go uncheck either one (most likely the index one), and there will be no errors.

With this, you don't need to make modifications to the script (i.e., "!empty" empty, etc).

checking them both then unchecking either one to your liking will successfully block proxies.

:)

As of 1.1.3, the script already uses !empty() and empty() in favor of plain variables to stop flooding the error log.
Title: Re: Proxy Blocker
Post by: markd on December 27, 2009, 01:11:41 PM
Quote from: simmaster on December 27, 2009, 01:08:54 PM
Quote from: markd on December 27, 2009, 12:56:42 PM

ha!  guess what I just realized.  you should check both reg & index upon initial installation of the mod.  This will create the necessary database entries for both variables in the database.  then you can go uncheck either one (most likely the index one), and there will be no errors.

With this, you don't need to make modifications to the script (i.e., "!empty" empty, etc).

checking them both then unchecking either one to your liking will successfully block proxies.

:)

As of 1.1.3, the script already uses !empty() and empty() in favor of plain variables to stop flooding the error log.

yes it does, except in the initial condition check in index.php..

from 1.1.3:


$hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
        if(
                ($modSettings['proxyblock_index'])
                && (!$hostaddr


that's unedited, and notice the condition check on $modSettings['proxyblock_index'] does not check if it's empty or not.  however, if you check it in admin, then uncheck it, it will assign it a 0, therefore not needing the empty check.

Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 01:18:53 PM
Quote from: markd on December 27, 2009, 01:11:41 PM
Quote from: simmaster on December 27, 2009, 01:08:54 PM
Quote from: markd on December 27, 2009, 12:56:42 PM

ha!  guess what I just realized.  you should check both reg & index upon initial installation of the mod.  This will create the necessary database entries for both variables in the database.  then you can go uncheck either one (most likely the index one), and there will be no errors.

With this, you don't need to make modifications to the script (i.e., "!empty" empty, etc).

checking them both then unchecking either one to your liking will successfully block proxies.

:)

As of 1.1.3, the script already uses !empty() and empty() in favor of plain variables to stop flooding the error log.

yes it does, except in the initial condition check in index.php..

from 1.1.3:


$hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
        if(
                ($modSettings['proxyblock_index'])
                && (!$hostaddr


that's unedited, and notice the condition check on $modSettings['proxyblock_index'] does not check if it's empty or not.  however, if you check it in admin, then uncheck it, it will assign it a 0, therefore not needing the empty check.

That, I patched in 1.1.4, which has been released. That's what happens when you go coding at three in the morn' ;D
Title: Re: Proxy Blocker
Post by: Arantor on December 27, 2009, 01:30:55 PM
I'm not saying you shouldn't put it in Settings.php.

Just that if you add an admin interface for it as well, use the correct functions. For example, don't try adding a $proxy_block = false line or similar into it during package install.
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 01:35:15 PM
Quote from: Arantor on December 27, 2009, 01:30:55 PM
I'm not saying you shouldn't put it in Settings.php.

Just that if you add an admin interface for it as well, use the correct functions. For example, don't try adding a $proxy_block = false line or similar into it during package install.

Well, the killswitch isn't added on installation since that wouldn't be proper. It's intended as more of a last-measure "help me, I can't get on my forum, do something!!!1!oneone" setting like in SleePy's mo (http://custom.simplemachines.org/mods/index.php?mod=986)ds (http://custom.simplemachines.org/mods/index.php?mod=867).
Title: Re: Proxy Blocker
Post by: Arantor on December 27, 2009, 01:38:27 PM
You're missing what I'm saying.

To keep it easy for users, define the variable to false in installation, so users only have to change 'false' to 'true'. Easier to explain that than to explain how to add a new line.

Alternative solution, don't invoke it during maintenance mode.
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 01:52:25 PM
Quote from: Arantor on December 27, 2009, 01:38:27 PM
You're missing what I'm saying.

To keep it easy for users, define the variable to false in installation, so users only have to change 'false' to 'true'. Easier to explain that than to explain how to add a new line.

Alternative solution, don't invoke it during maintenance mode.

Alright, now I get it.
Title: Re: Proxy Blocker
Post by: Arantor on December 27, 2009, 01:53:57 PM
Just going from experience. There is, for example, a DB debug switch in Settings.php - $db_show_debug, but from support experience, it's easier to explain to users how to change an existing one (like $maintenance) than it is to add one that isn't there already.
Title: Re: Proxy Blocker
Post by: L'AltroWeb on December 27, 2009, 02:05:42 PM
This mod blocks also mobile connection? (i've many Italian users with mobile connection and i can't block their).
Do you have a link to test how it work?
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 02:24:01 PM
Quote from: Dark-Wolf on December 27, 2009, 02:05:42 PM
This mod blocks also mobile connection? (i've many Italian users with mobile connection and i can't block their).
Do you have a link to test how it work?

SMF 1.1 test ground: http://nothingimportant.co.tv/forum/index.php

I honestly haven't tested the mod on a mobile connection, but given the conditions it checks for, it's possible.
Title: Re: Proxy Blocker
Post by: L'AltroWeb on December 27, 2009, 02:53:47 PM
Ok, seems to work fine also with anonymouse: http://anonymouse.org/cgi-bin/anon-www.cgi/http://nothingimportant.co.tv/forum/index.php :)
But, before to install i will test with an Italian mobile connection ;)
-
I've request a test to all mobile users in altervista forum: http://forum.it.altervista.org/piazza-centrale/100363-richiesto-un-un-piccolo-test-agli-utenti-con-connessione-mobile.html#post704550
and i think this is interesting: http://forum.it.altervista.org/piazza-centrale/100363-richiesto-un-un-piccolo-test-agli-utenti-con-connessione-mobile.html#post704557
-
Translated: i can't access with Opera Mini/Mobile; Skyfire; and also with Nokia browser.
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 04:01:11 PM
Quote from: Dark-Wolf on December 27, 2009, 02:53:47 PM
Ok, seems to work fine also with anonymouse: http://anonymouse.org/cgi-bin/anon-www.cgi/http://nothingimportant.co.tv/forum/index.php :)
But, before to install i will test with an Italian mobile connection ;)
-
I've request a test to all mobile users in altervista forum: http://forum.it.altervista.org/piazza-centrale/100363-richiesto-un-un-piccolo-test-agli-utenti-con-connessione-mobile.html#post704550
and i think this is interesting: http://forum.it.altervista.org/piazza-centrale/100363-richiesto-un-un-piccolo-test-agli-utenti-con-connessione-mobile.html#post704557
-
Translated: i can't access with Opera Mini/Mobile; Skyfire; and also with Nokia browser.

They're most likely failing to return a hostname.
Title: Re: Proxy Blocker
Post by: L'AltroWeb on December 27, 2009, 04:22:05 PM
Quote from: simmaster on December 27, 2009, 04:01:11 PM
They're most likely failing to return a hostname.
Isn't any way to fix (maybe an exclude list)? :)
Title: Re: Proxy Blocker
Post by: simmaster on December 27, 2009, 04:39:56 PM
Well, given it's a mobile network, every time they're reassigned a cell tower, they get a new IP address. (if they even have one, that is)
Title: Re: Proxy Blocker
Post by: poolhall on December 27, 2009, 10:25:00 PM
Quote from: simmaster on December 27, 2009, 04:39:56 PM
Well, given it's a mobile network, every time they're reassigned a cell tower, they get a new IP address. (if they even have one, that is)
With Opera mini, its users are accessing Internet via Opera software's proxy servers: http://en.wikipedia.org/wiki/Opera_Mini#Functionality
Title: Re: Proxy Blocker
Post by: infyquest on December 29, 2009, 04:20:33 AM
thanks dude, i am gonna test this on my forum
Title: Re: Proxy Blocker
Post by: simmaster on December 29, 2009, 10:47:21 AM
Alright, since this mod was intended to block anonymous proxies and it's blocking non-anonymous proxies, I'll add an option in the next version to only block users if we can't fetch their actual IP ($_SERVER['HTTP_VIA'] and such)

Please translate this string, especially to Spanish:

$txt['proxyblock_no_ip'] = 'Allow users to use the forum if we can get their real IP';
Title: Re: Proxy Blocker
Post by: lexa90 on December 29, 2009, 12:25:36 PM
Here's Serbian translation for the whole modification :)

Errors
$txt['on_proxy'] = 'Izvinjavamo se, ali administrator je blokirao pristup preko proksija. Mogući problemi ovoga mogu biti korisćenje intraneta (školski/fakultetski internet), registracija preko mobilnog telefona, ili koriščenje browsera koji ne podržava kompersiju ili ne prihvata enkodiranje stranica';

Modsettings
$txt['proxyblock_reg'] = 'Blokiraj registracije ukoliko se koristi proksi';
$txt['proxyblock_index'] = 'Blokiraj forum ukoliko se koristi proksi';


And the last string

$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';
Title: Re: Proxy Blocker
Post by: simmaster on December 29, 2009, 01:54:02 PM
Quote from: lexa90 on December 29, 2009, 12:25:36 PM
Here's Serbian translation for the whole modification :)

Errors
$txt['on_proxy'] = 'Izvinjavamo se, ali administrator je blokirao pristup preko proksija. Mogući problemi ovoga mogu biti korisćenje intraneta (školski/fakultetski internet), registracija preko mobilnog telefona, ili koriščenje browsera koji ne podržava kompersiju ili ne prihvata enkodiranje stranica';

Modsettings
$txt['proxyblock_reg'] = 'Blokiraj registracije ukoliko se koristi proksi';
$txt['proxyblock_index'] = 'Blokiraj forum ukoliko se koristi proksi';


And the last string

$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';

Thanks! I'll slip this into 1.1.5
Title: Re: Proxy Blocker
Post by: lexa90 on December 29, 2009, 02:06:52 PM
Np ;)

Awesome mod btw :)
Title: Re: Proxy Blocker
Post by: Mr. Pirate on December 29, 2009, 11:54:17 PM
i get blocked from my forum with or without a proxy?
Title: Re: Proxy Blocker
Post by: simmaster on December 30, 2009, 02:36:38 PM
Quote from: seenz on December 29, 2009, 11:54:17 PM
i get blocked from my forum with or without a proxy?

Use the killswitch and uninstall the mod. If you're behind any kind of proxy server, have no HTTP_CONNECTION set, or can't accept encoding, you will get blocked. The connection/encoding related options will be removed in 1.1.5
Title: Re: Proxy Blocker
Post by: simmaster on December 30, 2009, 03:29:24 PM
2.0 is almost out. Here's a changelog:

[+] - Added feature
[-] - Removed feature
[*] - Bugfix
[%] - Security patch/new blocked proxy

v1.99 (2.0pre)
[*] More empty() checks to avoid killing your error log
[*] Deprecated the http-connection/accept-encoding checks
[+] Added language strings:
      [++] Serbian_Cyrillic
      [++] Serbian_Cyrillic-UTF8
      [++] Serbian_Latin
      [++] Serbian_Latin-UTF8
[+] Allows users whose IPs we can catch to register
[+] Add $kill_proxyblocker = 0 to the Settings file to make it easier for new admins to kill it
[*] Sync the version elements across all the mod files
[+] Common edits between SMF 1.1 and 2.0 are in a common.xml mod file
[*] Single quotes!
[*] Convert to strpos() for sanity's sake.
[*] Fixed a coding issue with checking if we can get their IP
[*] Use gethostbyaddr() only if mod is enabled


In progress

[+] Set a session for captured proxies so we don't kill your database
[+] Allowed IP list


I can't release it until I have a Spanish translation for:

$txt['proxyblock_no_ip'] = 'Allow users to use the forum if we can get their real IP';
$txt['proxyblock_allowed'] = 'Allowed IP addresses (separated by a comma and space)';
Title: Re: Proxy Blocker
Post by: Trevor Hale on December 30, 2009, 06:43:02 PM
Is there anyway that you could possibly add a section where we could "Specify allowed IP's" For some reason I have 1 user who gets blocked when I turn this on, and he said he is not behind a proxy.

Best regards,

Trev
Title: Re: Proxy Blocker
Post by: simmaster on December 30, 2009, 07:04:05 PM
Quote from: Trevor Hale on December 30, 2009, 06:43:02 PM
Is there anyway that you could possibly add a section where we could "Specify allowed IP's" For some reason I have 1 user who gets blocked when I turn this on, and he said he is not behind a proxy.

Best regards,

Trev

I'll add that into my 1.1.5 todo. See if the experimental 1.1.5 mod unblocks him.

EDIT: Jumping this to 1.2 because of the number of edits made in the changelog, plus the fact that I'm working on listing the captured proxies. The experimental 1.1.5 is still attached, but you won't find the "Unblock if we can get IP" option if you're using SMF 1.1
Title: Re: Proxy Blocker
Post by: Mr. Pirate on December 30, 2009, 10:19:19 PM
sorry i should of clarified. I get blocked from registering on my forum with or without a proxy?
Title: Re: Proxy Blocker
Post by: simmaster on December 31, 2009, 02:00:18 AM
Try 1.1.5 experimental and see if you're unblocked, or wait for 1.2 and add yourself to the exclude list.
Title: Re: Proxy Blocker
Post by: Trevor Hale on December 31, 2009, 11:45:50 AM
Fantastic support,  I will wait for your 1.2 with the exception list, and then try that.. 

Thanks again, and Happy New Year,

Trev
Title: Re: Proxy Blocker
Post by: Mr. Pirate on December 31, 2009, 08:34:35 PM
this proxy blocker doesnt even work version 1.1.4 blocked me from registering with or without a proxy and version 1.1.5 experimental doesnt even block registration using a proxy  >:(
Title: Re: Proxy Blocker
Post by: atokar on December 31, 2009, 09:34:15 PM
The mod does not block Tor. Using FFx 3.5 on GNU/Linux with Privoxy and Tor, I can browse my local forum just fine.

Another concern is that the mod does gethostbyaddr in both index.php and Register.php even if the corresponding option is disabled. For index.php, I think you could fix it by replacing:

// What if we're on a proxy?
$hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if(
!empty($modSettings['proxyblock_index'])
&& empty($kill_proxyblocker)
&& (!$hostaddr
|| $hostaddr == "."
|| empty($_SERVER['HTTP_ACCEPT_ENCODING'])
|| !empty($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_X_FORWARDED'])
|| !empty($_SERVER['HTTP_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_VIA'])
|| in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
|| empty($_SERVER['HTTP_CONNECTION'])
|| stripos($hostaddr, "tor-exit")
|| IsTorExitPoint())
)


with:

// What if we're on a proxy?
if(
!empty($modSettings['proxyblock_index'])
&& empty($kill_proxyblocker)
&& (($hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && (!$hostaddr
|| $hostaddr == "."
|| empty($_SERVER['HTTP_ACCEPT_ENCODING'])
|| !empty($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_X_FORWARDED'])
|| !empty($_SERVER['HTTP_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_VIA'])
|| in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
|| empty($_SERVER['HTTP_CONNECTION'])
|| stripos($hostaddr, "tor-exit")
|| IsTorExitPoint()))
)


And for Register.php just wrap the gethostbyaddr around in a conditional expression.

Another thing to note is that double quotes in SMF mods are greatly loathed (because they are slower than single quotes) and generally should be avoided.
Title: Re: Proxy Blocker
Post by: Arantor on December 31, 2009, 09:35:27 PM
Oh, and stripos is also PHP 5 only (SMF supports PHP 4)
Title: Re: Proxy Blocker
Post by: atokar on December 31, 2009, 09:40:56 PM
Quote from: Arantor on December 31, 2009, 09:35:27 PM
Oh, and stripos is also PHP 5 only (SMF supports PHP 4)

Shouldn't be a concern due to the following code in Subs-Compat.php:

if (!function_exists('stripos'))
{
function stripos($haystack, $needle, $offset = 0)
{
return strpos(strtolower($haystack), strtolower($needle), $offset);
}
}
Title: Re: Proxy Blocker
Post by: simmaster on December 31, 2009, 11:36:43 PM
Quote from: atokar on December 31, 2009, 09:34:15 PM
The mod does not block Tor. Using FFx 3.5 on GNU/Linux with Privoxy and Tor, I can browse my local forum just fine.

FFx 3.5 on Win7 32-bit with Vidalia bundle (Privoxy + Tor)
http://i45.tinypic.com/2rxab2v.jpg

Quote
Another concern is that the mod does gethostbyaddr in both index.php and Register.php even if the corresponding option is disabled. For index.php, I think you could fix it by replacing:

// What if we're on a proxy?
$hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if(
!empty($modSettings['proxyblock_index'])
&& empty($kill_proxyblocker)
&& (!$hostaddr
|| $hostaddr == "."
|| empty($_SERVER['HTTP_ACCEPT_ENCODING'])
|| !empty($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_X_FORWARDED'])
|| !empty($_SERVER['HTTP_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_VIA'])
|| in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
|| empty($_SERVER['HTTP_CONNECTION'])
|| stripos($hostaddr, "tor-exit")
|| IsTorExitPoint())
)


with:

// What if we're on a proxy?
if(
!empty($modSettings['proxyblock_index'])
&& empty($kill_proxyblocker)
&& (($hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && (!$hostaddr
|| $hostaddr == "."
|| empty($_SERVER['HTTP_ACCEPT_ENCODING'])
|| !empty($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_X_FORWARDED'])
|| !empty($_SERVER['HTTP_FORWARDED_FOR'])
|| !empty($_SERVER['HTTP_VIA'])
|| in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
|| empty($_SERVER['HTTP_CONNECTION'])
|| stripos($hostaddr, "tor-exit")
|| IsTorExitPoint()))
)


And for Register.php just wrap the gethostbyaddr around in a conditional expression.

Another thing to note is that double quotes in SMF mods are greatly loathed (because they are slower than single quotes) and generally should be avoided.

Added for fixing in 1.2

Quote from: Arantor on December 31, 2009, 09:35:27 PM
Oh, and stripos is also PHP 5 only (SMF supports PHP 4)

Quote from: atokar on December 31, 2009, 09:40:56 PM
Quote from: Arantor on December 31, 2009, 09:35:27 PM
Oh, and stripos is also PHP 5 only (SMF supports PHP 4)

Shouldn't be a concern due to the following code in Subs-Compat.php:

if (!function_exists('stripos'))
{
function stripos($haystack, $needle, $offset = 0)
{
return strpos(strtolower($haystack), strtolower($needle), $offset);
}
}


For sanity's sake, I'll change it to strpos.

Quote from: seenz on December 31, 2009, 08:34:35 PM
this proxy blocker doesnt even work version 1.1.4 blocked me from registering with or without a proxy and version 1.1.5 experimental doesnt even block registration using a proxy  >:(

Did you switch the right settings in 1.1.5?
http://i47.tinypic.com/huf13b.jpg


Guys, I'm trying to replicate the conditions you're using Proxy Blocker under. If I can't replicate them, I can't fix them.
Title: Re: Proxy Blocker
Post by: atokar on January 01, 2010, 01:07:47 PM
Some (very) bugged version of Vidalia bundle then, or shall we blame it on MS?

The following code:

gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")


returns:

206.226.251.192.80.2.2.168.192.ip-port.exitlist.torproject.org

instead of the expected "127.0.0.2".
Title: Re: Proxy Blocker
Post by: lexa90 on January 01, 2010, 01:42:44 PM
Here are the string you wanted :)

$txt['proxyblock_allowed'] = 'Dozvoljene IP adrese (ako navodite više adresa, odvojite zarezom i razmakom)';


And also, оne note :) It's not Cyrillic it's latin :)
But i'm gonna translate into cyrillic also :)

Cheers and HNY! :)

Also i made some fixes in text so here are the cyrillic and latin versions of it :)

Errors (latin)
$txt['on_proxy'] = 'Izvinjavamo se, ali administrator je blokirao pristup preko proksija. Mogući problemi ovoga mogu biti korišćenje intraneta (školski/fakultetski internet), registracija preko mobilnog telefona, ili korišćenje pretraživača koji ne podržava kompersiju ili ne prihvata enkodiranje stranica';

Modsettings(latin)
$txt['proxyblock_reg'] = 'Onemogući registracije ukoliko se koristi proksi';
$txt['proxyblock_index'] = 'Onemogući pristup forumu ukoliko se koristi proksi';


$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';
$txt['proxyblock_allowed'] = 'Dozvoljene IP adrese (ako navodite više adresa, stavite zarez i razmak između svake)';




Errors (cyrillic)
$txt['on_proxy'] = 'Извињавамо се, али администратор је блокирао приступ преко проксија. Могући проблеми овога могу бити коришћење интранета (школски/факултетски интернет), регистрација преко мобилног телефона, или коришчење претраживача који не подржава комперсију или не прихвата енкодирање страница.или коришћење претраживача који не подржава комперсију или не прихвата енкодирање страница.';

Modsettings (cyrillic)
$txt['proxyblock_reg'] = 'Онемогући регистрације уколико се користи прокси';
$txt['proxyblock_index'] = 'Онемогући приступ форуму уколико се користи прокси';


$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';
$txt['proxyblock_allowed'] = 'Дозвољене ИП адресе (ако наводите више адреса, ставите зарез и размак између сваке)';
Title: Re: Proxy Blocker
Post by: simmaster on January 01, 2010, 02:18:26 PM
Quote from: atokar on January 01, 2010, 01:07:47 PM
Some (very) bugged version of Vidalia bundle then, or shall we blame it on MS?

The following code:

gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." .
$_SERVER['SERVER_PORT'] . "." .
ReverseIPOctets($_SERVER['SERVER_ADDR']) .
".ip-port.exitlist.torproject.org")


returns:

206.226.251.192.80.2.2.168.192.ip-port.exitlist.torproject.org

instead of the expected "127.0.0.2".

Then you're probably not truly using Tor or it is misconfigured. This function uses the TorDNSEL database by converting your IP to a DNSEL hostname. If the query sent returns 127.0.0.2 (which it did for me), you are using Tor. If not, you are not connected to Tor.

Do you use Torbutton?

Quote from: lexa90 on January 01, 2010, 01:42:44 PM
Here are the string you wanted :)

$txt['proxyblock_allowed'] = 'Dozvoljene IP adrese (ako navodite više adresa, odvojite zarezom i razmakom)';


And also, оne note :) It's not Cyrillic it's latin :)
But i'm gonna translate into cyrillic also :)

Cheers and HNY! :)

Also i made some fixes in text so here are the cyrillic and latin versions of it :)

Errors (latin)
$txt['on_proxy'] = 'Izvinjavamo se, ali administrator je blokirao pristup preko proksija. Mogući problemi ovoga mogu biti korišćenje intraneta (školski/fakultetski internet), registracija preko mobilnog telefona, ili korišćenje pretraživača koji ne podržava kompersiju ili ne prihvata enkodiranje stranica';

Modsettings(latin)
$txt['proxyblock_reg'] = 'Onemogući registracije ukoliko se koristi proksi';
$txt['proxyblock_index'] = 'Onemogući pristup forumu ukoliko se koristi proksi';


$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';
$txt['proxyblock_allowed'] = 'Dozvoljene IP adrese (ako navodite više adresa, stavite zarez i razmak između svake)';




Errors (cyrillic)
$txt['on_proxy'] = 'Извињавамо се, али администратор је блокирао приступ преко проксија. Могући проблеми овога могу бити коришћење интранета (школски/факултетски интернет), регистрација преко мобилног телефона, или коришчење претраживача који не подржава комперсију или не прихвата енкодирање страница.или коришћење претраживача који не подржава комперсију или не прихвата енкодирање страница.';

Modsettings (cyrillic)
$txt['proxyblock_reg'] = 'Онемогући регистрације уколико се користи прокси';
$txt['proxyblock_index'] = 'Онемогући приступ форуму уколико се користи прокси';


$txt['proxyblock_no_ip'] = 'Omogući korisnicima pristup forumu ako saznamo njihovu pravu IP adresu';
$txt['proxyblock_allowed'] = 'Дозвољене ИП адресе (ако наводите више адреса, ставите зарез и размак између сваке)';


Thanks! I'll slip this into the next version as well. :D
Title: Re: Proxy Blocker
Post by: atokar on January 01, 2010, 03:04:02 PM
Hmm... Considering that instead of my local IP, someone from US connected to my local forum, I think I'm using Tor, thank you very much. :)
Title: Re: Proxy Blocker
Post by: simmaster on January 01, 2010, 03:39:31 PM
Again, I've tried to replicate it and was blocked successfully. If I can't replicate it, I can't fix it. As they say:
QuoteIf it ain't broke... don't fix it.
Title: Re: Proxy Blocker
Post by: Arantor on January 01, 2010, 05:17:09 PM
But it clearly is broken.
Title: Re: Proxy Blocker
Post by: simmaster on January 01, 2010, 06:25:20 PM
True, but it might be a Tor issue that's out of my control.
Title: Re: Proxy Blocker
Post by: Mr. Pirate on January 02, 2010, 04:33:19 PM
when is the new version coming out? because 1.1.4 and 1.1.5 experimental dont work on my forum.
Title: Re: Proxy Blocker
Post by: simmaster on January 02, 2010, 06:50:26 PM
No idea. It'll be out when it's out, but a few things came up in IRL which is slowing development down.
Title: Re: Proxy Blocker
Post by: DarkLite on January 04, 2010, 11:45:12 AM
Can someone confirm whether this will kill my forum and block lots of innocent people? Judging by the support requests, it might, but I thought I should ask here first.

Edit: Yeah, it blocks me. Will try this again when it's fixed.
Title: Re: Proxy Blocker
Post by: kaamaru on January 06, 2010, 05:38:15 AM
Is there a way I can allow certain ip addresses that are proxies?
Title: Re: Proxy Blocker
Post by: simmaster on January 07, 2010, 06:18:26 PM
Quote from: Calumks on January 06, 2010, 05:38:15 AM
Is there a way I can allow certain ip addresses that are proxies?

Proxy Blocker 2.0 will enable admins to allow certain IPs.
Title: Re: Proxy Blocker
Post by: ~DS~ on January 08, 2010, 12:24:21 PM
Uninstalling this BS it drag my forum very slowing. Uninstalling this making my forum run smooth and fast.
Title: Re: Proxy Blocker
Post by: simmaster on January 10, 2010, 12:54:17 PM
Sorry to hear that the script has caused such problems for your forum. The next version will have several performance-related revisions to prevent such problems.
Title: Re: Proxy Blocker
Post by: kaamaru on January 10, 2010, 05:35:35 PM
When will 2.0 be released?
Title: Re: Proxy Blocker
Post by: simmaster on January 11, 2010, 05:25:38 PM
Quote from: Calumks on January 10, 2010, 05:35:35 PM
When will 2.0 be released?

When it's ready.
Title: Re: Proxy Blocker
Post by: kaamaru on January 12, 2010, 08:57:53 AM
Any idea on when that will be? My fellow penguin :D.
Title: Re: Proxy Blocker
Post by: simmaster on January 12, 2010, 08:03:29 PM
Quote from: Calumks on January 12, 2010, 08:57:53 AM
Any idea on when that will be? My fellow penguin :D.

I would tell you, but if I missed the deadline, you'd all hound and criticize me. :P
Title: Re: Proxy Blocker
Post by: kaamaru on January 13, 2010, 05:09:59 PM
What about a deadline your aiming for which may or may not be absolutely wrong where by, if you tell me, I am bound by the © of Proxy Blocker that I may not hound or criticise you.
Title: Re: Proxy Blocker
Post by: Arantor on January 13, 2010, 05:25:33 PM
You might not but undoubtedly others will... :( This is why I tend not to give release dates on anything of my own unless I *know* it can be met.
Title: Re: Proxy Blocker
Post by: simmaster on January 13, 2010, 06:02:55 PM
For example, if I were to say it was due out a couple of days ago, there would be a couple of members posting and sending PMs about how angry they are that I couldn't meet my deadline. IRL issues and other projects of mine are biting into my development time, but I might consider releasing snapshot versions so you can use (mainly) stable pre-release versions.
Title: Re: Proxy Blocker
Post by: kaamaru on January 15, 2010, 05:38:04 PM
Ok :D.
Title: Re: Proxy Blocker
Post by: MmixX on January 28, 2010, 10:34:11 AM
is there a way the i can add an exemptions or white list for the proxy blocker?
Title: Re: Proxy Blocker
Post by: Landshark535 on February 08, 2010, 10:24:59 PM
In the next release I would like a white list by IP. I have someone who is at his house and he can't get on and no he is not going through a proxy.
Title: Re: Proxy Blocker
Post by: gamerzworld on February 13, 2010, 08:31:00 PM
Are you still working on this mod?
Title: Re: Proxy Blocker
Post by: oOo--STAR--oOo on February 16, 2010, 05:30:46 AM
Hi i have just installed this mod.. looks great.. I didnt get locked out..
But i would like a simple request..
playstation 3 users use my forums because its based off a playstation 3.

I dont have my playstation 3 to hand right now.. but will they beable to access the site using there playstation 3's browser?

I have alot of people who come in through proxy's and this is an amazing option to keep them out.

Im gonna run it for a few days see how many emails i get saying that there is something wrong.
Title: Re: Proxy Blocker
Post by: shadowcrews on February 16, 2010, 01:59:19 PM
i have uninstall this mod but now it appear this at the bottom of the page

function IsTorExitPoint() { return ( gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']) . "." . $_SERVER['SERVER_PORT'] . "." . ReverseIPOctets($_SERVER['SERVER_ADDR']) . ".ip-port.exitlist.torproject.org") == "127.0.0.2" ); } function ReverseIPOctets($inputip) { $ipoc = explode(".", $inputip); return $ipoc[3].".".$ipoc[2].".".$ipoc[1].".".$ipoc[0]; }

i try to reinstall and uninstall but still the same, please let me know how do i fix this
Title: Re: Proxy Blocker
Post by: sattninja on February 25, 2010, 05:35:34 PM
i installed the mod but with no errors but it takes my forum down with this error

Fatal error: Call to undefined function IsTorExitPoint() in /home/appfuzio/public_html/index.php  on line 225
Title: Re: Proxy Blocker
Post by: sattninja on February 28, 2010, 09:47:08 PM
anyone????
Title: Re: Proxy Blocker
Post by: Sabre™ on February 28, 2010, 09:53:57 PM
@ shadowcrews & sattninja
Check the edits in your index.php located in the root of your forum
Title: Re: Proxy Blocker
Post by: sattninja on February 28, 2010, 09:56:01 PM
what edits can we check
Title: Re: Proxy Blocker
Post by: Sabre™ on February 28, 2010, 10:06:37 PM
Check that these (http://custom.simplemachines.org/mods/index.php?action=parse;mod=2329;attach=129119;smf_version=2.0_RC2) were installed correct.
Just those edit for the index.php
Title: Re: Proxy Blocker
Post by: sattninja on February 28, 2010, 10:21:51 PM
everything checks and still getting same error

Fatal error: Call to undefined function IsTorExitPoint() in /home/appfuzio/public_html/index.php on line 226
Title: Re: Proxy Blocker
Post by: Sabre™ on February 28, 2010, 10:23:47 PM
Check the other files also then, namely the Register.php
Im guessing it's in that file, as I an get [HERE] (http://www.appfuzion.com/index.php) without a problem.

EDIT:
Also make sure your edits toward the bottom of your templates are before  ?>
Title: Re: Proxy Blocker
Post by: oOo--STAR--oOo on March 07, 2010, 01:22:52 AM
This mod locks alot of people out of the forum.. I trialed it for a week and legit members was getting locked out the forums..

I recomend that only small forums use this as it can lock members out who are legit.

Thanks for the mod didnt work for me as I wanted it to.
Title: Re: Proxy Blocker
Post by: Arantor on March 07, 2010, 08:42:20 AM
That's the thing, most users are using a proxy whether they realise it or not.
Title: Re: Proxy Blocker
Post by: ~DS~ on March 07, 2010, 08:46:25 AM
I find this mod useless.  >:(
I have a SMF user here who has this installed on their site as well as me being a member there. I had issues trying to register, login because of this damn thing.
Title: Re: Proxy Blocker
Post by: Arantor on March 07, 2010, 08:48:11 AM
Quote from: Arantor on March 07, 2010, 08:42:20 AM
That's the thing, most users are using a proxy whether they realise it or not.
Title: Re: Proxy Blocker
Post by: ~DS~ on March 07, 2010, 08:50:22 AM
Quote from: Arantor on March 07, 2010, 08:48:11 AM
Quote from: Arantor on March 07, 2010, 08:42:20 AM
That's the thing, most users are using a proxy whether they realise it or not.
Yes I know that Arantor. I don't see this being used as they won't realise they are being locked out thur you are gonna lose members that way and/or you won't be gaining members with this thing installed.
Title: Re: Proxy Blocker
Post by: Arantor on March 07, 2010, 08:52:30 AM
And therein lies the underlying problem.

You can't actually block proxies reliably. I've been saying this for months.
Title: Re: Proxy Blocker
Post by: ~DS~ on March 07, 2010, 09:04:19 AM
Quote from: Arantor on March 07, 2010, 08:52:30 AM
And therein lies the underlying problem.

You can't actually block proxies reliably. I've been saying this for months.
Oh really? I didn't know you could bypass. So there's a walkaround after all?  ;D Same for SimpleSEF as it does not increase or improve SEO either.
Title: Re: Proxy Blocker
Post by: Arantor on March 07, 2010, 09:19:52 AM
It's not so much a case of bypassing it, it's just that so many users use proxies without realising that you'll have so many false positives, and a surprisingly scary number of misses that it's just not worth the effort in the long run.
Title: Re: Proxy Blocker
Post by: George S. on March 11, 2010, 07:13:25 AM
I'm using SMF1.1.11

Is it possible to add an image at the error page.
I've searched for a solution but I can't find out how to place an image.

I think it has something to do with the following code

// What if we're on a proxy?
   $hostaddr = gethostbyaddr($_SERVER['REMOTE_ADDR']);
   if(
      !empty($modSettings['proxyblock_index'])
      && empty($kill_proxyblocker)
      && (!$hostaddr
      || $hostaddr == "."
      || empty($_SERVER['HTTP_ACCEPT_ENCODING'])
      || !empty($_SERVER['HTTP_X_FORWARDED_FOR'])
      || !empty($_SERVER['HTTP_X_FORWARDED'])
      || !empty($_SERVER['HTTP_FORWARDED_FOR'])
      || !empty($_SERVER['HTTP_VIA'])
      || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
      || empty($_SERVER['HTTP_CONNECTION'])
      || stripos($hostaddr, "tor-exit")
      || IsTorExitPoint())
   )
      fatal_lang_error('on_proxy');

- Can someone tell me if it's possible.?
- Can someone tell how to do it?
Title: Re: Proxy Blocker
Post by: Arantor on March 11, 2010, 08:36:36 AM
You could in theory modify the on_proxy language string to contain HTML for an image by adding <img src="img address"> into $txt['on_proxy']. Not sure off hand where that is though, probably Themes/default/Modifications.english.php

For example:
$txt['on_proxy'] = '<img src="http://myforum.com/accessdenied.png"> You cannot access this site through a proxy.';
Title: Re: Proxy Blocker
Post by: George S. on March 11, 2010, 09:34:15 AM
Quote from: Arantor on March 11, 2010, 08:36:36 AM
You could in theory modify the on_proxy language string to contain HTML for an image by adding <img src="img address"> into $txt['on_proxy']. Not sure off hand where that is though, probably Themes/default/Modifications.english.php

For example:
$txt['on_proxy'] = '<img src="http://myforum.com/accessdenied.png"> You cannot access this site through a proxy.';
Thanks, but I've tried that and it is not working.
Title: Re: Proxy Blocker
Post by: Arantor on March 11, 2010, 09:35:52 AM
/me bangs head against wall.

Can I ask you a question? When you go to the doctor, do you just say "I have a pain" and expect the doctor to figure out what the problem is from that?

Same applies here. Telling me it doesn't work is just the same. Tell me what it IS doing.
Title: Re: Proxy Blocker
Post by: George S. on March 11, 2010, 09:45:06 AM
Quote from: Arantor on March 11, 2010, 09:35:52 AM
/me bangs head against wall.

Can I ask you a question? When you go to the doctor, do you just say "I have a pain" and expect the doctor to figure out what the problem is from that?

Same applies here. Telling me it doesn't work is just the same. Tell me what it IS doing.
:-[

It displays the exact text from that line in the error page including al the html tags
Title: Re: Proxy Blocker
Post by: Arantor on March 11, 2010, 10:06:32 AM
In which case, no, there's no easy way of doing it without modifying the language error core - which is a BAD idea for security reasons.
Title: Re: Proxy Blocker
Post by: Foreclosurepedia on March 20, 2010, 06:43:35 PM
I am on satellite internet w/router.  When I installed and activated the mod I get the error that I am not allowed to access the site (guess it's the standard one reading no one from schools, etc.).  So, what can I do?  I own the site, server account, etc.
Title: Re: Proxy Blocker
Post by: societyofrobots on May 03, 2010, 02:10:21 AM
This seems to have stopped most of the spammers.

That said, I now see this in my error log, is this ok to ignore?
Quote
2: gethostbyaddr() [<a href='function.gethostbyaddr'>function.gethostbyaddr</a>]: Address is not a valid IPv4 or IPv6 address

I wouldn't mind the mod counting the number of proxies blocked to know how much I'm being 'attacked'.
Title: Re: Proxy Blocker
Post by: societyofrobots on May 04, 2010, 09:38:28 AM
A quick feature addition request . . . when a person is denied, can you give the option to redirect to a separate page?

On that page we can then write instructions on how to manually register for an account, ie by email to the admin or whatever.

I'm worried I'll lose legit accounts, and I think this is a good fix.
Title: Re: Proxy Blocker
Post by: Maxtor on June 20, 2010, 04:36:13 PM
Quote from: sattninja on February 28, 2010, 10:21:51 PM
everything checks and still getting same error

Fatal error: Call to undefined function IsTorExitPoint() in /home/appfuzio/public_html/index.php on line 226

ive got the same problem . http://www.simplemachines.org/community/index.php?topic=387317.0

can someone help me?
Title: Re: Proxy Blocker
Post by: shaitanfr on July 01, 2010, 11:37:29 AM
Tested on SMF 1.1.11

I leave unchecked the option: Block forum if using proxy
I check the option : Block registration if using proxy

I can register using a proxy.

Sorry, my English is always bad.
Title: Re: Proxy Blocker
Post by: DarkValentine on July 14, 2010, 10:29:32 AM
Quote from: ibrrorg on March 20, 2010, 06:43:35 PM
I am on satellite internet w/router.  When I installed and activated the mod I get the error that I am not allowed to access the site (guess it's the standard one reading no one from schools, etc.).  So, what can I do?  I own the site, server account, etc.

Satellite internet is proxy based. When you activated the mod, it basically blocked you out, even if you're already logged in.

Since you own the server account, best thing to do, would be to log into your server and restore your database files for your forum. That is if you backed up the database before installing the mod.

If not, then you would need to upload the upgrade script, and clear it out as if you were upgrading. This happened to a friend of mine who also is using this, and is stuck on a proxy.
Title: Re: Proxy Blocker
Post by: R.Bourne on August 09, 2010, 11:12:33 PM
Thank YOU for this very great and useful MOD. You have no idea how helpful it is, or do you? ;)


Don't let it die! Looking forward to your future plans.
Title: Re: Proxy Blocker
Post by: sharks on February 04, 2011, 06:37:35 PM
Very interesting mod and most useful! Please update this mod for SMF 1.1.12 with the new features that you suggested on your mod page.

Only problem is... the mod creator was last active on July 13, 2010. We're doomed! :(
Title: Re: Proxy Blocker
Post by: R.Bourne on February 07, 2011, 06:45:12 AM
Works fine on 1.12. :)
Title: Re: Proxy Blocker
Post by: sharks on February 07, 2011, 09:51:36 AM
Quote from: R.Bourne on February 07, 2011, 06:45:12 AM
Works fine on 1.12. :)
I know it works. But i'm requesting that this mod be updated with the planned features that have been advertised for its next release, which never happened.
Title: Re: Proxy Blocker
Post by: oaqm on February 24, 2011, 07:56:39 AM
Installed with no errors on 2.0RC5.

I have been awash with IPs trying to login using admin, moderator and last registered user as the ID for the last 3 days. Hopefully this will put an end to that.
Title: Re: Proxy Blocker
Post by: JoeSperrazza on May 01, 2011, 02:51:57 AM
Installs with no problems, works great (SMF 2.0), thank you!
Title: Re: Proxy Blocker
Post by: Rain Forest on May 01, 2011, 04:35:58 AM
Dutch:
$txt['on_proxy'] = 'Sorry, de administrator heeft registratie door middel van proxy geblokkeerd. Ook registraties via intranet (school connecties), mobiele telefoons of andere browsers dat niet wordt ondersteund, zijn niet mogelijk..';
$txt['proxyblock_reg'] = 'Blokkeer forum indien gast gebruik maakt van registratie';
$txt['proxyblock_index'] = 'Blokkeer forum indien gebruik van proxy';


Title: Re: Proxy Blocker
Post by: _sebas_ on June 15, 2011, 11:20:44 PM
excellent

I have a question
Do you have a problem with this mod SEO positioning and indexing tools?
Title: Re: Proxy Blocker
Post by: _sebas_ on June 16, 2011, 09:40:23 AM

???

uoops

aparently instalation is correct,
  but I see this error:

xxxxxxxxxx/foro/index.php?action=packages;sa=install2;package=ProxyBlocker_1.1.4.zip
Aplicar filtro: Mostrar solamente los mensajes de error con el mismo mensaje
512: parseModification(): The filename 'index.php' is not a full path!
Archivo: xxxxxxxxxxxxxxxxo/Sources/Subs-Package.php
Línea: 1356
Title: Re: Proxy Blocker
Post by: Jorge D. Fuentes on June 25, 2011, 08:47:21 PM
There is apparently a problem when using this mod on version 2.0.

Managesettings.php on version 2.0 needs this line:
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!

This mod is removing that line, rather than adding its modification settings under it.
As a result, other mods that need that line in order to work, are failing.  Mods like "Gamer IDs".

So perhaps a tweak is in order?  I wanna use this mod, but installing it prevents me from using other mods unless I install this last.  Savvy?
Title: Re: Proxy Blocker
Post by: lazylivin on October 08, 2011, 10:03:33 AM
Quote from: DarkValentine on July 14, 2010, 10:29:32 AM
Quote from: ibrrorg on March 20, 2010, 06:43:35 PM
I am on satellite internet w/router.  When I installed and activated the mod I get the error that I am not allowed to access the site (guess it's the standard one reading no one from schools, etc.).  So, what can I do?  I own the site, server account, etc.

Satellite internet is proxy based. When you activated the mod, it basically blocked you out, even if you're already logged in.

Since you own the server account, best thing to do, would be to log into your server and restore your database files for your forum. That is if you backed up the database before installing the mod.

If not, then you would need to upload the upgrade script, and clear it out as if you were upgrading. This happened to a friend of mine who also is using this, and is stuck on a proxy.

That is not necessary. Just go to a non proxy computer, log in and uninstall the mod.
Title: Re: Proxy Blocker
Post by: EnglishRose on December 07, 2013, 06:42:05 PM
No one has posted here for a while so I'm not sure if I'm meant to use this mod or not but I need a proxy blocker to go with Forum Firewall and this had the most downloads of the two available.

I'm using SMF 2.06 but when I try to install the mod I get these warnings (in the attachments). Can anyone please tell me what has gone wrong or how to find out what has gone wrong?

Thank you

x
Title: Re: Proxy Blocker
Post by: margarett on December 07, 2013, 06:45:59 PM
It cannot install itself due to one of several unexisting strings in index.php

You have to manually analyze that file and see if you can fix it ;)
Manual Installation of Mods (http://wiki.simplemachines.org/smf/Manual_installation_of_mods)
Title: Re: Proxy Blocker
Post by: EnglishRose on December 07, 2013, 06:49:33 PM
I have no idea how to do that, but I'll take a shot at it.  ;D

Failing that, I'll just make do with Forum Firewall and make a sign saying "Proxies Welcome"  :P

Thanks for the help and the link.
Title: Re: Proxy Blocker
Post by: margarett on December 07, 2013, 06:51:42 PM
Do backup your forum before you start! ;)
Title: Re: Proxy Blocker
Post by: Mr Robville on December 09, 2013, 02:49:11 PM
Forgive me if it has been asked before, I haven't read all comments.

Is it possible to disable the error logging just for this mod?
When it was just installed, my forum wasn't indexed by Google yet, so it was off the grid. Back then it was interesting to receive a notification that a proxy wanted to login.
But now since Google has indexed my forum, a specific IP address tries entering the forum every hour. Therefore the error log gets cluttered real fast. I prefer to keep the error log nice and clean for any real or random errors.

Other than that I'm very satisfied with it. It works like a charm. I tried to enter the forum on different places and it worked everywhere. And when I tried to enter the forum using any proxy, I received the error message. Great work!
Title: Re: Proxy Blocker
Post by: margarett on December 10, 2013, 06:03:40 AM
Yes, but you need 2 small edits to the code added by the MOD. Please note that this will prevent it from being automatically uninstalled if you wish to do so...

index.php, find:
fatal_lang_error('on_proxy');
Replace with:
fatal_lang_error('on_proxy', false);

Souces/Register.php, find:
fatal_lang_error('on_proxy');
Replace with:
fatal_lang_error('on_proxy', false);
Title: Re: Proxy Blocker
Post by: Mr Robville on December 10, 2013, 06:46:32 AM
Thanks a lot, I shall apply the edit and leave a note about the change.
Title: Re: Proxy Blocker
Post by: player.samp on March 06, 2014, 03:32:40 PM
This package is very bad. It destroyed my forum.