diff options
author | Sergey G. Brester <serg.brester@sebres.de> | 2023-03-15 15:03:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 15:03:48 +0100 |
commit | c7f8b75e7e013ac893daf78eacfdba98f2c9b689 (patch) | |
tree | 233e35f105e0d007673988c2673207d33f172118 | |
parent | 234660e94d0b887aef8ae11d7826420de30a9bef (diff) | |
download | fail2ban-c7f8b75e7e013ac893daf78eacfdba98f2c9b689.tar.gz |
action.d/cloudflare-token.conf: fixes #3479, url-encode args by unban
-rw-r--r-- | config/action.d/cloudflare-token.conf | 11 |
1 files changed, 6 insertions, 5 deletions
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> \ |