I want to list all Firewall rules per API. How can I do this ?

Started by NorbertK, June 06, 2024, 02:59:43 PM

Previous topic - Next topic
Hello all,
subject says it. I look for the way to get the current firewall rules as a json data set.

I cant get a list of all rule ids with url -k -s -u $key:$secret $URL/diagnostics/firewall/listRuleIds | jq

But of course I want the details for each rule.

Can anyone give me a hint, please ?

Thank you

Norbert
Kind regards and thanks !

Norbert

This here works (more or less)


curl -k -s -u $key:$secret $URL/firewall/filter/get_rule?5ddcbf1f0688962629f1a2166ba2ab0c

and gives with this jq

jq '. | to_entries |.[].value["action","interface","direction","ipprotocol","protocol","gateway","categories"][] |= select(.selected == 1).value| .[].value'

this result

{
  "enabled": "1",
  "sequence": "1",
  "action": {
    "pass": "Pass"
  },
  "quick": "1",
  "interface": {},
  "direction": {
    "in": "In"
  },
  "ipprotocol": {
    "inet": "IPv4"
  },
  "protocol": {
    "any": "any"
  },
  "source_net": "any",
  "source_not": "0",
  "source_port": "",
  "destination_net": "any",
  "destination_not": "0",
  "destination_port": "",
  "gateway": {
    "": "None"
  },
  "log": "0",
  "categories": {},
  "description": ""
}
Kind regards and thanks !

Norbert