-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
easyrule_block_host_add works only with name 'WAN' #19
Comments
This is a limitation of the pfSense function call you are attempting to use - please review the statements about using the I suspect you'll have more success in approaching you problem by:-
The |
Thanks for the reply. Just one final question. Do I have to upload the modified config.xml using multipart/form-data ? I'm using JAVA HttpURLConnection for the requests. Tried to submit the modified config directly using the JSONString but getting server response as 500. |
It very much sounds like you are trying to work with the actual XML formatted representation of the config which I'd recommend against since the pfSense config.xml file has several format quirks that make it difficult to work with. I'd suggest that you "get" the pfSense config using fauxapi Then simply add/remove whatever rules or configuration changes you'd like to perform directly in the client side data-structure in your Java application/tool. Then turn the data-structure back into a JSON string (not XML) and POST it using the fauxapi config_set method as described here - again, I suspect this is where you are having a problem right now because it sounds like you are trying to send an XML file which is not right. |
Thanks. I'm working with JSON only. Took the JSON string using As mention here |
Okay - I think I need to better highlight something in the documentation in that case. Pay attention to the JSON payload that returns from the You can use jq to easily pull out the part you require. cat /tmp/faux-config-get-output-from-curl.json | jq .data.config > /tmp/config.json |
Marking this for enhancement to improve the documentation - N |
This above command is not working. |
The fauxapi provides a lot of debug and logging response data if you add a The Please respond with the response JSON data from a call with |
Finally! done it. Thanks for the help. |
Sounds like the |
Document update written, due in next release |
curl -X POST --silent --insecure --header "Content Type: application/json" --header "fauxapi-auth:XXX" http://XX.XXX.XXX.XX:XXXX/fauxapi/v1/\?action=function_call --data '{"function":"easyrule_block_host_add","args":["XXX.XXX.XXX.XX/32","wan","inet"]}'
Above command adds
with the name
and also creates
in rules section. But if I change the 2nd argument (i.e. int) with something different name function only creates the alias but no rules get added.
Also its very vague if the network gets blocked even if the alias and rule added with 'WAN' name. I need to change the name manually by GUI to make blocking work 100%.
The text was updated successfully, but these errors were encountered: