mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-17 05:53:15 +02:00
Improve JSON parsing and error-handling
This commit is contained in:
@@ -291,12 +291,13 @@ norestored = 1
|
||||
|
||||
actionban = /usr/bin/curl -X POST http://127.0.0.1:8080/api/ban \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"ip\": \"<ip>\", \
|
||||
\"jail\": \"<name>\", \
|
||||
\"hostname\": \"<fq-hostname>\", \
|
||||
\"failures\": \"<failures>\", \
|
||||
\"whois\": \"%%(_whois_command)s\", \
|
||||
\"logs\": \"%%(_grep_logs)s\"}"
|
||||
-d "$(jq -n --arg ip '<ip>' \
|
||||
--arg jail '<name>' \
|
||||
--arg hostname '<fq-hostname>' \
|
||||
--arg failures '<failures>' \
|
||||
--arg whois "$(whois <ip> || echo 'missing whois program')" \
|
||||
--arg logs "$(grep <grepopts> -wF <ip> <logpath> | <greplimit>)" \
|
||||
'{ip: $ip, jail: $jail, hostname: $hostname, failures: $failures, whois: $whois, logs: $logs}')"
|
||||
|
||||
[Init]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user