If this is your first visit, check our documentation. To post, register or login.

IP Blocker for v1.5.x

Started by kitcorsa on 5 Dec 2013, 1:28 PM · Views: 34,804

Results 101 to 120 of 125
24 Apr 2017, 4:46 PM
#101
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Post #101 by shopville

lat9:

Why not just put the site into maintenance mode and then create "pin-holes" for your developer IPs?

Maintenance mode does not restrict access

24 Apr 2017, 5:04 PM
#102
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Heerenveen, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Post #102 by design75

ShopVille:

Maintenance mode does not restrict access
Yes it does, I do this all the time for my dev sites
Put your own IP in the exception box, and set show the side-box, header and footer values to false.

16 Feb 2018, 8:26 PM
#103
jmberman avatar

jmberman

Zen Follower

Join Date:
May 2016
Location:
Ohio
Posts:
422
Plugin Contributions:
0

Post #103 by jmberman

The who's online replacement file breaks the who's online page.

The top bar breaks:

REFRESH LIST
Legend: Active cart Inactive cart Active no cart Inactive no cart
Inactive is Last Click >= 180s || Inactive since arrival > 540s will be removed Updating every 15 seconds. OFF 5 sec 15 sec 30 sec 1 min TEXT_WHOS_ONLINE_TIMER_FREQ5 TEXT_WHOS_ONLINE_TIMER_FREQ6 TEXT_WHOS_ONLINE_TIMER_FREQ7
Exclude Spiders? Yes No Exclude Admin IP Addresses? Yes No

Attachment 17697

17 Feb 2018, 12:51 PM
#104
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #104 by lat9

@jmberman, what version of Zen Cart? ... and what version of IP Blocker?

6 Apr 2018, 1:59 PM
#105
jmberman avatar

jmberman

Zen Follower

Join Date:
May 2016
Location:
Ohio
Posts:
422
Plugin Contributions:
0

Post #105 by jmberman

lat9:

@jmberman, what version of Zen Cart? ... and what version of IP Blocker?

1.5.4 Cart
2.1.3 Blocker

6 Apr 2018, 2:05 PM
#106
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #106 by lat9

It looks like you can solve the zc1.5.4 compatibility issue by editing /YOUR_ADMIN/whos_online.php, locating this code block

                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='0') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=0"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ0; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='5') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=5"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ1; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='15') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=15"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ2; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='30') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=30"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ3; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='60') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=60"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ4; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='300') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=300"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ5; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='600') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=600"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ6; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='840') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=840"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ7; ?></a> <br />

and changing it to

                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='0') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=0"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ0; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='5') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=5"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ1; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='15') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=15"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ2; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='30') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=30"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ3; ?></a> 
                <a class="optionClick<?php echo ($_SESSION['wo_timeout']=='60') ? ' chosen' : ''; ?>" href="<?php echo $optURL;?>t=60"><?php echo TEXT_WHOS_ONLINE_TIMER_FREQ4; ?></a> [B]<br />[/B]
 

I'll note the issue in the plugin's GitHub repository for corrective action.

6 Apr 2018, 2:43 PM
#107
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #107 by lat9

In reviewing the changes, v2.1.3 should have been tagged as supporting Zen Cart 1.5.5 or later. v2.1.2 should be used for earlier versions of Zen Cart.

9 Feb 2019, 7:38 PM
#108
hubert avatar

hubert

Zen Follower

Join Date:
Mar 2005
Posts:
229
Plugin Contributions:
0

Post #108 by hubert

Hi Lat9,

As I was reviewing my website logs I discovered 588 files which are not supposed to be there. Looking into the files I found in each one a first line like this :

[17-Dec-2018 14:28:57 America/New_York] Request URI: /index.php?main_page=discount_coupon'A=0, IP address: 185.235.15.140
or
[17-Dec-2018 22:04:17 America/New_York] Request URI: /index.php?main_page=index'A=0&cPath=66, IP address: 35.236.99.80
or 
[18-Dec-2018 23:59:31 America/New_York] Request URI: /index.php?main_page=site_map'[0], IP address: 173.44.37.114
or 
[21-Dec-2018 23:58:14 America/New_York] Request URI: /index.php?cPath=70_126&main_page=index2121121121212.1, IP address: 47.91.241.128
[21-Dec-2018 23:58:17 America/New_York] Request URI: /index.php?cPath=70_126&main_page=index%20and%201%3E1, IP address: 47.91.241.128
or even 
[30-Dec-2018 12:31:27 America/New_York] Request URI: /index.php?main_page=..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd%00&cPath=90, IP address: 14.185.32.246

All these are attempts to break in the host using zen-cart and php, especially the last one which tries to get the /etc/passwd file.

Fortunately zen-cart didn't answer these attempts but the repeated requests did put the machine on knees.

As I have fail2ban installed, I looked why fail2ban didn't deal with these.
The answer is because fail2ban doesn't know anything about zen-cart log files.
So that fail2ban manages these attempts I have to make a fail2ban configuration file, where I tell it which log file to monitor and , using a regex, how to identify bad attempts and get the ip.
With these infos, fail2ban jails the IP for a delay. Means it add the ip to the deny list of either ufw or iptables (linux firewalls).

So... I was thinking... Would it be difficult to mimic the fail2ban behaviour, i.e. monitor zen-cart log files and when a attempt is done add the IP to the block list ?

That's just a suggestion. As I have fail2ban, I will try to make a configuration file for it, but not everybody has access to this kind of tool, especially if the website is on a shared host.

thanks for reading.

Hub
P.S. : if you need my 588 log files with all kind of attempts, just tell me.

10 Feb 2019, 1:09 PM
#109
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #109 by lat9

Those same invalid accesses that are being reported by Zen Cart via debug-logs are also captured in your site's Apache logs which, from my quick read of fail2ban, is what that module looks at for its processing.

14 Jul 2019, 9:13 AM
#110
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #110 by torvista

So, after installing this mod, I blocked my own address to test it, and it didn't block it. What bit am I missing?

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

14 Jul 2019, 11:59 AM
#111
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #111 by lat9

Did you have an active session at the time you blocked the access? From code inspection, if the IP address is active at the time the 'block' was added then it's not blocked until the next attempted session.

Noting also that the updates made to the admin's whos_online.php haven't kept up with the various changes in zc156.

14 Jul 2019, 12:00 PM
#112
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #112 by torvista

...hmm, later it did block it. So, works as expected.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

19 Jul 2019, 11:07 AM
#113
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #113 by torvista

Note for testing, just delete the zenid cookie to reset the session in that browser.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

29 Jul 2019, 1:26 PM
#114
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #114 by lat9

I've just submitted v2.2.0 of the IP Blocker to the plugin moderators for review and will post back here once it's available (https://www.zen-cart.com/downloads.php?do=file&id=1814) for download.

This release contains changes associated with the following GitHub issues. Note that support is dropped for Zen Cart versions prior to 1.5.6!

#12: Correct use of PHP's serialize function.
#13: Correct "special_login" page location; issue when store is installed in a sub-directory.
#14: Restructure, using HTML5 for zc156+.
#15: Reduce changes to whos_online.php (1 change section).
#16: Correct MySQL error on initial install.
#17: Use the built-in zen_get_ip_address to retrieve the current IP address.
#18: Automatically block addresses found invalid by zen_get_ip_address
#19: Remove unused fields from the database table.
#20: Admin: Use PHP's val_function to validate any entered IP address.
#21: Add language-constant to contain the special_login page's instructions.
#22: No exit, now, from the special_login page if the configured password is blank/empty.
#23: Simplify storefront checks for wildcard IP address ranges.
#25: Admin: Display the password (hashed) as a simple input field instead of a password one.

26 Jul 2020, 9:12 PM
#116
goofygrrl2 avatar

goofygrrl2

New Zenner

Join Date:
Jun 2007
Location:
Texas
Posts:
41
Plugin Contributions:
0

Post #116 by goofygrrl2

Just installed the 2.2.0 ip blocker.
i am getting this error message on Php 7.3 zen 1.5.7

PHP Warning: A non-numeric value encountered in whos_online.php on line 75

That line is this
$xx_mins_ago = (time() - 'WHOIS_TIMER_REMOVE');

Has anyone else had this happen?

Kind Regards,
Gail
www.goodiesbygail.com

26 Jul 2020, 9:59 PM
#117
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #117 by drbyte

GoofyGrrl2:

Just installed the 2.2.0 ip blocker.
i am getting this error message on Php 7.3 zen 1.5.7

PHP Warning: A non-numeric value encountered in whos_online.php on line 75

That line is this
$xx_mins_ago = (time() - 'WHOIS_TIMER_REMOVE');

Has anyone else had this happen?

  1. There should not be quotes around 'WHOIS_TIMER_REMOVE'.
  2. That's the 1.5.6 version of the file, but you said you're using v1.5.7 (which has a very different version of that file).

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Jul 2020, 5:52 PM
#118
goofygrrl2 avatar

goofygrrl2

New Zenner

Join Date:
Jun 2007
Location:
Texas
Posts:
41
Plugin Contributions:
0

Post #118 by goofygrrl2

DrByte:

  1. There should not be quotes around 'WHOIS_TIMER_REMOVE'.
  2. That's the 1.5.6 version of the file, but you said you're using v1.5.7 (which has a very different version of that file).

Thank you I have corrected that and get this error about the same line.
PHP Warning: Use of undefined constant WHOIS_TIMER_REMOVE - assumed 'WHOIS_TIMER_REMOVE' (this will throw an Error in a future version of PHP)

Kind Regards,
Gail
www.goodiesbygail.com

27 Jul 2020, 10:51 PM
#119
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #119 by drbyte

GoofyGrrl2:

Thank you I have corrected that and get this error about the same line.
PHP Warning: Use of undefined constant WHOIS_TIMER_REMOVE - assumed 'WHOIS_TIMER_REMOVE' (this will throw an Error in a future version of PHP)
Prior to 1.5.7 that constant was defined in the whos online language file. In 1.5.7 it chooses a default if it's not defined.
I can't speak to the plugin you're using: maybe you're using a version of it that's not ready for 1.5.7?
You didn't quote the log details which explain the name of the file where the warning is occurring, so it's increasingly difficult to give any sort of useful assistance.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Jul 2020, 5:32 PM
#120
goofygrrl2 avatar

goofygrrl2

New Zenner

Join Date:
Jun 2007
Location:
Texas
Posts:
41
Plugin Contributions:
0

Post #120 by goofygrrl2

DrByte:

Prior to 1.5.7 that constant was defined in the whos online language file. In 1.5.7 it chooses a default if it's not defined.
I can't speak to the plugin you're using: maybe you're using a version of it that's not ready for 1.5.7?
You didn't quote the log details which explain the name of the file where the warning is occurring, so it's increasingly difficult to give any sort of useful assistance.

Thank you for mentioning that. I looked and compared the whos_online.php file to the 1.5.7 file and they were different so I copied the newest one from the 1.5.7 zen version and I believe that fixed it. I am not getting any error logs now. I am so sorry for the bother. I should have checked that to begin with. I do appreciate your help.

Kind Regards,
Gail
www.goodiesbygail.com