Skip to content
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

Firewall API return invalid outbound rules port number #171

Open
codewithcats opened this issue Sep 18, 2018 · 1 comment
Open

Firewall API return invalid outbound rules port number #171

codewithcats opened this issue Sep 18, 2018 · 1 comment

Comments

@codewithcats
Copy link

This issue happens when I retrieve Firewall data from /v2/firewalls/$FIREWALL_ID or /v2/firewalls.

My firewall outbound rules configuration looks like this:

Type Protocol Port Range Destinations
ICMP ICMP   All IPv4 All IPv6
All TCP TCP All ports All IPv4 All IPv6
All UDP UDP All ports All IPv4 All IPv6

The document is saying ports attribute will return as

The ports on which traffic will be allowed specified as a string containing a single port, a range (e.g. "8000-9000"), or "all" to open all ports for a protocol.

But what I got from are "0" for each rule entry:

{ protocol: 'icmp',
    ports: '0',
    destinations: { addresses: [Array] } },
  { protocol: 'tcp',
    ports: '0',
    destinations: { addresses: [Array] } },
  { protocol: 'udp',
    ports: '0',
    destinations: { addresses: [Array] } }

And when I try to make a request to update my firewall data using PUT to /v2/firewalls/$FIREWALL_ID by updating some fields on this returned data, I will get error 422 (Unprocessable Entity)

Now, I need to update ports values to the correct ones everytime before send PUT request. I think, at least, I should be able to use the returned data as base, make change only on wanted fields, and PUT back, without need to update unrelated fields.

@RahulShaw
Copy link

@codewithcats - Just remove the attribute "ports" for ICMP and it should work just fine.

{
    "protocol":"icmp",
    "destinations":{
        "addresses":[
            "0.0.0.0/0",
            "::/0"
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants