VMware vShield VSHIELD APP 1.0 - API, vShield 5.0.1 User guide

  • Hello! I am an AI chatbot trained to assist you with the VMware vShield VSHIELD APP 1.0 - API User guide. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
vShield API Programming Guide
vShield 5.0.1
vShield App 5.0.1
vShield Edge 5.0.1
vShield Endpoint 5.0.1
This document supports the version of each product listed and
supports all subsequent versions until the document is replaced
by a new edition. To check for more recent editions of this
document, see http://www.vmware.com/support/pubs.
EN-000840-00
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2 VMware, Inc.
vShield API Programming Guide
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com
Copyright © 2012 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and
intellectual property laws. VMware products are covered by one or more patents listed at
http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.
VMware, Inc. 3
Contents
AboutThisBook 9
1 OverviewofVMwarevShield 11
vShieldComponents 11
vShieldManager 11
vShieldApp 11
vShieldEdge 12
vShieldEndpoint 12
vShieldDataSecurity 12
CompatibilityBetweenDifferentRESTAPIVersions 12
RESTAPIVersion2.0invShield5.0 12
Multitenancy 14
AnIntroductiontoRESTAPIforvShieldUsers 14
HowRESTWorks 15
UsingthevShieldRESTAPI 15
PortsRequiredforvShieldRESTAPI 15
AbouttheRESTAPI 16
RESTfulWorkflowPatterns 16
ForMore
InformationAboutREST 16
2 vShieldManagerManagement 17
SynchronizingvShieldManagerwithvCenterServerandDNS 17
QueryingvShieldManagerConfiguration 18
RegisteringvShieldManagerPlugInwithvSphereClient 19
UnregisteringvShieldManagerPlugInwithvSphereClient 19
QueryingRegistrationStatusofvShieldManagerPlugIn 19
MonitoringvShieldManagerreachability 19
WorkingwithvShieldManagerSyslogServerConfiguration 19
ConfigurevShieldManagerSyslogServer 20
GetvShieldManager
SyslogServerConfiguration 20
DeletevShieldManagerSyslogServerConfiguration 20
QueryingvShieldManagerLogs 20
GetvShieldManagerSystemEvents 20
GetvShieldManagerAuditLogs 21
QueryingvShieldManagerTechSupportLog 21
UserManagement 21
GetaListofUsers 21
GetInformationAboutaUser 21
CreateaLocalUseronvShieldManager 22
UpdateaLocalUserAccount 22
EnableorDisable
aUserAccount 22
RemoveaUserAccount 23
RoleManagement 24
GetRoleforaUser 24
AddRoleandResourcesforaUser 24
ChangeUserRole 24
GetListofPossibleRoles 25
GetListofScopingObjects 25
Title
4 VMware, Inc.
CreatingIPsetandMACsetContainers 25
ListIPsetsCreatedonaScope 25
CreateanIPsetonaScope 25
GetDetailsofanIPset 26
ModifyanExistingIPset 26
DeleteanIPset 26
ListMACsetsCreatedonaScope 27
CreateaMACsetonaScope 27
GetDetailsofaMACset 27
ModifyanExistingMACset 27
DeleteaMACset 28
SecurityGroupScope
andMembers 28
ListSecurityGroupsCreatedonaScope 28
CreateSecurityGrouponaScope 28
GetMembersforaScope 29
GetSecurityGroupDetails 29
ModifyaSecurityGroup 30
DeleteaSecurityGroup 30
AddMembertoSecurityGroup 30
DeleteMemberfromSecurityGroup 30
TransportSetforApplications 31
ListApplicationsonaScope 31
AddApplicationtoaScope 31
Get
DetailsofanApplication 32
ModifyApplicationDetails 32
DeleteApplicationfromScope 32
3 ESXHostPreparationforvShieldApp,vShieldEndpoint,andvShieldDataSecurity 35
InstallingLicensesforvShieldEdge,vShieldApp,andvShieldEndpoint 35
InstallingvShieldAppandvShieldEndpointServicesonanESXHost 35
InstallingvShieldDataSecurity 37
UpgradingvShieldDataSecurity 37
GettingtheInstallationStatusofvShieldServicesonanESXHost 38
UninstallingvShieldServicesfromanESXHost 38
UninstallingvShieldDataSecurity 38
4 vShieldEdgeInstallation 39
InstallingavShieldEdge 39
QueryingvShieldEdgeConfiguration 40
UninstallingavShieldEdge 42
5 vShieldEdgeManagement 43
ConfiguringvShieldEdge 43
ListvShieldEdgeInstallations 43
DetermineAPIVersion 43
GetCapabilitiesofavShieldEdge 44
SwitchtoNewAPIVersion 44
GetFullConfigurationofavShieldEdge 44
ChangeConfigurationofavShieldEdge 44
InstallvShieldEdge 45
DeletevShieldEdge 45
ConfiguringEdgeServices 45
ConfigureDHCP 45
ManagetheDHCPService 46
VMware, Inc. 5
Contents
DeleteDHCPConfiguration 46
ConfigureFirewall 46
ChangeFirewallRuletoAllow 47
RevertFirewalltoDefault 48
CreateFirewallRulewithIPsetorapplicationSet 48
DeleteFirewallConfiguration 49
ConfigureStaticRouting 49
DeletetheStaticRouting 49
ConfigureNAT 49
DeleteNATConfiguration 50
ConfigureLoadBalancer 51
ManageLoadBalancerService 51
DeleteLoadBalancerConfiguration 52
Miscellaneous 52
ReconfigureEdgeInterfaces 52
SetvShieldEdgeCredentials 52
ConfigureRemoteLogging 52
Configure
VPN 53
ManageVPNService 54
DeletetheVPNConfiguration 54
GenerateCertificateSigningRequest(CSR) 54
AddX.509CertificateasVPNSite 55
OperatingvShieldEdge 56
GetDetailsAboutEdge 56
RequestSyncorUpgrade 56
GetIPsecTunnelStatistics 56
GetDHCPStatistics 56
NetworkInterfaceStatistics 57
GetServiceStatus 57
DebuggingandSupport 57
RetrieveTechnicalSupportLog 57
GetServiceStatistics 58
6 vShieldAppManagement 59
ModifyingtheStateofaDatacenter 59
RetrieveDatacenterState 59
ModifyDatacenterState 60
ConfiguringFirewallRulesforvCenter 60
ConfiguringthevShieldAppFirewall 60
QueryFirewallConfiguration 60
ChangeFirewallConfiguration 70
ReverttoDefaultFirewallConfiguration 70
ConfiguringFailSafeModeforvShieldAppFirewall 70
ConfigureFailSafeModeforvShieldAppFirewall 70
GetFailSafeModeConfigurationforvShield
AppFirewall 71
WorkingwithSpoofGuard 71
GetSpoofGuardGlobalSettings 71
EditSpoofGuardGlobalSettings 71
GetSpoofGuardIPSettings 71
SaveSpoofGuardIPSettings 72
WorkingwithNamespaces 72
AddNamespaceinaDatacenter 72
GetNamespaceDetails 73
DeleteaNamespace 73
ShowNamespacesinaDatacenter 73
Title
6 VMware, Inc.
ShowPortGroupsthatcanbeMarkedasNamespace 73
ShowConfiguredNamespacesinDatacenter 73
GettingFlowStatisticDetails 73
GetFlowStatistics 74
GetFlowMetaData 75
ExcludingVirtualMachinesfromvShieldAppProtection 77
AddaVirtualMachinetotheExclusionList 77
GetVirtualMachineExclusionList 77
DeleteaVirtualMachinefromExclusionList 77
ConfiguringSyslogService
foravShieldApp 78
SynchronizingvShieldApp 78
QueryingvShieldAppTechnicalSupportLog 79
UpgradingvShieldApp 79
7 vShieldEndpointManagement 81
OverviewofSolutionRegistration 81
RegisteringaSolutionwithvShieldEndpointService 81
RegisteraVendor 82
RegisteraSolution 82
AltitudeofaSolution 82
IPAddressandPortforaSolution 82
ActivateaSolution 83
QueryingRegistrationStatusofvShieldEndpoint 83
GetVendorRegistration 83
GetSolutionRegistration 83
GetIPAddressofaSolution 84
GetActivationStatusofaSolution 84
QueryingActivated
SecurityVirtualMachinesforaSolution 84
QueryActivatedSecurityVirtualMachines 84
QueryActivationInformation 85
UnregisteringaSolutionwithvShieldEndpoint 85
UnregisteraVendor 85
UnregisteraSolution 85
UnsetIPAddress 85
DeactivateaSolution 86
StatusCodesandErrorSchema 86
ReturnStatusCodes 86
ErrorSchema 86
8 vShieldDataSecurityConfiguration 89
vShieldDataSecurityUserRoles 89
DefiningaDataSecurityPolicy 90
QueryRegulations 90
EnableaRegulation 90
QueryClassificationValue 91
ConfigureaCustomizedRegexasaClassificationValue 91
ViewtheListofExcludableAreas 91
ExcludeAreasfromPolicyInspection 92
SpecifySecurityGroupstobeScanned 93
QuerySecurityGroupsBeingScanned 93
ConfigureFileFilters 94
SavingandPublishingPolicies 95
QuerySaved
Policy 95
QueryPublishedPolicy 96
PublishtheUpdatedPolicy 96
VMware, Inc. 7
Contents
DataSecurityScanning 96
Start,Pause,Resume,orStopaScanOperation 97
QueryStatusforaScanOperation 97
QueryingScanResults 97
GetListofVirtualMachinesBeingScanned 98
GetNumberofVirtualMachinesBeingScanned 98
GetSummaryInformationabouttheLastFiveScans 99
GetInformationforVirtualMachinesScannedDuringPreviousScan 99
RetrieveInformationAboutPrevious
ScanResults 99
GetXMLRepresentationofPolicyUsedforPreviousScan 99
QueryingViolationDetails 101
GetListofViolationCounts 101
GetListofViolatingFiles 102
GetListofViolatingFilesinCSVFormat 103
GetViolationsinEntireInventory 104
104
Appendix 105
vShieldManagerGlobalConfigurationSchema 105
ESXHostPreparationandUninstallationSchema 108
vShieldAppSchemas 109
vShieldAppConfigurationSchema 110
vShieldAppFirewallSchema 110
vShieldAppSpoofGuardSchema 114
vShieldAppNamespaceSchema 115
vShieldEdgeSchemas 116
ErrorMessageSchema 128
Title
8 VMware, Inc.
VMware, Inc. 9
Thismanual,thevShieldAPIProgrammingGuide,describeshowtoinstall,configure,monitor,andmaintainthe
VMware
®
vShield™systembyusingRESTAPIrequests.Theinformationincludesstepbystepconfiguration
instructionsandexamples.
Intended Audience
ThismanualisintendedforanyonewhowantstouseRESTAPItoinstallorusevShieldinaVMwarevSphere
environment.Theinformationinthismanualiswrittenforexperiencedsystemadministratorswhoare
familiarwithvirtualmachinetechnology,virtualizeddatacenteroperations,andRESTAPIs.Thismanualalso
assumesfamiliarity
withvShield.
VMware Technical Publications Glossary
VMwareTechnicalPublicationsprovidesaglossaryoftermsthatmightbeunfamiliartoyou.Fordefinitions
oftermsastheyareusedinVMwaretechnicaldocumentationgotohttp://www.vmware.com/support/pubs.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.com.
vShield Documentation
ThefollowingdocumentscomprisethevShielddocumentationset:
vShieldAdministrationGuide
vShieldQuickStartGuide
vShieldAPIProgrammingGuide,thisguide
Technical Support and Education Resources
Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversion
ofthisbookandotherbooks,gotohttp://www.vmware.com/support/pubs.
Online and Telephone Support
Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and
registeryourproducts,gotohttp://www.vmware.com/support.
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon
priority1issues.Gotohttp://www.vmware.com/support/phone_support.
About This Book
vShield API Programming Guide
10 VMware, Inc.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.
VMware Professional Services
VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials
designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive
online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides
offeringsto helpyouassess,plan,
build,andmanageyourvirtualenvironment.Toaccessinformationabout
educationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.
VMware, Inc. 11
1
VMwarevShield™isasuiteofnetworkedgeandapplicationawarefirewallsbuilt forVMwarevCenterServer
integration.vShieldinspectsclientservercommunicationsandintervirtualmachinecommunicationsto
providedetailedtrafficanalyticsandapplicationawarefirewallprotection.Itisacriticalsecuritycomponent
toprotectvirtualizeddatacentersfromattacksand
misuse,andhelpsachievecompliancemandatedgoals.
Thischapterincludesthefollowingtopics:
“vShieldComponents”onpage 11
“CompatibilityBetweenDifferentRESTAPIVersionsonpage 12
“PortsRequiredforvShieldRESTAPI”onpage 15
“A n IntroductiontoRESTAPIforvShieldUsers”onpage 14
ThisguideassumesyouhaveadministratoraccesstotheentirevShieldsystem.Ifyouareunabletoaccessa
screenorperformaparticulartask,consultyourvShieldadministrator.
vShield Components
vShieldincludescomponentsandservicesessentialforprotectingvirtualmachinesinavirtualizeddatacenter.
vShieldcanbeconfiguredwithaWebbaseduserinterface,acommandlineinterface(CLI),oraRESTAPI.
TorunvShield,youneedonevShieldManagervirtualapplianceandatleastonevShieldApporvShield
Edge
virtualappliance.ThevShieldManagervirtualappliancecanrunonadifferentESXhostthanthevShieldApp
andvShieldEdgevirtualappliances.
vShield Manager
vShieldManageristhecentralizedmanagementcomponentofvShield.Youinstallitasavirtualapplianceby
deployinganOVAfromthevSphereClient.UsingvShieldManagersuserinterfaceorvSphereClientplugin,
youcaninstall,configure,andmaintainvShieldappliances.ThevShieldManageruserinterface leveragesthe
vSphereWeb
ServicesSDKtodisplaytabswithinthevSphereClientinventorypanel.Fordetailsaboutthe
userinterface,seethevShieldAdministrationGuide.
vShield App
AvShieldAppvirtualappliancemonitorsalltrafficintoandoutofanESXhost,andbetweenvirtualmachines
onthehost.vShieldAppprovidesapplicationawaretrafficanalysisandstatefulfirewallprotection,andit
regulatestrafficbasedonasetofrules,similartoanaccesscontrollist(ACL).
As
trafficpassesthroughavShieldApp,eachsessionheaderisinspectedtocatalogthedata.ThevShieldApp
createsaprofileforeachvirtualmachinedetailingtheoperatingsystem,applications,andportsusedfor
networkcommunication.Basedonthisinformation,thevShieldAppallowsephemeralportusebypermitting
dynamicprotocols
suchasFTPorRPCtopassthrough,whilemaintaininglockdownonports1024andhigher.
YoucannotprotecttheESXServiceConsole,ESXidirectconsoleuserinterface(DCUI),ortheVMkernelwith
vShieldAppbecausethesecomponentsarenotvirtualmachines.
Overview of VMware vShield
1
vShield API Programming Guide
12 VMware, Inc.
vShield Edge
AvShieldEdgevirtualapplianceprovidesnetworkedgesecuritytoprotectthevirtualmachinesinavCloud
tenantsnetworkfromattacksoriginatingfromthepublicnetwork.ThevShieldEdgeconnectstheisolated,
privatenetworksofcloudtenantstothepublicsideoftheserviceprovidernetworkthroughcommonedge
servicessuch
asDHCP,VPN,NAT,andloadbalancing.
YouinstallavShieldEdgefromthevShieldManager.YoucaninstallonevShieldEdgeinstancepertenantport
grouponavNetworkDistributedSwitch(vDS).YouconfigureavShieldEdgebyusingRESTAPI.
vShield Endpoint
vShieldEndpointoffloadsantivirusandantimalwareagentprocessingtoadedicatedsecurevirtual
appliancedeliveredbyVMwarepartners.Sincethesecurevirtualappliance(unlikeaguestvirtualmachine)
doesnʹtgooffline,itcancontinuouslyupdateantivirussignaturestherebygivinguninterruptedprotectionto
thevirtualmachinesonthehost.Also,
newvirtualmachines(orexistingvirtualmachinesthatwentoffline)
areimmediatelyprotectedwiththemostcurrentantivirussignatureswhentheycomeonline.
vShield Data Security
vShieldDataSecurityprovidesvisibilityintosensitivedatastoredwithinyourorganizationʹsvirtualizedand
cloudenvironments.BasedontheviolationsreportedbyvShieldDataSecurity,youcanensurethatsensitive
dataisadequatelyprotectedandassesscompliancewithregulationsaroundtheworld.
Compatibility Between Different REST API Versions
EachreleaseofthevShieldRESTAPIrepresentsanewversionoftheRESTAPIcodewithnewandchanged
features.IfyouarerunningapreviousversionofvShieldcomponentsoftware,youmightnotbeabletouse
allofthefeaturesofthelatestreleaseofthevShieldREST
API.
REST API Version 2.0 in vShield 5.0
Release5.0ofvShieldintroducesversion2.0oftheRESTAPI.ManyURLschangedfromversion1.0to2.0.
YoucandeterminetheAPIversionofavShieldcomponent(suchasEdgeorApp)withthefollowingexample
RESTcalls.IntheGETrequestsyntax,<vsm-ip>representstheIPaddressor
hostnameofvShieldManager.
Example 1-1. Determine the API version of the vShield Manager or vShield Endpoint
GET https://<vsm-ip>/api/versions
<versions>
<version value="2.1">
<module name="VshieldAppGlobal" baseUri="/api/2.1/app" version="2.1"/>
<module name="Flow" baseUri="/api/2.1/app/flow" version="2.1"/>
</version>
<version value="2.0">
<module name="Dlp" baseUri="/api/2.0/dlp" version="2.0"/>
<module name="Endpoint" baseUri="/api/2.0/endpointsecurity" version="2.0"/>
<module name="MACSet" baseUri="/api/2.0/services/macset" version="2.0"/>
<module name="SystemEvent" baseUri="/api/2.0/systemevent" version="2.0"/>
<module name="AuditLog" baseUri="/api/2.0/auditlog" version="2.0"/>
<module name="UserMgmt" baseUri="/api/2.0/services/usermgmt" version="2.0"/>
<module name="Application" baseUri="/api/2.0/services/application" version="2.0"/>
<module name="IPSet" baseUri="/api/2.0/services/ipset" version="2.0"/>
<module name="SyslogServer" baseUri="/api/2.0/services/syslog/config" version="2.0"/>
NOTEvShieldAppandvApparenotthesamething.AvAppisagroupingofvirtualmachinesinvSphere,
forexampleamanagementapplianceandadatabaseapplianceworkingtogether.
CAUTIONTheRESTAPIsdescribedinthisdocumentcanchangeovertime.Atthispoint,vShielddoesnot
guaranteeforwardcompatibility.
VMware, Inc. 13
Chapter 1 Overview of VMware vShield
<module name="SecurityGroup" baseUri="/api/2.0/services/securitygroup" version="2.0"/>
</version>
</versions>
CAUTIONIntheresponseofthisGETcall,themodulenameEndpointSolutionin5.0haschangedto
Endpointin5.0.1.
vShield API Programming Guide
14 VMware, Inc.
Example 1-2. Determine the API version of a vShield App
GET https://<vsm-ip>/api/versions/app/<datacenter-id>
<versions>
<version version="2.0">
<module version="2.0" baseUri="/api/2.0/app" id="datacenter-21" name="app"/>
</version>
</versions>
Example 1-3. Determine the API version of a vShield Edge
GET https://<vsm-ip>/api/versions/edge/dvportgroup-63
<versions>
<version version="2.0">
<module version="2.0" baseUri="/api/2.0/networks" id="dvportgroup-63" name="edge"/>
</version>
</versions>
TheAPIversionforvShieldAppisgovernedbythestateofthedatacenterinrelationtoavShieldcomponent.
IfthedatacenterstateisinbackwardCompatiblemode,thenitsupportsonlyversion1.0RESTcalls.Ifthe
datacenterstateisinregularmode,thenitsupportsonly2.0RESTcalls.
TheseAPIversionsaremutually
exclusiveonlyoneRESTAPIversionissupportedatatime.
Table 11listscompatibilitybetweendifferentversionsoftheRESTAPI,vShieldManager,andthevShield
virtualappliances:vShieldApp,vShieldEndpoint,andvShieldEdge.
Multitenancy
InvShield5.0,thevShieldAppfirewallconfigurationsupportsmultitenancy.AsingleIPaddresscanshow
upinmultipleplacesinthenetwork(differentIPaddressnamespaces)associatedwithdifferentvirtual
machines.Only2.0RESTAPIssupportmultitenancy.Inbackwardcompatibilitymode,vShield5.0supports
theoldAPIsanddoesnot
enforceruleswithawarenessofmultitenancy.
Ifyouhavewrittenprogramsusing1.0RESTAPIs,youshouldreconsiderwhethertheirdesignworksas
intendedinthemultitenancyscenario.Ifnot,changeyourprogramstousetheAPI2.0calls.
An Introduction to REST API for vShield Users
REST,anacronymforRepresentationalStateTransfer,isatermthathasbeenwidelyemployedtodescribean
architecturalstylecharacteristicofprogramsthatrelyontheinherentpropertiesofhypermediatocreateand
modifythestateofanobjectthatisaccessibleataURL.
Table 1-1. REST API Compatibility Matrix
REST API Version vShield Manager Version vShield Appliance Version Supported?
1.0 1.0 1.0 Yes
1.0 2.0 1.0 Yes,however,clientcannot
configureanynewfeaturesin
vShieldManager2.0
1.0 2.0 2.0BackwardMode
1
1. IfthevShieldEdgeisinBackwardMode,thevShieldManagerdoesnotacceptREST2.0callsforvShieldEdgeconfiguration.
YoumustswitchthevShieldEdgetoNormalMode.AfteravShieldEdgehasbeenswitchedtoNormalMode,youcannot
changetoBackwardMode.
Yes,however,clientcannot
configureanynewfeaturesin
vShieldManager2.0
2.0 2.0 1.0 No
2.0 2.0 2.0BackwardMode No
2.0 2.0 2.0 Yes
VMware, Inc. 15
Chapter 1 Overview of VMware vShield
How REST Works
OnceaURLofsuchanobjectisknowntoaclient,theclientcanuseanHTTPGETrequesttodiscoverthe
propertiesoftheobject.ThesepropertiesaretypicallycommunicatedinastructureddocumentwithanHTTP
ContentTypeofXMLorJSON,thatprovidesarepresentationofthe
stateoftheobject.InaRESTfulworkflow,
documents(representationsofobjectstate)arepassedbackandforth(transferred)betweenaclientanda
servicewiththeexplicitassumptionthatneitherpartyneedknowanythingaboutanentityotherthanwhatis
presentedinasinglerequestorresponse.The
URLsatwhichthesedocumentsareavailableareoften“sticky,”
inthattheypersistbeyondthelifetimeoftherequestorresponsethatincludesthem.Theothercontentofthe
documentsisnominallyvaliduntiltheexpirationdatenotedintheHTTPExpiresheader.
Using the vShield REST API
YouhaveseveralchoicesforprogrammingthevShieldRESTAPI:usingFirefox,Chrome,orcurl.Tomake
XMLresponsesmorelegible,youcancopyandpastethemintoxmlcopyeditororpspad.
To use the REST API in Firefox
1 LocatetheRESTClientMozillaaddon,andaddittoFirefox.
2ClickTools>RESTClienttostartthe
addon.
3ClickLoginandenterthevShieldlogincredentials,whichthenappearencodedintheRequestHeader.
4 SelectamethodsuchasGET,POST,orPUT,andtypetheURLofaRESTAPI.Youmightbeaskedto
acceptorignorethelackofSSLcertificate.ClickSend.
ResponseHeader,
ResponseBody,andRenderedHTMLappearinthebottomwindow.
To use the REST API in Chrome
1SearchtheWebtofindtheSimpleRESTClient,andaddittoChrome.
2Clickitsglobelikeicontostartitinatab.
3TheSimpleRESTClientprovidesnocertificatecheckinginterface,souseanotherChrometabtoaccept
orignorethelackofSSLcertificate.
4TypetheURLofaRESTAPI,andselectamethodsuchasGET,POST,orPUT.
5IntheHeadersfield,typethebasicauthorizationline,asintheImportantnoteabove.ClickSend.
Status,Headers,andDataappearintheResponsewindow.
To use the REST API in curl
1Install
curlifnotalreadyinstalled.
2InfrontoftheRESTURL,the‐koptionavoidscertificatechecking,andthe‐uoptionspecifiescredentials.
curl -k -u admin:default https://<vsm-ip>/api/2.0/services/usermgmt/user/admin
Ports Required for vShield REST API
ThevShieldManagerrequiresport443/TCPforRESTAPIrequests.
I
MPORTANTAllvShieldRESTrequestsrequireauthorization.ThedefaultvShieldManagerlogincredentials
areuseradminpassworddefault.Unlessyouchangedthese,youcanusethefollowingbasicauthorization,
whereYWRtaW46ZGVmYXVsdA==istheBase64encodingofthedefaultcredentialsadmin:default.
Authorization: Basic YWRtaW46ZGVmYXVsdA==
vShield API Programming Guide
16 VMware, Inc.
About the REST API
RESTAPIsuseHTTPrequests(oftensentbyscriptorhighlevellanguage)asawayofmakingidempotent
remoteprocedurecallsthatcreate,modify,ordeleteobjectsdefinedbytheAPI.ARESTAPIisdefinedbya
collectionofXMLdocumentsthatrepresenttheobjectsonwhichtheAPI
operates.TheHTTPoperations
themselvesaregenerictoallHTTPclients.TowriteaRESTfulclient,youshouldunderstandHTTPprotocol
andthesemanticsofstandardHTMLmarkup.ForvShieldRESTAPI,youmustknowthreethings:
ThesetofobjectsthattheAPIsupports,andwhattheyrepresent.Forexample,whatarevDCandOrg?
HowtheAPIrepresentstheseobjects.Forinstance,whatistheXMLschemaforthevShieldEdgefirewall
ruleset?Whatdotheindividualelementsandattributesrepresent?
Howtheclientreferstoanobjectonwhichitwantstooperate.Forexample,whatisamanagedobjectID?
Toanswerthesequestions,youlookatvShieldAPIresourceschemas.TheseschemasdefineanumberofXML
types,manyofwhichareextendedbyothertypes.TheXMLelements
definedintheseschemas,alongwith
theirattributesandcompositionrules(minimumandmaximumnumberofelementsorattributes,orthe
prescribedhierarchywithwhichelementscanbenested)representthedatastructuresofvShieldobjects.A
clientcan“read”anobjectbymakinganHTTPGETrequesttotheobject’s
resourceURL.Aclientcan“write”
(createormodify)anobjectwithanHTTPPUTorPOSTrequestthatincludesaneworchangedXMLbody
documentfortheobject.UsuallyaclientcandeleteanobjectwithanHTTPDELETErequest.
Thisdocumentpresentsexamplerequestsandresponses,andprovides
referenceinformationontheXML
schemasthatdefinetherequestandresponsebodies.
RESTful Workflow Patterns
AllRESTfulworkflowsfallintoapatternthatincludesonlytwofundamentaloperations,whichyourepeatin
thisorderforaslongasnecessary.
MakeanHTTPrequest(GET,PUT,POST,orDELETE).Thetargetofthisrequestiseitherawellknown
URL(suchasvShieldManager)oralinkobtainedfromtheresponsetoapreviousrequest.Forexample,
aGETrequesttoanOrgURLreturnslinkstovDCobjectscontainedby
theOrg.
Examinetheresponse,whichcanbeanXMLdocumentoranHTTPresponsecode.Iftheresponseisan
XMLdocument,itmaycontainlinksorotherinformationaboutthestateofanobject.Iftheresponseis
anHTTPresponsecode,itindicateswhethertherequestsucceededorfailed,and
maybeaccompanied
byaURLthatpointstoalocationfromwhichadditionalinformationcanberetrieved.
For More Information About REST
ForacomprehensivediscussionofRESTfrombothclientandserverperspectives,seeRESTfulWebServicesby
LeonardRichardsonandSamRuby,published2007byOʹReillyMedia.
TherearealsomanysourcesofinformationaboutRESTontheWeb,including:
http://www.infoq.com/articles/restintroduction
http://www.infoq.com/articles/subbuallamarajurest
http://www.stucharlton.com/blog/archives/000141.html
VMware, Inc. 17
2
ThevShieldManagerrequirescommunicationwithyourvCenterServerandservicessuchasDNSandNTP
toprovidedetailsonyourVMwareInfrastructureinventory.
Thechapterincludesthefollowingtopics:
“SynchronizingvShieldManagerwithvCenterServerandDNS”onpage 17
“QueryingvShieldManagerConfiguration”onpage 18
“RegisteringvShieldManagerPlugInwithvSphereClient”onpage 19
“UnregisteringvShieldManagerPlugInwithvSphereClient”onpage 19
“QueryingRegistrationStatusofvShieldManagerPlugIn”onpage 19
“MonitoringvShieldManagerreachability”onpage 19
“WorkingwithvShieldManagerSyslogServerConfiguration”onpage 19
“QueryingvShieldManagerLogs”onpage 20
“QueryingvShieldManagerTechSupportLog”onpage 21
“UserManagement”onpage 21
“RoleManagement”onpage 24
“CreatingIPsetandMACsetContainers”onpage 25
“SecurityGroupScopeandMembers”onpage 28
“TransportSetforApplications”onpage 31
Synchronizing vShield Manager with vCenter Server and DNS
YoucansynchronizethevShieldManagerwiththevCenterServer,addDNSserverstothevShieldManager
forIPaddressandhostnameresolution,configuretime,andzoneandaddanNTPserver.Synchronizingwith
vCenterServerenablesthevShieldManageruserinterfacetodisplayyourVMwareInfrastructureinventory,
andrequiresits
IPaddress(orURL)andadministratorlogincredentials.ForthevcInfoschema,andthe
dnsInfoschema,see“vShieldManagerGlobalConfigurationSchema”onpage 105.
Example 2-1. Synchronize the vShield Manager with vCenter server and identify DNS services
Request:
POST https://<vsm-ip>/api/2.0/global/config
RequestBody:
vShield Manager Management
2
IMPORTANTAllvShieldRESTrequestsrequireauthorization.See“UsingthevShieldRESTAPI”onpage 15
fordetailsaboutbasicauthorization.
vShield API Programming Guide
18 VMware, Inc.
<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0">
<vcInfo>
<ipAddress>10.112.196.22</ipAddress>
<userName>administrator</userName>
<password>123</password>
</vcInfo>
<dnsInfo>
<primaryDns>10.112.192.1</primaryDns>
<secondaryDns>10.112.192.2</secondaryDns>
</dnsInfo>
</vsmGlobalConfig>
SpecifyingDNSinformationisoptional.YoucansynchronizevShieldManagerwithjustvCenterServer.
Example 2-2. Synchronize the vShield Manager with vCenter Server
Request:
POST https://<vsm-ip>/api/2.0/global/config
RequestBody:
<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0">
<vcInfo>
<ipAddress>10.112.196.22</ipAddress>
<userName>administrator</userName>
<password>123</password>
</vcInfo>
</vsmGlobalConfig>
Example 2-3. Configure time and zone
Request:
POST https://<vsm-ip>/api/2.0/global/config
RequestBody:
<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0">
<
timeInfo>
<clock>2011-09-09 09:00:00</clock>
<zone>Pacific</zone>
</timeInfo>
</vsmGlobalConfig>
Example 2-4. Configure NTP server
Request:
POST https://<vsm-ip>/api/2.0/global/config
RequestBody:
<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0">
<
timeInfo>
<ntpServer>10.112.196.2</ntpServer>
</timeInfo>
</vsmGlobalConfig>
Querying vShield Manager Configuration
YoucanquerythecurrentvCenter,DNS,andtime/zoneorNTPserverconfigurationforthevShieldManager .
VMware, Inc. 19
Chapter 2 vShield Manager Management
Example 2-5. Get vShield Manager configuration
Request:
GET https://<vsm-ip>/api/2.0/global/config
Registering vShield Manager Plug-In with vSphere Client
YoucanregisterthevShieldManagerasavSphereClientplugin.
Example 2-6. Register vShield Manager plug-in with vSphere client
Request:
PUT https://<vsm-ip>/api/2.0/global/viplugin/register?natedIp=<ip>&natedPort=<port>
WhereipandportareoptionalparametersthatyoumaywanttospecifyinaNATenvironment.
Unregistering vShield Manager Plug-In with vSphere Client
YoucanunregisterthevShieldManagerasavSphereClientplugin.
Example 2-7. Unregister vShield Manager Plug-in with vSphere client
Request:
PUT https://<vsm-ip>/api/2.0/global/viplugin/unregister
Querying Registration Status of vShield Manager Plug-In
YoucangettheregistrationstatusofthevShieldManagerasavSphereClientplugin.
Example 2-8. Get registration status of vShield Manager Plug-in with vSphere client
Request:
GET https://<vsm-ip>/api/2.0/global/viplugin/status
Monitoring vShield Manager reachability
YoucanverifythatthevShieldManagerisreachable.
Example 2-9. Verify that the vShield Manager is reachable
Request:
GET https://<vsm-ip>/api/2.0/global/heartbeat
Working with vShield Manager Syslog Server Configuration
YoucanconfigurevShieldmanagertosendsystemeventsandauditlogstoasyslogserver,retrievecurrent
configuration,ordeletethecurrentconfiguration.
vShield API Programming Guide
20 VMware, Inc.
Configure vShield Manager Syslog Server
YoucanconfigurevShieldManagertosendlogstoasyslogserver.Ifasyslogserverconfigurationexists,this
callupdatestheconfiguration.
Example 2-10. Configure vShield Manager syslog server
Request:
PUT https://<vsm-ip>/api/2.0/services/syslog/config
Request Body:
<?xml version="1.0" encoding="UTF-8"?>
<syslogServerConfig>
<serverInfo>10.112.200.100:1000</serverInfo>
</syslogServerConfig>
Get vShield Manager Syslog Server Configuration
YoucangetthevShieldManagersyslogserverconfiguration.
Example 2-11. Get vShield Manager syslog server configuration
Request:
GET https://<vsm-ip>/api/2.0/services/syslog/config
Delete vShield Manager Syslog Server Configuration
YoucandeletethevShieldManagersyslogserverconfiguration.
Example 2-12. Delete vShield Manager syslog server configuration
Request:
DELETE https://<vsm-ip>/api/2.0/services/syslog/config
Querying vShield Manager Logs
YoucanretrievevShieldManagersystemeventandauditlogs.
Get vShield Manager System Events
YoucanretrievevShieldManagersystemevents.
Example 2-13. Get vShieldManagersystemevents
Request:
GET https://<vsm-ip>/api/2.0/systemevent?startIndex=0\&pageSize=10
Where
start indexisanoptionalparameterwhichspecifiesthestartingpointforretrievingthelogs.Ifthis
parameterisnotspecified,logsareretrievedfromthebeginning.
page sizeisanoptionalparameterthatlimitsthemaximumnumberofentriesreturnedbytheAPI.The
defaultvalueforthisparameteris256andthevalidrangeis11024.
/