Replies: 1 comment 5 replies
-
Endpoints often have both a plural and singular form that are slightly different (explained in more detail here https://pfrest.org/ENDPOINT_TYPES/). In your case, you would use /api/v2/firewall/alias to create, read, update or delete a single firewall alias. You could use /api/v2/firewall/aliases to read, replace or delete many/all firewall aliases. Hope this helps. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I’m trying to update a firewall alias in pfSense using the pfREST API. The goal is to add an IP address to an existing alias called "wazuh_blocked_ips". However, I'm running into issues when trying to retrieve or modify the alias.
What Works
I can successfully list all aliases using:
curl -k -u user:password -X GET "https://172.16.253.121/api/v2/firewall/aliases/"
🔹 Response:
json
{
"code": 200,
"status": "ok",
"response_id": "SUCCESS",
"message": "",
"data": [
{
"id": 0,
"name": "wazuh_blocked_ips",
"type": "network",
"descr": "IPs bloqueadas por wazuh",
"address": [],
"detail": []
}
]
}
So, the alias does exist.
Issues Encountered
❌ 1. Getting Alias Details (404 Not Found)
When I try to retrieve details of a specific alias, I get a 404 error:
curl -k -u user:password -X GET "https://172.16.253.121/api/v2/firewall/alias/wazuh_blocked_ips"
🔹 Response:
<title>404 Not Found</title>404 Not Found
nginx I also tried using v1 instead of v2, but the result is the same.
❌ 2. Trying POST or PATCH Methods (405 Method Not Allowed)
Since GET didn’t work, I tried using POST (in case the API expects an ID in the body), but I got a 405 error:
curl -k -u user:password -X POST "https://172.16.253.121/api/v2/firewall/aliases"
-H "Content-Type: application/json"
-d '{
"id": 0
}'
🔹 Response:
{
"code": 405,
"status": "method not allowed",
"response_id": "ENDPOINT_METHOD_NOT_ALLOWED",
"message": "Resource at /api/v2/firewall/aliases does not support the requested HTTP method
POST
","data": []
}
What is the correct way to retrieve a single alias using the pfREST API?
How should I update an alias to add an IP address? Should I use PUT, PATCH, or another method?
Am I using the correct endpoint, or is there another preferred way to manage aliases in pfSense via pfREST?
Any guidance would be greatly appreciated! Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions