logo
down
shadow

Fail2ban and CloudFlare?


Fail2ban and CloudFlare?

Content Index :

Fail2ban and CloudFlare?
Tag : security , By : user98832
Date : November 28 2020, 11:01 PM

wish help you to fix your issue
Yes, you can still use fail2ban to block IPs on your server. Since Cloudflare is a reverse proxy, however, you do want to make sure you have a solution to restore original visitor IP back to your server logs using Cloudflare and fail2ban at the same time.

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Cloudflare NS outage and having non Cloudflare NS3?


Tag : development , By : Ir0nh1de
Date : March 29 2020, 07:55 AM
may help you . Please do consider opening a support ticket for these kind of questions at CloudFlare directly.
You won't be able to leave additional name servers in place, as in ns3 and n4 -- in addition to the 2 provided CloudFlare name servers. To use our service you'd need to only have our 2 name servers in place.

fail2ban: how unban ip (using fail2ban-client)


Tag : linux , By : Pancilobak
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You need to use fail2ban-client get jail-name actionunban ipaddress That will allow you to unban an IP address. Use iptables -L -n to find the status of the correct jail-name to use?. The command you are giving: fail2ban-client get fail2ban actionunban xxx.xxx.xxx.xxx is correct given your output. Check status again to make sure it has not already been unblocked by the timeout. That would explain why the command fails.
Here is a good page Fail2ban Manual Unban Single Host (for iptables) There have been changes to the unban procedure syntax (get/set) depending on version.

Removing Aged IP Blocks From CloudFlare with CloudFlare API and PHP


Tag : php , By : kokok13
Date : March 29 2020, 07:55 AM
help you fix your problem Found some PHP code and explanation on how to do this here:
http://www.aetherweb.co.uk/automatically-expiring-cloudflare-ip-blocks-by-age/
// Read in all existing CloudFlare IP blocks then delete 
// all which are older than some specified value

$authemail = "your_cloudflare@email_address.com";
$authkey   = "your_cloudflare_auth_key";
$page      = 1;
$ids       = array(); // id's to block
$cutoff    = time()-(3600*24*28); // 28 days

while(1)
{
    $ch = curl_init("https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules?mode=block&configuration_target=ip&page=$page&per_page=10&order=created_on&direction=asc&match=all");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'X-Auth-Email: '.$authemail,
        'X-Auth-Key: '.$authkey,
        'Content-Type: application/json'
        ));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    curl_close($ch);

    $r = json_decode($response, true);

    $result = $r['result'];

    // Scan for results which were created BEFORE $cutoff
    foreach ($result as $block)
    {
        // Only remove 'block' type rules
        // And not if 'donotexpire' is in the notes
        // for the rule
        if (($block['mode'] == 'block') and (!preg_match("/donotexpire/is",$block['notes'])))
        {
            $blocktime = strtotime($block['created_on']);
            if ($blocktime <= $cutoff)
            {
                $ids[] = $block['id'];
            }
        }
    }

    $info   = $r['result_info'];
    // Result info tells us how many pages in total there are
    $page++;
    if ($info['total_pages'] < $page)
    {
        break;
    }
}

$log = '';

foreach ($ids as $id)
{
    // Delete this rule
    $ch = curl_init("https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/$id");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'X-Auth-Email: '.$authemail,
        'X-Auth-Key: '.$authkey,
        'Content-Type: application/json'
        ));
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    curl_close($ch);

    $log .= $response . "\n";
}

if (sizeof($ids)>0)
{
    mail($authemail, "CF UNBLOCK REPORT " . date('r'), $log);
}

Fail2ban not blocking IP


Tag : development , By : omaidog
Date : March 29 2020, 07:55 AM
it should still fix some issue Managed to get it working. Restarting fail2ban fixed the blocking issue. Odd as I did a fail2ban-client reload, which didn't help. Had to kill and restart the service.
Abuseipdb was fixed by changing jail.local file
action   = iptables[name=SSH, port=ssh, protocol=tcp]
           abuseipdb[abuseipdb_category="18,22"]

Request to Cloudflare DNS from Cloudflare worker not returning the DNS result


Tag : development , By : sam
Date : March 29 2020, 07:55 AM
will be helpful for those in need fetch() returns a promise for a Response object, which contains the response status, headers, and the body stream. This object is what you're seeing in your "results". In order to read the response body, you must make further calls.
Try defining a function like this:
async function fetchJsonBody(req, init) {
  let response = await fetch(req, init);
  if (!response.ok()) {
    // Did not return status 200; throw an error.
    throw new Error(response.status + " " + response.statusText);
  }

  // OK, now we can read the body and parse it as JSON.
  return await response.json();
}
let promise = fetch(requestStr, fetchInit)
let promise = fetchJsonBody(requestStr, fetchInit)
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com