Version Notes
stable release
Download this release
Release Info
Developer | Magento Core Team |
Extension | ET_IpSecurity |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.5.0
- app/code/community/ET/ET_IpSecurity_ChangeLog.txt +10 -11
- app/code/community/ET/ET_IpSecurity_Description.txt +6 -1
- app/code/community/ET/IpSecurity/Block/Adminhtml/Log.php +33 -0
- app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Grid.php +86 -0
- app/code/community/ET/IpSecurity/Model/Ipsecuritylog.php +28 -0
- app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog.php +28 -0
- app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog/Collection.php +28 -0
- app/code/community/ET/IpSecurity/Model/Observer.php +81 -22
- app/code/community/ET/IpSecurity/controllers/Adminhtml/LogController.php +72 -0
- app/code/community/ET/IpSecurity/etc/config.xml +83 -1
- app/code/community/ET/IpSecurity/etc/system.xml +20 -0
- app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-install-1.5.php +45 -0
- app/design/adminhtml/default/default/layout/et_ipsecurity.xml +29 -0
- app/locale/en_US/ET_IpSecurity.csv +10 -1
- app/locale/ru_RU/ET_IpSecurity.csv +9 -0
- package.xml +4 -4
app/code/community/ET/ET_IpSecurity_ChangeLog.txt
CHANGED
@@ -5,21 +5,23 @@ Legend:
|
|
5 |
+ added functionality
|
6 |
- removed functionality
|
7 |
|
8 |
-
TODO
|
9 |
-
+
|
10 |
-
+ add anti spam protection (to avoid a large number of e-mail|log entrys)
|
11 |
-
+ integrate anti spam serviss http://www.projecthoneypot.org/
|
12 |
|
13 |
=====================================
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
ver. 1.2.0
|
15 |
+ changed code pool from local to community
|
16 |
+ changed settings section
|
17 |
+ added maintenance page function
|
18 |
|
19 |
-
|
20 |
ver. 1.1.0
|
21 |
-
* added Helper (
|
22 |
-
|
23 |
|
24 |
ver. 1.0.9
|
25 |
+ can add comments to IP's
|
@@ -27,8 +29,5 @@ ver. 1.0.9
|
|
27 |
+ http response status 403
|
28 |
* rule templates processing error
|
29 |
|
30 |
-
|
31 |
ver. 0.1.0
|
32 |
-
+ stable release
|
33 |
-
|
34 |
-
|
5 |
+ added functionality
|
6 |
- removed functionality
|
7 |
|
8 |
+
TODO and some thoughts:
|
9 |
+
+ integrate anti spam service http://www.projecthoneypot.org/
|
|
|
|
|
10 |
|
11 |
=====================================
|
12 |
+
ver. 1.5.0
|
13 |
+
+ added table to database to store blocked ip's
|
14 |
+
+ added log grid in admin
|
15 |
+
+ added option: send notification every time on block or only on first
|
16 |
+
|
17 |
+
|
18 |
ver. 1.2.0
|
19 |
+ changed code pool from local to community
|
20 |
+ changed settings section
|
21 |
+ added maintenance page function
|
22 |
|
|
|
23 |
ver. 1.1.0
|
24 |
+
* added Helper (without it Transactional Mails - Add New Template wash't working) - actual for Magento ver. 1.4.�
|
|
|
25 |
|
26 |
ver. 1.0.9
|
27 |
+ can add comments to IP's
|
29 |
+ http response status 403
|
30 |
* rule templates processing error
|
31 |
|
|
|
32 |
ver. 0.1.0
|
33 |
+
+ stable release
|
|
|
|
app/code/community/ET/ET_IpSecurity_Description.txt
CHANGED
@@ -26,7 +26,10 @@ EN:
|
|
26 |
* You can enter IP addresses or IP masks. You can add comment to each rule.
|
27 |
127.0.0.1|My address
|
28 |
10.*.*.*|internal company IPs
|
29 |
-
* Editable message (is shown
|
|
|
|
|
|
|
30 |
|
31 |
|
32 |
RU:
|
@@ -42,6 +45,8 @@ RU:
|
|
42 |
10.*.*.*|internal company IPs
|
43 |
* ������������� ��������� (������������ ����������� �� ����� ����������� �����).
|
44 |
|
|
|
|
|
45 |
|
46 |
|
47 |
|
26 |
* You can enter IP addresses or IP masks. You can add comment to each rule.
|
27 |
127.0.0.1|My address
|
28 |
10.*.*.*|internal company IPs
|
29 |
+
* Editable message (is shown to visitors during maintenance operations.)
|
30 |
+
* List of blocked IPs is saving to database
|
31 |
+
* You can view log of blocking in admin panel
|
32 |
+
|
33 |
|
34 |
|
35 |
RU:
|
45 |
10.*.*.*|internal company IPs
|
46 |
* ������������� ��������� (������������ ����������� �� ����� ����������� �����).
|
47 |
|
48 |
+
* ���������� � ���� ������ �� ������� �� ������� ��������� ����������
|
49 |
+
* �������� ������� ���������� � ������ �����������������
|
50 |
|
51 |
|
52 |
|
app/code/community/ET/IpSecurity/Block/Adminhtml/Log.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
$this->_controller = 'adminhtml_log';
|
26 |
+
$this->_blockGroup = 'etipsecurity';
|
27 |
+
$this->_headerText = Mage::helper('etipsecurity')->__('ET IP Security log table');
|
28 |
+
|
29 |
+
parent::__construct();
|
30 |
+
$this->_removeButton('add');
|
31 |
+
|
32 |
+
}
|
33 |
+
}
|
app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Grid.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('etipsecuritylogGrid');
|
27 |
+
$this->setDefaultSort('update_time');
|
28 |
+
$this->setDefaultDir('DESC');
|
29 |
+
$this->setSaveParametersInSession(true);
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _prepareCollection()
|
33 |
+
{
|
34 |
+
$collection = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
|
35 |
+
$this->setCollection($collection);
|
36 |
+
return parent::_prepareCollection();
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _prepareColumns()
|
40 |
+
{
|
41 |
+
$this->addColumn('blocked_ip', array(
|
42 |
+
'header' => Mage::helper('etipsecurity')->__('Blocked IP'),
|
43 |
+
'align' =>'left',
|
44 |
+
'width' => '150px',
|
45 |
+
'index' => 'blocked_ip',
|
46 |
+
));
|
47 |
+
|
48 |
+
$this->addColumn('qty', array(
|
49 |
+
'header' => Mage::helper('etipsecurity')->__('Qty blocked'),
|
50 |
+
'align' =>'left',
|
51 |
+
'width' => '100px',
|
52 |
+
'index' => 'qty',
|
53 |
+
'type' => 'number',
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('create_time', array(
|
57 |
+
'header' => Mage::helper('etipsecurity')->__('First block'),
|
58 |
+
'align' =>'left',
|
59 |
+
'width' => '160px',
|
60 |
+
'index' => 'create_time',
|
61 |
+
'type' => 'datetime',
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->addColumn('update_time', array(
|
65 |
+
'header' => Mage::helper('etipsecurity')->__('Last block'),
|
66 |
+
'align' =>'left',
|
67 |
+
'width' => '160px',
|
68 |
+
'index' => 'update_time',
|
69 |
+
'type' => 'datetime',
|
70 |
+
));
|
71 |
+
|
72 |
+
$this->addColumn('blocked_from', array(
|
73 |
+
'header' => Mage::helper('etipsecurity')->__('Blocked from'),
|
74 |
+
'align' =>'left',
|
75 |
+
// 'width' => '100px',
|
76 |
+
'index' => 'blocked_from',
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
|
80 |
+
$this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
|
81 |
+
|
82 |
+
|
83 |
+
return parent::_prepareColumns();
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
app/code/community/ET/IpSecurity/Model/Ipsecuritylog.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Model_Ipsecuritylog extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->_init('etipsecurity/ipsecuritylog');
|
27 |
+
}
|
28 |
+
}
|
app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Model_Mysql4_Ipsecuritylog extends Mage_Core_Model_Mysql4_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
// Note that the logid refers to the key field in your database table.
|
26 |
+
$this->_init('etipsecurity/ipsecuritylog', 'logid');
|
27 |
+
}
|
28 |
+
}
|
app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog/Collection.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Model_Mysql4_Ipsecuritylog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->_init('etipsecurity/ipsecuritylog');
|
27 |
+
}
|
28 |
+
}
|
app/code/community/ET/IpSecurity/Model/Observer.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
|
17 |
* @contacts support@etwebsolutions.com
|
18 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
-
*/
|
20 |
|
21 |
class ET_IpSecurity_Model_Observer
|
22 |
{
|
@@ -31,13 +31,14 @@ class ET_IpSecurity_Model_Observer
|
|
31 |
private $storetype = null;
|
32 |
private $last_found_ip = null;
|
33 |
private $isFrontend = false;
|
|
|
34 |
|
35 |
|
36 |
-
|
37 |
{
|
38 |
}
|
39 |
-
|
40 |
-
|
41 |
{
|
42 |
$this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_page'));
|
43 |
$this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_blank');
|
@@ -45,16 +46,17 @@ class ET_IpSecurity_Model_Observer
|
|
45 |
$this->raw_block_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityfront/block');
|
46 |
|
47 |
$this->raw_except_ip_data = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/except');
|
48 |
-
|
49 |
$this->event_email = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_event');
|
50 |
$this->email_template = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_template');
|
51 |
$this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_identity');
|
52 |
$this->storetype = Mage::helper("catalog")->__("Frontend");
|
53 |
$this->isFrontend = true;
|
|
|
54 |
$this->apply_ip_check($observer);
|
55 |
}
|
56 |
-
|
57 |
-
|
58 |
{
|
59 |
$this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_page'));
|
60 |
$this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_blank');
|
@@ -65,26 +67,30 @@ class ET_IpSecurity_Model_Observer
|
|
65 |
$this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_identity');
|
66 |
$this->storetype = Mage::helper("core")->__("Admin");
|
67 |
$this->isFrontend = false;
|
|
|
68 |
$this->apply_ip_check($observer);
|
69 |
}
|
70 |
-
|
71 |
-
|
72 |
{
|
73 |
$current_ip = $_SERVER['REMOTE_ADDR'];
|
74 |
# start by allow all
|
75 |
$allow = true;
|
76 |
$allow_ips = null;
|
77 |
$block_ips = null;
|
|
|
78 |
$current_page = $this->trim_slashes(Mage::helper('core/url')->getCurrentUrl());
|
79 |
$this->redirect_page = $this->trim_slashes(Mage::app()->getStore()->getBaseUrl())."/".$this->redirect_page;
|
80 |
-
|
|
|
|
|
81 |
if(strlen($this->redirect_page)){$this->trim_slashes(Mage::getUrl('no-route'));}
|
82 |
-
|
83 |
$allow_ips = $this->_ip_raw_to_array($this->raw_allow_ip_data);
|
84 |
$block_ips = $this->_ip_raw_to_array($this->raw_block_ip_data);
|
85 |
$except_ips = $this->_ip_raw_to_array($this->raw_except_ip_data);
|
86 |
-
|
87 |
-
# look for allowed
|
88 |
if(strlen(trim($this->raw_allow_ip_data)) > 0)
|
89 |
{
|
90 |
# block all except allowed
|
@@ -108,17 +114,21 @@ class ET_IpSecurity_Model_Observer
|
|
108 |
|
109 |
if($this->redirect_blank==1 && !$allow)
|
110 |
{
|
111 |
-
if(!$allow) $this->_send();
|
112 |
header("HTTP/1.1 403 Forbidden");
|
113 |
header("Status: 403 Forbidden");
|
114 |
header("Content-type: text/html");
|
|
|
|
|
|
|
115 |
exit("Access denied for IP:<b> ".$current_ip."</b>");
|
116 |
}
|
117 |
|
118 |
if($current_page!=$this->redirect_page && !$allow)
|
119 |
{
|
120 |
header('Location: '.$this->redirect_page);
|
121 |
-
|
|
|
|
|
122 |
exit();
|
123 |
}
|
124 |
|
@@ -136,10 +146,9 @@ class ET_IpSecurity_Model_Observer
|
|
136 |
$dontloadsite = false;
|
137 |
}
|
138 |
}
|
139 |
-
|
140 |
if ($dontloadsite)
|
141 |
{
|
142 |
-
// ������� �������
|
143 |
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
144 |
header('Status: 503 Service Temporarily Unavailable');
|
145 |
header('Retry-After: 7200'); // in seconds
|
@@ -150,10 +159,9 @@ class ET_IpSecurity_Model_Observer
|
|
150 |
}
|
151 |
|
152 |
|
153 |
-
|
154 |
return $this;
|
155 |
-
|
156 |
-
|
157 |
private function find_ip($search_ip,$array)
|
158 |
{
|
159 |
$found = false;
|
@@ -173,7 +181,7 @@ class ET_IpSecurity_Model_Observer
|
|
173 |
}
|
174 |
return $found;
|
175 |
}
|
176 |
-
|
177 |
private function trim_slashes($str)
|
178 |
{
|
179 |
$str = trim($str);
|
@@ -206,7 +214,7 @@ class ET_IpSecurity_Model_Observer
|
|
206 |
);
|
207 |
|
208 |
}
|
209 |
-
|
210 |
private function _ip_raw_to_array($text)
|
211 |
{
|
212 |
$ips = preg_split("/[\n\r]+/", $text);
|
@@ -214,4 +222,55 @@ class ET_IpSecurity_Model_Observer
|
|
214 |
if(trim($ipsv)=="")unset($ips[$ipsk]);
|
215 |
return $ips;
|
216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
16 |
* @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
|
17 |
* @contacts support@etwebsolutions.com
|
18 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
|
21 |
class ET_IpSecurity_Model_Observer
|
22 |
{
|
31 |
private $storetype = null;
|
32 |
private $last_found_ip = null;
|
33 |
private $isFrontend = false;
|
34 |
+
private $alwaysNotify = false;
|
35 |
|
36 |
|
37 |
+
public function __construct()
|
38 |
{
|
39 |
}
|
40 |
+
|
41 |
+
public function apply_ip_check_frontend($observer)
|
42 |
{
|
43 |
$this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_page'));
|
44 |
$this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_blank');
|
46 |
$this->raw_block_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityfront/block');
|
47 |
|
48 |
$this->raw_except_ip_data = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/except');
|
49 |
+
|
50 |
$this->event_email = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_event');
|
51 |
$this->email_template = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_template');
|
52 |
$this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_identity');
|
53 |
$this->storetype = Mage::helper("catalog")->__("Frontend");
|
54 |
$this->isFrontend = true;
|
55 |
+
$this->alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_always');
|
56 |
$this->apply_ip_check($observer);
|
57 |
}
|
58 |
+
|
59 |
+
public function apply_ip_check_admin($observer)
|
60 |
{
|
61 |
$this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_page'));
|
62 |
$this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_blank');
|
67 |
$this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_identity');
|
68 |
$this->storetype = Mage::helper("core")->__("Admin");
|
69 |
$this->isFrontend = false;
|
70 |
+
$this->alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityfront/alwaysnotify');
|
71 |
$this->apply_ip_check($observer);
|
72 |
}
|
73 |
+
|
74 |
+
public function apply_ip_check($observer)
|
75 |
{
|
76 |
$current_ip = $_SERVER['REMOTE_ADDR'];
|
77 |
# start by allow all
|
78 |
$allow = true;
|
79 |
$allow_ips = null;
|
80 |
$block_ips = null;
|
81 |
+
$except_ips = null;
|
82 |
$current_page = $this->trim_slashes(Mage::helper('core/url')->getCurrentUrl());
|
83 |
$this->redirect_page = $this->trim_slashes(Mage::app()->getStore()->getBaseUrl())."/".$this->redirect_page;
|
84 |
+
$neednotify = true;
|
85 |
+
$scope = $this->isFrontend?'frontend':'admin';
|
86 |
+
|
87 |
if(strlen($this->redirect_page)){$this->trim_slashes(Mage::getUrl('no-route'));}
|
88 |
+
|
89 |
$allow_ips = $this->_ip_raw_to_array($this->raw_allow_ip_data);
|
90 |
$block_ips = $this->_ip_raw_to_array($this->raw_block_ip_data);
|
91 |
$except_ips = $this->_ip_raw_to_array($this->raw_except_ip_data);
|
92 |
+
|
93 |
+
# look for allowed
|
94 |
if(strlen(trim($this->raw_allow_ip_data)) > 0)
|
95 |
{
|
96 |
# block all except allowed
|
114 |
|
115 |
if($this->redirect_blank==1 && !$allow)
|
116 |
{
|
|
|
117 |
header("HTTP/1.1 403 Forbidden");
|
118 |
header("Status: 403 Forbidden");
|
119 |
header("Content-type: text/html");
|
120 |
+
$neednotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $current_ip ));
|
121 |
+
if(($this->alwaysNotify) || $neednotify)
|
122 |
+
$this->_send();
|
123 |
exit("Access denied for IP:<b> ".$current_ip."</b>");
|
124 |
}
|
125 |
|
126 |
if($current_page!=$this->redirect_page && !$allow)
|
127 |
{
|
128 |
header('Location: '.$this->redirect_page);
|
129 |
+
$neednotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $current_ip ));
|
130 |
+
if(($this->alwaysNotify) || $neednotify)
|
131 |
+
$this->_send();
|
132 |
exit();
|
133 |
}
|
134 |
|
146 |
$dontloadsite = false;
|
147 |
}
|
148 |
}
|
149 |
+
|
150 |
if ($dontloadsite)
|
151 |
{
|
|
|
152 |
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
153 |
header('Status: 503 Service Temporarily Unavailable');
|
154 |
header('Retry-After: 7200'); // in seconds
|
159 |
}
|
160 |
|
161 |
|
|
|
162 |
return $this;
|
163 |
+
}
|
164 |
+
|
165 |
private function find_ip($search_ip,$array)
|
166 |
{
|
167 |
$found = false;
|
181 |
}
|
182 |
return $found;
|
183 |
}
|
184 |
+
|
185 |
private function trim_slashes($str)
|
186 |
{
|
187 |
$str = trim($str);
|
214 |
);
|
215 |
|
216 |
}
|
217 |
+
|
218 |
private function _ip_raw_to_array($text)
|
219 |
{
|
220 |
$ips = preg_split("/[\n\r]+/", $text);
|
222 |
if(trim($ipsv)=="")unset($ips[$ipsk]);
|
223 |
return $ips;
|
224 |
}
|
225 |
+
|
226 |
+
|
227 |
+
protected function saveToLog($params = array())
|
228 |
+
{
|
229 |
+
$neednotify = true;
|
230 |
+
|
231 |
+
if (!((isset($params['blocked_ip'])) && (strlen(trim($params['blocked_ip']))>0)))
|
232 |
+
$params['blocked_ip'] = $_SERVER['REMOTE_ADDR'];
|
233 |
+
|
234 |
+
if (!((isset($params['blocked_from'])) && (strlen(trim($params['blocked_from']))>0)))
|
235 |
+
$params['blocked_from'] = 'undefined';
|
236 |
+
|
237 |
+
$now = now();
|
238 |
+
|
239 |
+
$logtable = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
|
240 |
+
$logtable->getSelect()->where('blocked_from=?',$params['blocked_from'])->where('blocked_ip=?',$params['blocked_ip']);
|
241 |
+
|
242 |
+
if (count($logtable)>0)
|
243 |
+
{
|
244 |
+
foreach($logtable as $row)
|
245 |
+
{
|
246 |
+
$timesBlocked = $row->getData('qty') + 1;
|
247 |
+
$row->setData('qty', $timesBlocked);
|
248 |
+
$row->setData('update_time', $now);
|
249 |
+
$row->save();
|
250 |
+
if (($timesBlocked%10) == 0)
|
251 |
+
$neednotify = true;
|
252 |
+
else
|
253 |
+
$neednotify = false;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
else
|
257 |
+
{
|
258 |
+
$log = Mage::getModel('etipsecurity/ipsecuritylog');
|
259 |
+
|
260 |
+
$log->setData('blocked_from', $params['blocked_from']);
|
261 |
+
$log->setData('blocked_ip', $params['blocked_ip']);
|
262 |
+
$log->setData('qty', '1');
|
263 |
+
$log->setData('create_time', $now);
|
264 |
+
$log->setData('update_time', $now);
|
265 |
+
|
266 |
+
$log->save();
|
267 |
+
$neednotify = true;
|
268 |
+
}
|
269 |
+
|
270 |
+
// if returns true - IP blocked for first time or timesBloked is 10, 20, 30 etc.
|
271 |
+
return $neednotify;
|
272 |
+
}
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
}
|
app/code/community/ET/IpSecurity/controllers/Adminhtml/LogController.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class ET_IpSecurity_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
|
22 |
+
{
|
23 |
+
|
24 |
+
protected function _initAction() {
|
25 |
+
$this->loadLayout()
|
26 |
+
->_setActiveMenu('customers')
|
27 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Customers'), Mage::helper('etipsecurity')->__('ET IP Security log'));
|
28 |
+
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function indexAction() {
|
33 |
+
$this->_initAction()
|
34 |
+
->renderLayout();
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
public function exportCsvAction()
|
39 |
+
{
|
40 |
+
$fileName = 'et_ipsecurity.csv';
|
41 |
+
$content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')
|
42 |
+
->getCsv();
|
43 |
+
|
44 |
+
$this->_sendUploadResponse($fileName, $content);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function exportXmlAction()
|
48 |
+
{
|
49 |
+
$fileName = 'et_ipsecurity.xml';
|
50 |
+
$content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')
|
51 |
+
->getXml();
|
52 |
+
|
53 |
+
$this->_sendUploadResponse($fileName, $content);
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
57 |
+
{
|
58 |
+
$response = $this->getResponse();
|
59 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
60 |
+
$response->setHeader('Pragma', 'public', true);
|
61 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
62 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
63 |
+
$response->setHeader('Last-Modified', date('r'));
|
64 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
65 |
+
$response->setHeader('Content-Length', strlen($content));
|
66 |
+
$response->setHeader('Content-type', $contentType);
|
67 |
+
$response->setBody($content);
|
68 |
+
$response->sendResponse();
|
69 |
+
die;
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
app/code/community/ET/IpSecurity/etc/config.xml
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<config>
|
24 |
<modules>
|
25 |
<ET_IpSecurity>
|
26 |
-
<version>1.
|
27 |
<descr>
|
28 |
<ru_RU><![CDATA[
|
29 |
Модуль позволяет ограничивать доступ к сайту посетителям по IP или по IP маскам.
|
@@ -45,13 +45,52 @@
|
|
45 |
<models>
|
46 |
<etipsecurity>
|
47 |
<class>ET_IpSecurity_Model</class>
|
|
|
48 |
</etipsecurity>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
</models>
|
50 |
<helpers>
|
51 |
<etipsecurity>
|
52 |
<class>ET_IpSecurity_Helper</class>
|
53 |
</etipsecurity>
|
54 |
</helpers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<template>
|
56 |
<email>
|
57 |
<etipsecurity_ipsecurityfront_email_template translate="label" module="etipsecurity">
|
@@ -70,6 +109,12 @@
|
|
70 |
|
71 |
<default>
|
72 |
<etipsecurity>
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
<ipsecuritymaintetance>
|
74 |
<enabled>0</enabled>
|
75 |
<message><![CDATA[
|
@@ -133,6 +178,17 @@
|
|
133 |
</controller_action_predispatch>
|
134 |
</events>
|
135 |
</frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
<adminhtml>
|
137 |
<events>
|
138 |
<controller_action_predispatch>
|
@@ -145,6 +201,17 @@
|
|
145 |
</observers>
|
146 |
</controller_action_predispatch>
|
147 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
<acl>
|
149 |
<resources>
|
150 |
<admin>
|
@@ -161,6 +228,14 @@
|
|
161 |
</config>
|
162 |
</children>
|
163 |
</system>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
</children>
|
165 |
</admin>
|
166 |
</resources>
|
@@ -174,5 +249,12 @@
|
|
174 |
</ET_IpSecurity>
|
175 |
</modules>
|
176 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
</adminhtml>
|
178 |
</config>
|
23 |
<config>
|
24 |
<modules>
|
25 |
<ET_IpSecurity>
|
26 |
+
<version>1.5.0</version>
|
27 |
<descr>
|
28 |
<ru_RU><![CDATA[
|
29 |
Модуль позволяет ограничивать доступ к сайту посетителям по IP или по IP маскам.
|
45 |
<models>
|
46 |
<etipsecurity>
|
47 |
<class>ET_IpSecurity_Model</class>
|
48 |
+
<resourceModel>etipsecurity_mysql4</resourceModel>
|
49 |
</etipsecurity>
|
50 |
+
<etipsecurity_mysql4>
|
51 |
+
<class>ET_IpSecurity_Model_Mysql4</class>
|
52 |
+
<entities>
|
53 |
+
<ipsecuritylog>
|
54 |
+
<table>ipsecurity_log</table>
|
55 |
+
</ipsecuritylog>
|
56 |
+
</entities>
|
57 |
+
</etipsecurity_mysql4>
|
58 |
</models>
|
59 |
<helpers>
|
60 |
<etipsecurity>
|
61 |
<class>ET_IpSecurity_Helper</class>
|
62 |
</etipsecurity>
|
63 |
</helpers>
|
64 |
+
<blocks>
|
65 |
+
<etipsecurity>
|
66 |
+
<class>ET_IpSecurity_Block</class>
|
67 |
+
</etipsecurity>
|
68 |
+
</blocks>
|
69 |
+
<resources>
|
70 |
+
<ipsecurity_setup>
|
71 |
+
<setup>
|
72 |
+
<module>ET_IpSecurity</module>
|
73 |
+
</setup>
|
74 |
+
<connection>
|
75 |
+
<use>core_setup</use>
|
76 |
+
</connection>
|
77 |
+
</ipsecurity_setup>
|
78 |
+
<etipsecurity_write>
|
79 |
+
<connection>
|
80 |
+
<use>core_write</use>
|
81 |
+
</connection>
|
82 |
+
</etipsecurity_write>
|
83 |
+
<etipsecurity_read>
|
84 |
+
<connection>
|
85 |
+
<use>core_read</use>
|
86 |
+
</connection>
|
87 |
+
</etipsecurity_read>
|
88 |
+
</resources>
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
<template>
|
95 |
<email>
|
96 |
<etipsecurity_ipsecurityfront_email_template translate="label" module="etipsecurity">
|
109 |
|
110 |
<default>
|
111 |
<etipsecurity>
|
112 |
+
<ipsecurityfront>
|
113 |
+
<email_always>0</email_always>
|
114 |
+
</ipsecurityfront>
|
115 |
+
<ipsecurityadmin>
|
116 |
+
<email_always>0</email_always>
|
117 |
+
</ipsecurityadmin>
|
118 |
<ipsecuritymaintetance>
|
119 |
<enabled>0</enabled>
|
120 |
<message><![CDATA[
|
178 |
</controller_action_predispatch>
|
179 |
</events>
|
180 |
</frontend>
|
181 |
+
<admin>
|
182 |
+
<routers>
|
183 |
+
<etipsecurity>
|
184 |
+
<use>admin</use>
|
185 |
+
<args>
|
186 |
+
<module>ET_IpSecurity</module>
|
187 |
+
<frontName>etipsecurity</frontName>
|
188 |
+
</args>
|
189 |
+
</etipsecurity>
|
190 |
+
</routers>
|
191 |
+
</admin>
|
192 |
<adminhtml>
|
193 |
<events>
|
194 |
<controller_action_predispatch>
|
201 |
</observers>
|
202 |
</controller_action_predispatch>
|
203 |
</events>
|
204 |
+
<menu>
|
205 |
+
<customer>
|
206 |
+
<children>
|
207 |
+
<etipsecurity translate="title" module="etipsecurity">
|
208 |
+
<title>ET IP Security log</title>
|
209 |
+
<action>etipsecurity/adminhtml_log</action>
|
210 |
+
<sort_order>300</sort_order>
|
211 |
+
</etipsecurity>
|
212 |
+
</children>
|
213 |
+
</customer>
|
214 |
+
</menu>
|
215 |
<acl>
|
216 |
<resources>
|
217 |
<admin>
|
228 |
</config>
|
229 |
</children>
|
230 |
</system>
|
231 |
+
<customer>
|
232 |
+
<children>
|
233 |
+
<etipsecurity translate="title" module="etipsecurity">
|
234 |
+
<title>ET IP Security log</title>
|
235 |
+
<sort_order>300</sort_order>
|
236 |
+
</etipsecurity>
|
237 |
+
</children>
|
238 |
+
</customer>
|
239 |
</children>
|
240 |
</admin>
|
241 |
</resources>
|
249 |
</ET_IpSecurity>
|
250 |
</modules>
|
251 |
</translate>
|
252 |
+
<layout>
|
253 |
+
<updates>
|
254 |
+
<etipsecurity>
|
255 |
+
<file>et_ipsecurity.xml</file>
|
256 |
+
</etipsecurity>
|
257 |
+
</updates>
|
258 |
+
</layout>
|
259 |
</adminhtml>
|
260 |
</config>
|
app/code/community/ET/IpSecurity/etc/system.xml
CHANGED
@@ -109,6 +109,16 @@
|
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
111 |
</email_identity>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
</fields>
|
113 |
</ipsecurityfront>
|
114 |
<ipsecurityadmin translate="label comment">
|
@@ -181,6 +191,16 @@
|
|
181 |
<show_in_website>1</show_in_website>
|
182 |
<show_in_store>1</show_in_store>
|
183 |
</email_identity>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
</fields>
|
185 |
</ipsecurityadmin>
|
186 |
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
111 |
</email_identity>
|
112 |
+
<email_always translate="label comment">
|
113 |
+
<label>Email always</label>
|
114 |
+
<comment>Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.</comment>
|
115 |
+
<frontend_type>select</frontend_type>
|
116 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
117 |
+
<sort_order>80</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
</email_always>
|
122 |
</fields>
|
123 |
</ipsecurityfront>
|
124 |
<ipsecurityadmin translate="label comment">
|
191 |
<show_in_website>1</show_in_website>
|
192 |
<show_in_store>1</show_in_store>
|
193 |
</email_identity>
|
194 |
+
<email_always translate="label comment">
|
195 |
+
<label>Email always</label>
|
196 |
+
<comment>Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.</comment>
|
197 |
+
<frontend_type>select</frontend_type>
|
198 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
199 |
+
<sort_order>80</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>1</show_in_website>
|
202 |
+
<show_in_store>1</show_in_store>
|
203 |
+
</email_always>
|
204 |
</fields>
|
205 |
</ipsecurityadmin>
|
206 |
|
app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-install-1.5.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ET Web Solutions
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
12 |
+
* versions in the future.
|
13 |
+
*
|
14 |
+
* @category ET
|
15 |
+
* @package ET_IpSecurity
|
16 |
+
* @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
|
17 |
+
* @contacts support@etwebsolutions.com
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
$installer = $this;
|
22 |
+
/* $installer Mage_Core_Model_Resource_Setup */
|
23 |
+
|
24 |
+
$installer->startSetup();
|
25 |
+
|
26 |
+
//try
|
27 |
+
//{
|
28 |
+
$installer->run("
|
29 |
+
DROP TABLE IF EXISTS {$this->getTable('ipsecurity_log')};
|
30 |
+
CREATE TABLE {$this->getTable('ipsecurity_log')}
|
31 |
+
(
|
32 |
+
`logid` int(11) NOT NULL AUTO_INCREMENT,
|
33 |
+
`blocked_from` varchar(50) NOT NULL,
|
34 |
+
`blocked_ip` varchar(23) NOT NULL,
|
35 |
+
`qty` int(11) unsigned NOT NULL DEFAULT '0',
|
36 |
+
`create_time` datetime NOT NULL,
|
37 |
+
`update_time` datetime NOT NULL,
|
38 |
+
PRIMARY KEY (`logid`),
|
39 |
+
KEY `blocked_from` (`blocked_from`),
|
40 |
+
KEY `blocked_ip` (`blocked_ip`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ip security log - count of block qty' AUTO_INCREMENT=1 ;
|
42 |
+
");
|
43 |
+
//}catch(Exception $e){}
|
44 |
+
|
45 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/et_ipsecurity.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* ET Web Solutions
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
*
|
10 |
+
* DISCLAIMER
|
11 |
+
*
|
12 |
+
* Do not edit or add to this file if you wish to upgrade to newer
|
13 |
+
* versions in the future.
|
14 |
+
*
|
15 |
+
* @category ET
|
16 |
+
* @package ET_IpSecurity
|
17 |
+
* @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
|
18 |
+
* @contacts support@etwebsolutions.com
|
19 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
|
23 |
+
<layout version="0.1.0">
|
24 |
+
<etipsecurity_adminhtml_log_index>
|
25 |
+
<reference name="content">
|
26 |
+
<block type="etipsecurity/adminhtml_log" name="log" />
|
27 |
+
</reference>
|
28 |
+
</etipsecurity_adminhtml_log_index>
|
29 |
+
</layout>
|
app/locale/en_US/ET_IpSecurity.csv
CHANGED
@@ -21,4 +21,13 @@
|
|
21 |
"Message","Message"
|
22 |
"Reminder message","Reminder message"
|
23 |
"This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on."
|
24 |
-
"For frontend only.","For frontend only."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
"Message","Message"
|
22 |
"Reminder message","Reminder message"
|
23 |
"This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on."
|
24 |
+
"For frontend only.","For frontend only."
|
25 |
+
"Email always","Email always"
|
26 |
+
"Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.","Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10."
|
27 |
+
"ET IP Security log","ET IP Security log"
|
28 |
+
"ET IP Security log table","ET IP Security log table"
|
29 |
+
"Blocked IP","Blocked IP"
|
30 |
+
"Qty blocked","Qty blocked"
|
31 |
+
"First block","First block"
|
32 |
+
"Last block","Last block"
|
33 |
+
"Blocked from","Blocked from"
|
app/locale/ru_RU/ET_IpSecurity.csv
CHANGED
@@ -22,3 +22,12 @@
|
|
22 |
"Reminder message","Напоминание"
|
23 |
"This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","Это сообщение будет показываться в пользовательской части для посетителей с IP адресами из списка исключений во время технического обслуживания."
|
24 |
"For frontend only.","Только для пользовательской части."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
"Reminder message","Напоминание"
|
23 |
"This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","Это сообщение будет показываться в пользовательской части для посетителей с IP адресами из списка исключений во время технического обслуживания."
|
24 |
"For frontend only.","Только для пользовательской части."
|
25 |
+
"Email always","Оповещать всегда"
|
26 |
+
"Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.","Да - оповещение будет отсылаться при каждой блокировке. Нет - оповещение будет отослано, если IP заблокирован первый раз или количество блокировок кратно 10."
|
27 |
+
"ET IP Security log","ET IP Security журнал"
|
28 |
+
"ET IP Security log table","ET IP Security журнал блокировок"
|
29 |
+
"Blocked IP","Блокированный IP"
|
30 |
+
"Qty blocked","Блокировано раз"
|
31 |
+
"First block","Первая блокировка"
|
32 |
+
"Last block","Последняя блокировка"
|
33 |
+
"Blocked from","Заблокировано в"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ET_IpSecurity</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -13,9 +13,9 @@ When blocking rule is applied user is redirected to selected CMS page or blank p
|
|
13 |
Second function: Allows to turn off frontend during maintenance operations.</description>
|
14 |
<notes>stable release</notes>
|
15 |
<authors><author><name>Jurij</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
|
16 |
-
<date>2011-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="2b67f7f1bc21e003da6246fe76462af4"/><file name="et_ipsecurity_admin.html" hash="2b67f7f1bc21e003da6246fe76462af4"/></dir></dir><file name="ET_IpSecurity.csv" hash="
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ET_IpSecurity</name>
|
4 |
+
<version>1.5.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</license>
|
7 |
<channel>community</channel>
|
13 |
Second function: Allows to turn off frontend during maintenance operations.</description>
|
14 |
<notes>stable release</notes>
|
15 |
<authors><author><name>Jurij</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
|
16 |
+
<date>2011-04-04</date>
|
17 |
+
<time>08:42:03</time>
|
18 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="et_ipsecurity.xml" hash="3e677b0e6fffcfb90d1d03dd7bc8daa8"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="2b67f7f1bc21e003da6246fe76462af4"/><file name="et_ipsecurity_admin.html" hash="2b67f7f1bc21e003da6246fe76462af4"/></dir></dir><file name="ET_IpSecurity.csv" hash="26e22ba736a937422cfc1755670e71a8"/></dir><dir name="ru_RU"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="a6f731a6903375bfc06edc6a31d67865"/><file name="et_ipsecurity_admin.html" hash="5961f9ae7d71f843d96d70c18c223222"/></dir></dir><file name="ET_IpSecurity.csv" hash="7f1e9f9b92e96f45fc45b13d0ca4e5e6"/></dir></target><target name="magecommunity"><dir name="ET"><dir name="IpSecurity"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="baef872daeaa6a195b4bab090244b16f"/></dir><file name="Log.php" hash="17f11639de5af08019be9577fd01e733"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="cfc12c6a05fcb0486bb9f3b4c2eae4d0"/></dir></dir><dir name="etc"><file name="config.xml" hash="9193293cdf069c8d881d10f85de826f2"/><file name="system.xml" hash="462b9b4d2e802a63cdeaca5448b6bc47"/></dir><dir name="Helper"><file name="Data.php" hash="08c557cd26157c317c1049d5f1366eab"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ipsecuritylog"><file name="Collection.php" hash="929fd786020e26b87f900caf0f2996f1"/></dir><file name="Ipsecuritylog.php" hash="4ec2037e5a52eaa4278ddd7ad2929dfc"/></dir><file name="Ipsecuritylog.php" hash="bb8a6ad3b612c46ef8b2fa36d2fac709"/><file name="Observer.php" hash="b64a18f85103c98da7599cedcb733521"/></dir><dir name="sql"><dir name="ipsecurity_setup"><file name="mysql4-install-1.5.php" hash="c2524c78dbb7db294d53983ca588c5bb"/></dir></dir></dir><file name="ET_IpSecurity_ChangeLog.txt" hash="b136ccc44d48b89820b617824b9a1da0"/><file name="ET_IpSecurity_Description.txt" hash="2adebaae43df777165b2ea3c9589ee73"/><file name="ET_IpSecurity_LICENSE.txt" hash="b799504264c23c11a941473d7a3e3ab7"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_IpSecurity.xml" hash="d191fe14ed772c4515519e1445af2229"/></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|