Question

How to update firewall to allow all the traffic with php api

Posted December 13, 2020 403 views
PHPAPIFirewall

Hey, I am trying to update a firewall via the API, I have read the documents (https://developers.digitalocean.com/documentation/v2/#update-a-firewall) and did not find how to allow all the incoming traffic from “All IPv4” and “All IPv6” this is the data that i send (PHP array)

$data = array(
      "name" => "firewall123",
      "inbound_rules" => [
        [
          "protocol" => "tcp",
          "ports" => "444",
          "sources" => [
            "addresses" => [
              "18.0.0.0/8"
            ]
          ]
        ],
        [
          "protocol" => "tcp",
          "ports" => "443",
          "sources" => [
            "addresses" => [
              "All IPv4",
              "All IPv6"
            ]
          ]
        ]
      ],
      "droplet_ids" => [
        1234567
      ]
    );

This is the response that I received :

{
“id”: “unprocessableentity”,
“message”: “invalid address”,
“request
id”: “7b93c71d-fe51-40ca-9321-3a1dbce54321”
}

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

nvm iv got them from the firewall page with the network tap
0.0.0.0/0
::/0

Hi @d1r2a3g4o5n6,

I see that you’ve mentioned you’ve found the solution. Having said that, I’ll recommend allowing access only from that certain IP rather than to everyone.

If you are using your laptop, allow only your IP address, or if you are using another Droplet to make the API request allow just that one. Avoid giving access to the whole world wherever possible.