Child pages
  • Edit Firewall Rule
Skip to end of metadata
Go to start of metadata

Ensure that the following permissions are enabled before setting firewall rules for your virtual server:

  • Create own firewall rules
  • Destroy own firewall rules
  • Read own firewall rules
  • Update own firewall rules
  • Update own virtual server
  • Read own virtual server

To edit a firewall rule, use the following request:

PUT /virtual_machines/:virtual_machine_id/firewall_rules/:id.xml
PUT /virtual_machines/:virtual_machine_id/firewall_rules/:id.json

XML Request example

curl -i -X PUT -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass -d '<firewall_rule><address>192.168.128.133</address><command>ACCEPT</command><port>70</port><protocol>TCP</protocol><network_interface_id>105</network_interface_id></firewall_rule>' http://onapp.test/virtual_machines/:virtual_machine_id/firewall_rules/:id.xml

JSON Request example

curl -i -X PUT -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"firewall_rule":{"address":"192.168.128.133","command":"ACCEPT","port":"70","protocol":"TCP","network_interface_id":"105"}}' -url http://onapp.test/virtual_machines/:virtual_machine_id/firewall_rules/:id.json

You can edit the following parameters:

address* - Set the IP address for which this rule is active.

  • Leave the empty field to apply this rule to all IPs
  • Enter hyphen-separated IPs to apply the rule to an IP range (e.g. 192.168.1.1-192.168.1.10)
  • Enter the IPs with slash to apply the rule to CIDR (e.g. 192.168.1.1/24)

command - sets the command to ACCEPT or DROP the abovementioned IPs

port - sets the port addresses

  • Leave the empty field to apply the rule to all ports
  • Enter colon-separated ports to apply the rule to a port range (e.g. 1024:1028)
  • Enter comma-separated ports to apply the rule to the list of ports (e.g. 80,443,21)

protocol - protocol type (TCP or UDP)

network_interface_id - interface of the network

 

You will get a 204 status response on success, and 404 if there is no firewall rule with a requested ID or you entered incorrect URL.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels