Jay
Jay
CDCloudflare Developers
Created by Jay on 8/20/2024 in #general-help
Fail2Ban Cloudflare not unbanning IPV6 addresses
we could just store the key value pair, ip:id then just unban using the ID without having to query for the IP every time
7 replies
CDCloudflare Developers
Created by Jay on 8/20/2024 in #general-help
Fail2Ban Cloudflare not unbanning IPV6 addresses
Maybe instead of that additional request, does CF respond with the ID initially when the IP is banned
7 replies
CDCloudflare Developers
Created by Jay on 8/20/2024 in #general-help
Fail2Ban Cloudflare not unbanning IPV6 addresses
So what i'm doing now is searching for the ip directly using the CF api, then extracting the ID from the response
7 replies
CDCloudflare Developers
Created by Jay on 8/20/2024 in #general-help
Fail2Ban Cloudflare not unbanning IPV6 addresses
actionunban = curl -s -X GET "<_cf_api_ip_search_url>" <_cf_api_prms> > /var/log/fail2ban-unban-full-response.log

id=$(jq -r --arg ip "<ip>" '.result[] | select(.configuration.target | test("ip6?")) | select(if .configuration.target == "ip6" then .configuration.value | gsub(":0+"; ":") == ($ip | gsub(":0+"; ":")) else .configuration.value == $ip end) | .id' /var/log/fail2ban-unban-full-response.log)

if [ -z "$id" ]; then
exit 0
fi

curl -s -X DELETE "<_cf_api_url>/$id" <_cf_api_prms> --data '{"cascade": "none"}'
actionunban = curl -s -X GET "<_cf_api_ip_search_url>" <_cf_api_prms> > /var/log/fail2ban-unban-full-response.log

id=$(jq -r --arg ip "<ip>" '.result[] | select(.configuration.target | test("ip6?")) | select(if .configuration.target == "ip6" then .configuration.value | gsub(":0+"; ":") == ($ip | gsub(":0+"; ":")) else .configuration.value == $ip end) | .id' /var/log/fail2ban-unban-full-response.log)

if [ -z "$id" ]; then
exit 0
fi

curl -s -X DELETE "<_cf_api_url>/$id" <_cf_api_prms> --data '{"cascade": "none"}'
I tried this, it unbans some IPv6 but doesn't cover all cases like the one you posted above @Chaika
7 replies
CDCloudflare Developers
Created by Jay on 8/20/2024 in #general-help
Fail2Ban Cloudflare not unbanning IPV6 addresses
actionunban = curl -s -X GET "<_cf_api_url>" \
<_cf_api_prms> > /var/log/fail2ban-unban-full-response.log

# Using jq to extract the ID associated with the IP
id=$(jq -r --arg ip "<ip>" '.result[] | select(.configuration.value == $ip) | .id' /var/log/fail2ban-unban-full-response.log)

# Conditional operation based on whether an ID was found
if [ -z "$id" ]; then
jq -r '.result[] | {id, mode, notes, configuration}' /var/log/fail2ban-unban-full-response.log
exit 0
fi

# Command to delete the rule using the extracted ID
curl -s -X DELETE "<_cf_api_url>/$id" \
<_cf_api_prms> \
--data '{"cascade": "none"}'
actionunban = curl -s -X GET "<_cf_api_url>" \
<_cf_api_prms> > /var/log/fail2ban-unban-full-response.log

# Using jq to extract the ID associated with the IP
id=$(jq -r --arg ip "<ip>" '.result[] | select(.configuration.value == $ip) | .id' /var/log/fail2ban-unban-full-response.log)

# Conditional operation based on whether an ID was found
if [ -z "$id" ]; then
jq -r '.result[] | {id, mode, notes, configuration}' /var/log/fail2ban-unban-full-response.log
exit 0
fi

# Command to delete the rule using the extracted ID
curl -s -X DELETE "<_cf_api_url>/$id" \
<_cf_api_prms> \
--data '{"cascade": "none"}'
7 replies
CDCloudflare Developers
Created by Jay on 4/27/2024 in #general-help
My Laravel API is behind cloudflare, is it possible to mitigate all DDOS attacks on the pro plan?
@Alf
17 replies
CDCloudflare Developers
Created by Jay on 4/27/2024 in #general-help
My Laravel API is behind cloudflare, is it possible to mitigate all DDOS attacks on the pro plan?
No description
17 replies
CDCloudflare Developers
Created by Jay on 4/27/2024 in #general-help
My Laravel API is behind cloudflare, is it possible to mitigate all DDOS attacks on the pro plan?
No description
17 replies
CDCloudflare Developers
Created by Jay on 4/27/2024 in #general-help
My Laravel API is behind cloudflare, is it possible to mitigate all DDOS attacks on the pro plan?
No description
17 replies
CDCloudflare Developers
Created by Jay on 4/27/2024 in #general-help
My Laravel API is behind cloudflare, is it possible to mitigate all DDOS attacks on the pro plan?
Rate limiting has been set up
17 replies