Extension

Archived
Forum
(read-only)


For official support, visit the official support site »

VZ Bad Behavior

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4

Back to this add-on's main page
View Other Add-ons From Eli Van Zoeren

     

Whitelisted IPs Still Getting Blocked

Support Request

Sneed's Feed & Seed
Sneed's Feed & Seed

Hey Eli!

I’ve got a list of IP addresses whitelisted in Bad Behavior, but they’re still getting blocked and logged. The whitelist is hard-coded as a config variable. Strict mode is off.

Bad Behavior 2.0.0
EE 2.11.3

Eli Van Zoeren
# 1
Developer
Eli Van Zoeren

Hey Kristen,

I realized that the syntax for specifying those whitelisted IPs in the config file wasn’t very user friendly. Not sure how you had them, but starting in v2.0.2 they can be delimited by commas, vertical bars, spaces, or you can enter them as a PHP array. Take your pick!

Let me know if that fixes it for you…I think it should.

Sneed's Feed & Seed
# 2
Sneed's Feed & Seed

Hey Eli,

I upgraded to v2.0.2 but when I convert the IPs to a PHP array in the config file I get an error:

A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: helpers/form_helper.php

Line Number: 258

Eli Van Zoeren
# 3
Developer
Eli Van Zoeren

Can you show me the config code you are using? (Just the VZBB section…)

Sneed's Feed & Seed
# 4
Sneed's Feed & Seed
$env_config['vz_bad_behavior'= array
(
 
'enabled'      => 'y',
 
'logging'      => 'n',
 
'strict'       => 'n',
 
'offsite_forms'   => 'n',
 
'whitelisted_ips'  => array
 (
  
'12.345.67.8',
  
'12.345.67.8',
  
'12.345.67.8'
 
),
 
'whitelisted_urls' => '',
 
'reverse_proxy'   => 'n',
 
'httpbl_key'     => '',
 
'httpbl_threat'   => '25',
 
'httpbl_maxage'   => '30'
); 
Eli Van Zoeren
# 5
Developer
Eli Van Zoeren

Kristen,

I just tried that exact config (with my own IP address, of course), and it worked fine. So something else must be going on as well. A couple possibilities:

1. Could there be a reverse-proxy or something that is masking your actual IP address? It’s dirty, but if you want to check what IP address Bad Behavior is seeing the request come from you can add the following on line 120 of the core.inc.php file:

var_dump($package['ip']); 

.

2. This is a long-shot, but are you sure that configuration is getting applied? It looks like you are using Master Config on this project, right – so it should really $env_config rather than just $config, etc.?

Beyond those, I’m stumped. If you want to give me FTP access to the server (send to: eli@elivz.com), I am happy to take a closer look next week when I am back from Peers (are you going, btw?).

Sneed's Feed & Seed
# 6
Sneed's Feed & Seed

Hey Eli,

I’m just gonna drop the hard-coded config and put the settings directly in the database. Hopefully I’ll be able to get this site migrated over to Craft soon so it’ll all be moot anyway.

I’m actually in New Zealand right now so alas no Peers conf for me, have fun though! Say hi to everybody for me!

Eli Van Zoeren
# 7
Developer
Eli Van Zoeren

Okay, sounds good. Let me know if you have any trouble with that setup….the IP whitelist *should* work exactly the same no matter if it’s set in the database or the config file.

Peers was great! Wish you could have been there, but New Zealand is a pretty good excuse.