Jump to content

Recommended Posts

First of all, I acknowledge that my solution below is just a weak crutch for not better security, but it might be all I am capably of...

 

Stupid idea?  If even worth pursuing, recommendations of the 3rd party service to query bad IPs?

<?php

//index.php

function verifyWhiteListedIP($ip)
{
    //Query local database to ensure that this IP has been recently verifed as not being bad, and return true or false.
    return true;    //or false
}

function verifyIP($ip)
{
    // Query some 3rd party DB to see if it has been blacklisted, and return true if okay, else delete from whitelist DB and return false.
    return true;    //or false
}

function confirmWhiteListIPs()
{
    // Will be called on a 24 hour cron job, and will verify whitelisted IPs are still nice using the above mentioned 3rd party DB, and delete if not
}

if(whitelisted($_SERVER['REMOTE_ADDR']) || verifyIP($_SERVER['REMOTE_ADDR'])){
    //Return HTML, JSON, etc.
}
else {sayGoodby();}

Which problem are you trying to solve? Spam? Excessive scraping? A security-related issue?

 

Completely blocking IPs based on the decision of a third-party service is, obviously, problematic, because an IP can represent anything from a single client to thousands of (innocent) users. In the worst case, you end up with a self-inflicted denial-of-service attack.

 

There are specific cases where the risk can be justified with a significant benefit (e. g. using the blacklists of The Spamhaus Project to prevent e-mail spam), but it's impossible to give any advice without knowing the context.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.