Home
Help
Search
Login
Register
OPNsense Forum
»
International Forums
»
Italian - Italiano
»
Unable to fetch Firewall Rules via firewall-plugin API
« previous
next »
Print
Pages: [
1
]
Author
Topic: Unable to fetch Firewall Rules via firewall-plugin API (Read 4681 times)
Hele
Newbie
Posts: 6
Karma: 1
Unable to fetch Firewall Rules via firewall-plugin API
«
on:
July 03, 2020, 03:11:51 pm »
Ho posto la seguente domanda anche su github, la copio qui sotto, è in inglese, se crea problemi traduco.
--------------
I'm having some troubles trying to fetch fw rules. I read the dock and looked at the examples at the page
https://docs.opnsense.org/development/api/plugins/firewall.html
but i still have problems. I'm trying to use the searchRule API via python, and i can't get anything back with a simple call without any attributes, here's my code
import json, requests
KEY = "my_key"
SECRET = "my_secret"
url = "
https://192.168.2.1/api/firewall/filter/searchRule
"
r = requests.get(url, verify=False, auth=(KEY, SECRET))
print(r.text)
result is always
{"rows":[],"rowCount":0,"total":0,"current":1}
Well, i've tryed to add some attributes to the call, but nothing changes, notice that i setted "icmp_dummies_rule" as the rule description cause i thought taht searchPhrase matches that field (also there's no unique name filed available, as far as i can see) I tryed:
url = '
https://192.168.2.1/api/firewall/filter/searchRule?searchPhrase=
"icmp_dummies_rule"'
url = '
https://192.168.2.1/api/firewall/filter/searchRule?searchPhrase=icmp_dummies_rule
'
url = '
https://192.168.2.1/api/firewall/filter/searchRule?current=1&searchPhrase=
"icmp_dummies_rule"'
url = '
https://192.168.2.1/api/firewall/filter/searchRule?current=1&searchPhrase=icmp_dummies_rule
'
Also i can't pass any UUID cause i don't know the rule UUID (but i prefere to retrive all the rules for flexibility reason and cleaner code).
Any idea here?
Thanks.
--------------
Logged
shrinidhi666
Newbie
Posts: 1
Karma: 0
Re: Unable to fetch Firewall Rules via firewall-plugin API
«
Reply #1 on:
August 26, 2020, 11:23:01 am »
I too have the same problem and would like to know if you got any solution for this ?
Logged
Hele
Newbie
Posts: 6
Karma: 1
Re: Unable to fetch Firewall Rules via firewall-plugin API
«
Reply #2 on:
December 30, 2020, 03:45:48 pm »
Il plugin crea una nuova sezione sotto Firewall > Automation
Le regole di riferimento vanno inserite lì.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
International Forums
»
Italian - Italiano
»
Unable to fetch Firewall Rules via firewall-plugin API