diff options
author | sebres <serg.brester@sebres.de> | 2023-03-15 15:12:25 +0100 |
---|---|---|
committer | sebres <serg.brester@sebres.de> | 2023-03-15 15:14:43 +0100 |
commit | d1d1730de01de45820db062d811d9b91f261ea83 (patch) | |
tree | 0d2025777f2607c0df5aa6ae5e7e1c99a30acb49 | |
parent | 234660e94d0b887aef8ae11d7826420de30a9bef (diff) | |
parent | 3d4bed50c2db1500365e80758c7a392b1f0ffd48 (diff) | |
download | fail2ban-d1d1730de01de45820db062d811d9b91f261ea83.tar.gz |
Merge fix #3479:
action.d/cloudflare-token.conf: url-encode args by unban
closes 'gh-3479'
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | config/action.d/cloudflare-token.conf | 11 |
2 files changed, 7 insertions, 5 deletions
@@ -12,6 +12,7 @@ ver. 1.0.3-dev-1 (20??/??/??) - development nightly edition ### Fixes * circumvent SEGFAULT in a python's socket module by getaddrinfo with disabled IPv6 (gh-3438) +* `action.d/cloudflare-token.conf` - fixes gh-3479, url-encode args by unban ### New Features and Enhancements * better auto-detection for IPv6 support (`allowipv6 = auto` by default), trying to check sysctl net.ipv6.conf.all.disable_ipv6 diff --git a/config/action.d/cloudflare-token.conf b/config/action.d/cloudflare-token.conf index 8c5c37de..287621eb 100644 --- a/config/action.d/cloudflare-token.conf +++ b/config/action.d/cloudflare-token.conf @@ -50,11 +50,12 @@ actionban = curl -s -X POST "<_cf_api_url>" \ # <time> unix timestamp of the ban time # Values: CMD # -actionunban = id=$(curl -s -X GET "<_cf_api_url>?mode=<cfmode>¬es=<notes>&configuration.target=<cftarget>&configuration.value=<ip>" \ - <_cf_api_prms> \ - | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'id'\042/){print $(i+1)}}}' \ - | tr -d ' "' \ - | head -n 1) +actionunban = id=$(curl -s -X GET "<_cf_api_url>" \ + --data-urlencode "mode=<cfmode>" --data-urlencode "notes=<notes>" --data-urlencode "configuration.target=<cftarget>" --data-urlencode "configuration.value=<ip>" \ + <_cf_api_prms> \ + | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'id'\042/){print $(i+1)}}}' \ + | tr -d ' "' \ + | head -n 1) if [ -z "$id" ]; then echo "<name>: id for <ip> cannot be found using target <cftarget>"; exit 0; fi; \ curl -s -X DELETE "<_cf_api_url>/$id" \ <_cf_api_prms> \ |