
vShield API Programming Guide
48 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,seeExample 2‐28,“ListIPsetsonascope,”onpage 25or
Example 2‐46,“Listapplicationsonagivenscope,”onpage 31.
Iftherefer en cedIPsetorapplicationSetisdeleted,therulewillthedisabledontheEdgeappliance.
Thedefaultpolicyin
effectistodeny.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>
Komentáře k této Příručce