
vShield API Programming Guide
42 VMware, Inc.
Example 5-12. Set firewall policy to allow all
POST https://<vsm-ip>/api/2.0/networks/<internal-portgroup-vc-moref-id>/edge
<vshieldEdgeConfig xmlns="vmware.vshield.edge.2.0">
<firewallConfig>
<defaultPolicy>allow</defaultPolicy>
</firewallConfig>
</vshieldEdgeConfig>
Revert Firewall to Default
Thisreturnsthefirewalltodefaultconfiguration(deny)bydeletingexistingrules.
Example 5-13. Reset firewall to defaults
POST https://<vsm-ip>/api/2.0/networks/<internal-portgroup-vc-moref-id>/edge
<vshieldEdgeConfig xmlns="vmware.vshield.edge.2.0">
<firewallConfig />
</vshieldEdgeConfig>
Create Firewall Rule with IPset or applicationSet
TogettheIDoftheIPsetorapplicationSet,seeexampleExample 2‐18,“ListIPsetsonascope,”onpage 20
orExample 2‐36,“Listapplicationsonagivenscope,”onpage 25.
Iftherefer en cedIPsetorapplicationSetisdeleted,therulewillthedisabledontheEdgeappliance.
Thedefaultpolicy
ineffectistodeny.Theexamplebelowsetsittoallowbasedontworules.
Example 5-14. IPset or applicationSet based firewall rule
POST https://<vsm-ip>/api/2.0/networks/<internal-portgroup-vc-moref-id>/edge
<vshieldEdgeConfig xmlns="vmware.vshield.edge.2.0">
<firewallConfig>
<defaultPolicy>allow</defaultPolicy>
<enableLoggingForDefaultPolicy>false</enableLoggingForDefaultPolicy>
<blockIcmpErrors>false</blockIcmpErrors>
<rule>
<networkId>network-12</networkId>
<applicationIdentifier>application-20</applicationIdentifier>
<destinationIpAddress>
<ipAddress>10.112.2.49</ipAddress>
</destinationIpAddress>
<sourcePort>any</sourcePort>
<sourceIpAddress>
<ipsetIdentifier>ipset-2</ipsetIdentifier>
</sourceIpAddress>
<direction>in</direction>
<action>allow</action>
<enableLog>false</enableLog>
<disabled>false</disabled>
<comments>Used IpSet</comments>
</rule>
<rule>
<networkId>network-12</networkId>
<protocol>icmp</protocol>
<icmpType>address-mask-reply</icmpType>
<destinationIpAddress>
<ipAddress>10.112.2.150</ipAddress>
</destinationIpAddress>
<sourceIpAddress>
<ipAddress>any</ipAddress>
</sourceIpAddress>
<direction>out</direction>
<action>deny</action>
<enableLog>true</enableLog>
Commentaires sur ces manuels