0

I can't enable the firewall on a container via the HTTP API (container level firewall not vNIC fiewall).

I've been referencing these two links: PVE-API-Viewer and PVE-API but alas to no avail. I don't understand why when executing a GET request to the firewall/options, the answer includes only a digest and not all the information as per API-Viewer RAW. Also, every try of posting enable=1 returns 501, yet if I enable the firewall in the UI or via pvesh /nodes/ASDF/lxc/9999/firewall/options -enable 1 the REST GET to firewall/options returns besides the digest, and also the option "enable": "1".

Below is a snippet of what I tried:

APIRSPNS=$(curl -fk -d "username=$PM_USER" --data-urlencode "password=$PM_PASS" "${PM_API_URL}/access/ticket")
CSRFTKN=$(echo $APIRSPNS | jq -r '.data.CSRFPreventionToken')
TKT=$(echo $APIRSPNS | jq -r '.data.ticket')
curl -sSkX GET -b "PVEAuthCookie=${TKT}" "${PM_API_URL}/nodes/ASDF/lxc/9999/firewall/options"
curl -sSkX POST -b "PVEAuthCookie=${TKT}" -H "CSRFPreventionToken: ${CSRFTKN}" -H "Content-Type: application/json" --data '{"data":{"enable": "1"}}' "${PM_API_URL}/nodes/ASDF/lxc/9999/firewall/options"
{"data":null}
curl -fkX POST -b "PVEAuthCookie=${TKT}" -H "CSRFPreventionToken: ${CSRFTKN}" -H "Content-type: application/json" --data '{"enable": "1"}' "${PM_API_URL}/nodes/ASDF/lxc/9999/firewall/options"
curl: (22) The requested URL returned error: 501
Mitch
  • 21,223
  • 6
  • 63
  • 86

0 Answers0