bridge .httacces IP locking failing

bridge .httacces IP locking failing

Avatar image
Dec 03, 2014
Konstantin wrote
Hey there, I am trying to lock down the bridge file with the .htaccess. However, I am unable to lock it down by IP for some reason. The SSL block works, but not the IP one. Before you ask, I am very certain that the IP is correct. Everything succeeds if remove the IP restriction, so that seems to be the only issue.
Cheers,
Konstantin
Reply
5 Answers
Avatar image
Dec 04, 2014
Support Manager agent wrote
Hello Konstantin,

Thank you for your interest

Please try to add both local and server ips to .htaccess.
If the issue still remains, please submit a ticket at:
http://support.emagicone.com/my_tickets#My-Tickets
so we could check it deeply.

Let us know how it goes
Avatar image
Dec 05, 2014
Konstantin wrote
Thanks for the help Irina.

This is the answer I got from my server admins:
"I do see your lock, be aware, however, then when running your test "https://www.xxx.com/bridge.php?task=self_test", it is not running from your IP. Since the script is running on the server via the URL it will fail with this block since the server's IP is blocked. The only way for your test to work is to allow the server IP access to the file. However, this means anyone would be able to access it via that URL. Depending on what you are trying to accomplish with this rule, you may need to change your approach.
...
Sadly, if the tool makes it's call via that URL, you can not block that URL from the internet, as then the call will not execute. Due to the server's IP being blocked from it. In this case, you may want to create a custom URL for the tool, then block access to the URL, and not the file, from all IPs but your own. Otherwise, your best option would be to leave it at just password protection."

My solution to the issue is adding the blocking of IP inside the bridge.php:

$allowed_ips = array("xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"); //your IP & apache server IP

$errors = array(
....
"ip_check" => "PHP MySQL Bridge (v.$br_ver): Please add your IP to allowed list to run bridge."
);

if (!in_array ($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
generate_error($errors['ip_check']);
}

Cheers,
Konstantin
Avatar image
Dec 08, 2014
Support Manager agent wrote
Hello Konstantin,

Thank you for your comment.

We will check with our tech department the possibility to block bridge by ips and inform you with the result

We will keep you informed how it goes
Avatar image
Dec 09, 2014
Support Manager agent wrote
Hello Konstantin,

We added the possibility to іspecify allowed ips in newest version of bridge file (you an download it form attachment)
You can add your ip at bridge file:
http://screencast.com/t/HZZIGeiG

Let us know if you have more questions
Avatar image
Dec 09, 2014
Konstantin wrote
Hey Irina,

Thanks for the assistance!

Cheers,
Konstantin