Уважаемые пользователи!
C 7 ноября 2020 года phpBB Group прекратила выпуск обновлений и завершила дальнейшее развитие phpBB версии 3.2.
С 1 августа 2024 года phpBB Group прекращает поддержку phpBB 3.2 на официальном сайте.
Сайт официальной русской поддержки phpBB Guru продолжит поддержку phpBB 3.2 до 31 декабря 2024 года.
С учетом этого, настоятельно рекомендуется обновить конференции до версии 3.3.

block open proxy

Ответы на вопросы, связанные с модами для phpBB 2.0.x, кроме относящихся к форуму Для авторов (phpBB 2.0.x).
_Vlad_
phpBB 1.4.1
Сообщения: 41
Стаж: 19 лет 5 месяцев

block open proxy

Сообщение _Vlad_ »

Народ, может кто уже ставил? Помогите разобраться
там в моде два файла modern и legacy
вот это modern (надо оба ставить или одним можно обойтись????)

Код: Выделить всё

############################################################## 
## MOD Title: Block Open Proxy Registrants
## MOD Author: TerraFrost < > (Jim Wigginton) http://www.frostjedi.com/phpbb
## MOD Description: Prevents those using open proxies from registering.
## MOD Version: 1.0.5
##
## Installation Level: Intermediate
## Installation Time: 4 Minutes
##
## Files To Edit: 3
##      includes/constants.php
##      includes/usercp_register.php
##      language/lang_english/lang_main.php
##
## Included Files: 3
##      proxy/connect.php
##      proxy/serve.php
##      proxy/index.htm
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##   Often used by those with less-than-altruistic desires, publicly accessible proxies (alternatively 
##   known as open proxies) enable people to alter their IP address at their leisure, effectively
##   rendering IP-based bans useless.
##
##   The Modern version of the Block Open Proxy Registrants MOD attempts to remedy this problem by
##   checking to see if the IP address in question actually can be used as a proxy.  The chief
##   disadvantage of this version (and the reason why a legacy version exists) is that it requires
##   PHP 4, at minimum, to run (it needs PHP4's CLI executable to spawn child processes).
##
##   Also, this MOD requires the path to the PHP CLI executable be correct.  If it isn't, those using
##   open proxies will be able to register irregardless.  The default path of this MOD is the default
##   path of the PHP CLI executable in Linux.  If that's not the correct path, and you're using Linux,
##   the instructions in this post will tell you how to find the correct path:
##   http://us2.php.net/features.commandline#31360
##
##   If you're using Windows, the default path is c:\php\cli\php.  If that's not the actual path, you'll
##   have to contact the system administrator.
##
##   A working stand-alone demo of the techniques used in this mod can be found here:
##   http://www.frostjedi.com/terra/scripts/proxy.php
##
##   The latest version of this mod can be found here:
##   http://www.frostjedi.com/terra/scripts/phpbb/proxy.zip
##
##   For support / comments / whatever, visit here:
##   http://www.frostjedi.com/phpbb/viewforum.php?f=33
##
############################################################## 
## MOD History: 
##
##     x.x.x: - add an option to allow people to submit the proxies they discover to dsbl.org.
##              (thanks, spamlinks!)
##            - cache port numbers by indexing their location in $ports?
##     1.0.5: - added a MOD to custom configure this MOD.
##            - users are only tested once per session (at most).
##            - CLI path checks are now internal to the mod
##     1.0.4: - rewrote connect.php
##            - added some ports, took away others.
##            - replaced proc_open calls with popen.
##            - proxy type now specified in lang_main.php.
##            - added cli path checks
##     1.0.3: - should now work on boards on subdomains
##              (problem found & fixed by Zeyr - thanks!)
##     1.0.2: - removed sql query that got the script_path
##            - will no longer break phpBB's running on PHP 3.0.9+
##            - message_die message moved to lang_main.php.
##     1.0.1: - MAJOR speed improvements
##            - board address no longer needs to be specified in connect.php
##     1.0.0: - initial release
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# STEP NUMBER I: Copy Files
#

#
#-----[ COPY ]------------------------------------------
#
copy proxy/connect.php to proxy/connect.php
copy proxy/serve.php to proxy/serve.php
copy proxy/index.htm to proxy/index.htm

#
# STEP NUMBER II: Prepare phpBB
#

#
#-----[ SQL ]-------------------------------------------
#
ALTER TABLE `phpbb_sessions` ADD `session_proxy` VARCHAR(6) DEFAULT '0' NOT NULL;

#
# STEP NUMBER III: Modify Files
#

#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]------------------------------------------
#
define('SESSION_METHOD_GET', 101);

#
#-----[ AFTER, ADD ]------------------------------------
#

// Block Open Proxy Registrant Parameters
define('UNTESTED_REGISTRAR', 0);
define('GOOD_REGISTRAR', 1);
define('BAD_REGISTRAR', 2);

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )


#
#-----[ BEFORE, ADD ]-----------------------------------
#
// Block Open Proxy Registrants (by TerraFrost)
// http://www.frostjedi.com/terra/scripts/proxy.php
$cli_path = '/usr/local/bin/php';

if ($userdata['session_proxy']{0} == BAD_REGISTRAR)
{
	$type=$userdata['session_proxy']{1};
	$port=hexdec(substr($userdata['session_proxy'],2));
	message_die(GENERAL_MESSAGE,strtr($lang['proxy'],array('%type%' => $lang["proxy_t$type"], '%port%' => $port)));
}

if ($mode == 'register' && !$userdata['session_logged_in'] && $userdata['session_proxy'] == UNTESTED_REGISTRAR && strstr(`$cli_path -v 2>&1`,'cli'))
{
	$ports = array(80,2301,3128,6588,8000,8080);

	if ($board_config['script_path']{strlen($board_config['script_path']) - 1} != '/')
	{
		$board_config['script_path'] .= '/';
	}
	$url = "http://{$board_config['server_name']}{$board_config['script_path']}proxy/serve.php";
	$tempath = preg_replace('/(\/(.*\/)*).*/','$1',$HTTP_SERVER_VARS['PATH_TRANSLATED']);
	foreach ($ports as $port)
	{
		$processes[] = popen("$cli_path -q $tempath"."proxy/connect.php {$HTTP_SERVER_VARS['REMOTE_ADDR']} $port $url",'r');
	}

	for ($num=0;$num<count($ports);$num++)
	{
		$temp = fgets($processes[$num]);
		if (strstr($temp,'Failed') == false)
		{
			switch ($temp)
			{
				case 'transpare':
					$temp=0;
					break;
				case 'anonymous':
					$temp=1;
					break;
				case 'high_anon':
					$temp=2;
			}
			$sql = "UPDATE " . SESSIONS_TABLE . " SET session_proxy = '" . BAD_REGISTRAR . sprintf("$temp%04x' WHERE session_id = '{$userdata['session_id']}' AND session_ip = '$user_ip'",$ports[$num]);
			$db->sql_query($sql);
			message_die(GENERAL_MESSAGE, strtr($lang['proxy'],array('%type%' => $lang["proxy_t$temp"], '%port%' => $ports[$num])));
		}
		pclose($processes[$num]);
	}
	$sql = 'UPDATE ' . SESSIONS_TABLE . " SET session_proxy = '" . GOOD_REGISTRAR . "' WHERE session_id = '{$userdata['session_id']}' AND session_ip = '$user_ip'";
	$db->sql_query($sql);
}

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
$lang['A_critical_error'] = 'A Critical Error Occurred';

#
#-----[ AFTER, ADD ]------------------------------------
#
$lang['proxy'] = 'Open %type% HTTP Proxy Server Detected on Port %port%.<p />Registration attempt blocked.';
$lang['proxy_t0'] = 'Transparent';
$lang['proxy_t1'] = 'Anonymous';
$lang['proxy_t2'] = 'High Anonymity';

#
#-----[	SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
вот это legacy

Код: Выделить всё

############################################################## 
## MOD Title: Block DSBL Blacklisted Registrants
## MOD Author: TerraFrost < > (Jim Wigginton) http://www.frostjedi.com/phpbb
## MOD Description: Prevents those using open proxies from registering.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 1 Minutes
##
## Files To Edit: 2
##      includes/usercp_register.php
##      language/lang_english/lang_main.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##   Often used by those with less-than-altruistic desires, publicly accessible proxies (alternatively 
##   known as open proxies) enable people to alter their IP address at their leisure, effectively
##   rendering IP-based bans useless.
##
##   The Legacy version of the Block Open Proxy Registrants MOD attempts to remedy this problem, while
##   at the same time, maintaining the minimum phpBB compatibility requirements, by checking the IP
##   address of every user who registers against the Distributed Server Boycott List (DSBL for short).
##   The chief disadvantage of this method is that, although the DSBL is well maintained, it is by no
##   means comprehensive and will not flush everyone out.
##
##   More information on the DSBL can be found here:
##   http://dsbl.org/main
##
##   The latest version of this mod can be found here:
##   http://www.frostjedi.com/terra/scripts/phpbb/proxy.zip
##
##   For support / comments / whatever, visit here:
##   http://www.frostjedi.com/phpbb/viewforum.php?f=33
##
############################################################## 
## MOD History: 
##
##     1.0.0: - initial release
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#
$error = FALSE;
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];

#
#-----[ AFTER, ADD ]------------------------------------
#

// Block DSBL Blacklisted Registrants (by TerraFrost)
// http://www.frostjedi.com/terra/scripts/proxy.php
if ($mode == 'register')
{
	list($a, $b, $c, $d) = explode('.',$HTTP_SERVER_VARS['REMOTE_ADDR']);
	if (gethostbyname("$d.$c.$b.$a.list.dsbl.org") != "$d.$c.$b.$a.list.dsbl.org")
	{
		message_die(GENERAL_MESSAGE, strtr($lang['dsbl'],array('%url%' => "http://dsbl.org/listing?{$HTTP_SERVER_VARS['REMOTE_ADDR']}")));
	}
}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
$lang['A_critical_error'] = 'A Critical Error Occurred';

#
#-----[ AFTER, ADD ]------------------------------------
#
$lang['dsbl'] = 'Your IP address is on the <a href="%url%">Distributed Server Boycott List</a>. <p />Registration attempt blocked.';

#
#-----[	SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Добавлено спустя 31 минуту 22 секунды:

исходник здесь: http://www.phpbbhacks.com/download/2961
MiksIr
phpBB 1.0.0
Сообщения: 5
Стаж: 19 лет 2 месяца

Сообщение MiksIr »

Первый мод проверяет прокси методом коннекта на IP пришедшего на стандартные прокси-порты, второй - проверкой адреса в черных списках. Первый надежнее, но теоретически может занимать очень много времени... имхо, его надо реализовывать совершенно по-другому. Второй можно безболезненно ставить. Можно и оба, причем так, что бы вторая проверка (legacy) срабатывала первой.
_Vlad_
phpBB 1.4.1
Сообщения: 41
Стаж: 19 лет 5 месяцев

Сообщение _Vlad_ »

а как сделать чтобы второй срабатывал первым?
Аватара пользователя
YarNET
phpBB 2.0.6
Сообщения: 518
Стаж: 19 лет 5 месяцев

Сообщение YarNET »

А для чего этот MOD? Он в админ-панели указывает IP пользователя зарегистрировавшегося?
Проверь, за что ты платишь деньги провайдеру?
Тестирование скорости соединения с INNTERNET
_Vlad_
phpBB 1.4.1
Сообщения: 41
Стаж: 19 лет 5 месяцев

Сообщение _Vlad_ »

вроде как должен блокировать юзеров, которые регится через открытые прокси
_Vlad_
phpBB 1.4.1
Сообщения: 41
Стаж: 19 лет 5 месяцев

Сообщение _Vlad_ »

MiksIr писал(а):Первый мод проверяет прокси методом коннекта на IP пришедшего на стандартные прокси-порты, второй - проверкой адреса в черных списках. Первый надежнее, но теоретически может занимать очень много времени... имхо, его надо реализовывать совершенно по-другому. Второй можно безболезненно ставить. Можно и оба, причем так, что бы вторая проверка (legacy) срабатывала первой.
Занимать много времени при регистрации? или на чем это будет сказываться ?
Как сделать что бы проверка в legacy срабатывала первой?
MiksIr
phpBB 1.0.0
Сообщения: 5
Стаж: 19 лет 2 месяца

Сообщение MiksIr »

А, эта проверка при регигстрации.. недоглядел, думал, что при постингах. Ну при регистрации еще можно... хотя надо все ж посмотреть proxy/connect.php - какой там таймаут на соединения.
Что бы проверка RBL была первой - ее код должен быть первым в includes/usercp_register.php. Посмотри, как оно по умлочанию ложится?

Вернуться в «Поддержка модов для phpBB 2.0.x»