VMware vShield 5.0, VSHIELD APP 1.0 - API User guide

  • Hello! I am an AI chatbot trained to assist you with the VMware vShield 5.0 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
vShield App 5.0
vShield Edge 5.0
vShield Endpoint 5.0
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-000608-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 © 2011 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 7
1 OverviewofVMwarevShield 9
vShieldComponents 9
vShieldManager 9
vShieldApp 9
vShieldEdge 10
vShieldEndpoint 10
vShieldDataSecurity 10
CompatibilityBetweenDifferentRESTAPIVersions 10
RESTAPIVersion2.0invShield5.0 10
Multitenancy 11
AnIntroductiontoRESTAPIforvShieldUsers 11
HowRESTWorks 12
UsingthevShieldRESTAPI 12
PortsRequiredforvShieldRESTAPI 12
AbouttheRESTAPI 13
RESTfulWorkflowPatterns 13
ForMore
InformationAboutREST 13
2 vShieldManagerManagement 15
SynchronizingvShieldManagerwithvCenterServerandDNS 15
MonitoringvShieldManagerreachability 16
RetrievingTechSupportLogs 16
GetthevShieldManagerTechnicalSupportLogFilePath 16
GetthevShieldEdgeTechnicalSupportLogFilePath 16
UserManagement 17
GetaListofUsers 17
GetInformationAboutaUser 17
CreateaLocalUseronvShieldManager 17
Updatea
LocalUserAccount 18
EnableorDisableaUserAccount 18
RemoveaUserAccount 18
RoleManagement 19
GetRoleforaUser 19
AddRoleandResourcesforaUser 19
ChangeRoleforaUser 19
GetaListofPossibleRoles 20
GetaListofScopingObjects 20
CreatingIPsetandMACsetContainers 20
ListIPsetsCreatedonaScope 20
Create
anIPsetonaScope 20
GetDetailsofanIPset 21
ModifyanExistingIPset 21
DeleteanIPset 21
ListMACsetsCreatedonaScope 22
CreateaMACsetonaScope 22
GetDetailsofaMACset 22
vShield API Programming Guide
4 VMware, Inc.
ModifyanExistingMACset 22
DeleteaMACset 23
SecurityGroupScopeandMembers 23
ListSecurityGroupsCreatedonaScope 23
CreateSecurityGrouponaScope 23
GetMembersforaScope 24
GetSecurityGroupDetails 24
ModifyaSecurityGroup 24
DeleteaSecurityGroup 25
AddMembertoSecurityGroup 25
DeleteMemberfromSecurityGroup 25
TransportSetforApplications 25
List
ApplicationsonaScope 25
AddApplicationtoaScope 26
GetDetailsofanApplication 26
ModifyApplicationDetails 27
DeleteApplicationfromScope 27
3 ESXHostPreparationforvShieldAppandvShieldEndpoint 29
InstallingLicensesforvShieldEdge,vShieldApp,andvShieldEndpoint 29
InstallingvShieldAppandvShieldEndpointServicesonanESXHost 29
GettingtheInstallationStatusofvShieldServicesonanESXHost 31
UninstallingvShieldServicesfromanESXHost 31
4 vShieldEdgeInstallation 33
InstallingavShieldEdge 33
GettingtheCurrentConfigurationofavShieldEdge 34
UninstallingavShieldEdge 36
5 vShieldEdgeManagement 37
ConfiguringvShieldEdge 37
ListvShieldEdgeInstallations 37
DetermineAPIVersion 37
GetCapabilitiesofavShieldEdge 38
SwitchtoNewAPIVersion 38
GetFullConfigurationofavShieldEdge 38
ChangeConfigurationofavShieldEdge 38
InstallvShieldEdge 39
DeletevShieldEdge 39
ConfiguringEdgeServices 39
ConfigureDHCP 39
ManagetheDHCPService 40
DeleteDHCPConfiguration 40
ConfigureFirewall 40
ChangeFirewallRuleto
Allow 41
RevertFirewalltoDefault 42
CreateFirewallRulewithIPsetorapplicationSet 42
DeleteFirewallConfiguration 43
ConfigureStaticRouting 43
DeletetheStaticRouting 43
ConfigureNAT 43
DeleteNATConfiguration 44
ConfigureLoadBalancer 45
ManageLoadBalancerService 45
VMware, Inc. 5
Contents
DeleteLoadBalancerConfiguration 46
Miscellaneous 46
ReconfigureEdgeInterfaces 46
SetvShieldEdgeCredentials 46
ConfigureRemoteLogging 46
ConfigureVPN 47
ManageVPNService 48
DeletetheVPNConfiguration 48
GenerateCertificateSigningRequest(CSR) 48
AddX.509CertificateasVPNSite 49
OperatingvShieldEdge 50
GetDetailsAboutEdge 50
RequestSyncorUpgrade 50
GetIPsecTunnelStatistics 50
GetDHCPStatistics 50
NetworkInterfaceStatistics 51
GetServiceStatus 51
DebuggingandSupport 51
RetrieveLogsforTechnicalSupport 51
GetServiceStatistics 52
6 vShieldAppManagement 53
ModifyingtheStateofaDatacenter 53
RetrieveDatacenterState 53
ModifyDatacenterState 54
ConfiguringFirewallRulesforvCenter 54
ConfiguringthevShieldAppFirewall 54
QuerytheFirewallConfiguration 54
ChangetheFirewallConfiguration 55
ReverttoDefaultFirewallConfiguration 56
WorkingwithSpoofGuard 56
RetrieveSpoofGuardGlobalSettings 56
EditSpoofGuardGlobalSettings 56
RetrieveSpoofGuardIPSettings 56
SaveSpoofGuardIPSettings 57
WorkingwithNamespaces 57
Add
NamespaceinaDatacenter 57
GetNamespaceDetails 58
DeleteaNamespace 58
ShowNamespacesinaDatacenter 58
ShowPortGroupsthatcanbeMarkedasNamespace 58
ShowConfiguredNamespacesinDatacenter 58
ConfiguringSyslogServiceforavShieldApp 58
UpgradingvShieldApp 59
7 vShieldEndpointManagement 61
OverviewofSolutionRegistration 61
RegisteringaSolutionwithvShieldEndpointService 61
RegisteraVendor 61
RegisteraSolution 62
AltitudeofaSolution 62
IPAddressandPortforaSolution 63
ActivateaSolution 63
QueryingRegistrationStatusofvShieldEndpoint 64
GetVendorRegistration 64
vShield API Programming Guide
6 VMware, Inc.
GetSolutionRegistration 64
GetIPAddressofaSolution 64
GetActivationStatusofaSolution 64
UnregisteringaSolutionwithvShieldEndpoint 64
UnregisteraVendor 64
UnregisteraSolution 65
UnsetIPAddress 65
DeactivateaSolution 65
StatusCodesandErrorSchema 65
ReturnStatusCodes 65
ErrorSchema 66
8 vShieldDataSecurityConfiguration 67
vShieldDataSecurityUserRoles 67
DefiningaDataSecurityPolicy 67
RetrieveAllRegulations 68
EnableaRegulation 68
RetrievetheClassificationValue 69
ConfigureaCustomizedRegexasaClassificationValue 69
ViewtheListofExcludableAreas 69
ExcludeAreasfromPolicyInspection 70
ConfigureFileFilters 70
SavingandPublishingPolicies 71
RetrievetheSavedSDDPolicy 71
RetrievethePublishedSDDPolicy 73
Publish
theUpdatedPolicy 73
DataSecurityScanning 73
RetrievetheStatusforaScanOperation 73
Start,Pause,Resume,orStopaScanOperation 74
AnalyzingResults 74
ViewtheListofViolationCounts 74
ViewtheListofViolatingFiles 74
ViewtheListofViolatingFilesinCSVFormat 75
ViewViolationsinEntireInventory 75
Appendix 77
vShieldManagerGlobalConfigurationSchema 77
ESXHostPreparationandUninstallationSchema 80
vShieldAppSchemas 81
vShieldAppConfigurationSchema 81
vShieldAppFirewallSchema 82
vShieldAppSpoofGuardSchema 85
vShieldAppNamespaceSchema 87
vShieldEdgeSchemas 88
ErrorMessageSchema 100
VMware, Inc. 7
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
8 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. 9
1
VMwarevShield™isasuiteofnetworkedgeandapplicationawarefirewallsbuiltforVMwarevCenterServer
integration.vShieldinspectsclientservercommunicationsandintervirtualmachinecommunicationsto
providedetailedtrafficanalyticsandapplicationawarefirewallprotection.Itisacriticalsecuritycomponent
toprotectvirtualizeddatacentersfromattacksand
misuse,andhelpsachievecompliancemandatedgoals.
Thischapterincludesthefollowingtopics:
“vShieldComponents”onpage 9
“CompatibilityBetweenDifferentRESTAPIVersionsonpage 10
“PortsRequiredforvShieldRESTAPI”onpage 12
“A n IntroductiontoRESTAPIforvShieldUsers”onpage 11
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.ThevShieldManageruserinterfaceleveragesthe
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
10 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.0">
<module name="Dlp" baseUri="/api/2.0/dlp" version="2.0"/><module name="EndpointSolution"
baseUri="/api/2.0/endpointsecurity" version="2.0"/><module name="IPSet"
baseUri="/api/2.0/services/ipset" version="2.0"/><module name="UserMgmt"
baseUri="/api/2.0/services/usermgmt" version="2.0"/><module name="MACSet"
baseUri="/api/2.0/services/macset" version="2.0"/><module
name="SecurityGroup" baseUri="/api/2.0/services/securitygroup"
version="2.0"/><module name="Application"
baseUri="/api/2.0/services/application" version="2.0"/>
</version>
</versions>
NOTEvShieldAppandvApparenotthesamething.AvAppisagroupingofvirtualmachinesinvSphere,
forexampleamanagementapplianceandadatabaseapplianceworkingtogether.
CAUTIONTheRESTAPIsdescribedinthisdocumentcanchangeovertime.Atthispoint,vShielddoesnot
guaranteeforwardcompatibility.
VMware, Inc. 11
Chapter 1 Overview of VMware vShield
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
vShield API Programming Guide
12 VMware, Inc.
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==
VMware, Inc. 13
Chapter 1 Overview of VMware vShield
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
vShield API Programming Guide
14 VMware, Inc.
VMware, Inc. 15
2
ThevShieldManagerrequirescommunicationwithyourvCenterServerandservicessuchasDNSandNTP
toprovidedetailsonyourVMwareInfrastructureinventory.
Thechapterincludesthefollowingtopics:
“SynchronizingvShieldManagerwithvCenterServerandDNS”onpage 15
“RetrievingTechSupportLogs”onpage 16
“UserManagement”onpage 17
“RoleManagement”onpage 19
“CreatingIPsetandMACsetContainers”onpage 20
“SecurityGroupScopeandMembers”onpage 23
“TransportSetforApplications”onpage 25
Synchronizing vShield Manager with vCenter Server and DNS
YoucanuseasinglerequesttosynchronizethevShieldManagerwiththevCenterServerandaddDNSservers
tothevShieldManagerforIPaddressandhostnameresolution.SynchronizingwithvCenterServerenables
thevShieldManageruserinterfacetodisplayyourVMwareInfrastructureinventory.ForthevcInfoschema,
andthe
dnsInfoschema,see“vShieldManagerGlobalConfigurationSchema”onpage 77.
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:
<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>
vShield Manager Management
2
IMPORTANTAllvShieldRESTrequestsrequireauthorization.See“UsingthevShieldRESTAPI”onpage 12
fordetailsaboutbasicauthorization.
vShield API Programming Guide
16 VMware, Inc.
SynchronizationwithvCenterServerrequiresitsIPaddress(orURL)andadministratorlogincredentials.
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>
Monitoring vShield Manager reachability
YoucanverifythatthevShieldManagerisreachable.
Example 2-3. Verify that the vShield Manager is reachable
Request:
GET https://<vsm-ip>/api/2.0/global/heartbeat
Retrieving Tech Support Logs
YoucanretrieveTechnicalSupportlogsfromthevShieldManagerandvShieldEdge.
Get the vShield Manager Technical Support Log File Path
YoucangetthepathtothediagnosticlogfileforthevShieldManager.Youcanthensendthediagnosticlogto
technicalsupportforassistanceintroubleshootinganissue.
Example 2-4. Get the Tech Support Log File Path for a vShield Manager
Request:
GET https://<vsm-ip>/api/2.0/global/techSupportLogs
Thetechnicalsupportlogisplacedinafileatthefollowingpath,howevertheRESTAPIhasnoprovisionfor
downloadingit,andwgetandcurldonothavepermissiontodownloadit,either.Youcanretrievethelog
withvShieldManagerbyclickingSettings&Reports>Configuration>
Support>[LogDownload]Initiate.
/tech_support_logs/vsm/vshield_mgr_support_<date_time>GMT.log.gz
Get the vShield Edge Technical Support Log File Path
YoucandownloadthediagnosticlogfromavShieldEdge.Youcanthensendthediagnosticlogtotechnical
supportforassistanceintroubleshootinganissue.
Example 2-5. Get the Tech Support Log File Path for a vShield Edge
Request:
VMware, Inc. 17
Chapter 2 vShield Manager Management
GET https://<vsm-ip>/api/2.0/networks/<internal-portgroup-vc-moref-id>/techSupportLogs
Thetechnicalsupportlogisplacedinafile,howevertheRESTAPIhasnoprovisionfordownloadingit,and
wgetandcurldonothavepermissiontodownloadit,either .YoucanretrievethelogwithvShieldManager
byclickingSettings&Reports>Configuration>Support>[LogDownload]
Initiate.
User Management
TheauthenticationandauthorizationAPIsincludemethodstomanageusersandroles.
Get a List of Users
YoucanretrievealistofvShieldManagerusers,bothlocalusersandvCenteruserswhoareassignedarole.
Example 2-6. Get a list of users
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/users/vsm
BeforeyouadduserstovShieldManager,thepreexistingdefaultsarelocaluseradminandthevCenteruser
administrator.
Get Information About a User
Youcanretrieveinformationaboutauser.
Example 2-7. Get information about a user
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/user/<userId>
Userinformationincludesusername,fullname,emailaddress,whetherlocalornot,whetherenabled,
resourceobjects,roles,andscope.
Create a Local User on vShield Manager
YoucancreatealocalvShieldManageruser.
Example 2-8. Create a local user
RequestHeader:
POST https://<vsm-ip>/api/2.0/services/usermgmt/user/local
RequestBody:
<userInfo>
<userId>somebody</userId>
<password>123</password>
<fullname>Person Somebody</fullname>
<email>[email protected]</email>
<accessControlEntry>
<role>security_admin</role>
</accessControlEntry>
</userInfo>
vShield API Programming Guide
18 VMware, Inc.
Update a Local User Account
Youcanupdatealocaluseraccountincludingpassword.Ifapasswordisnotprovided,theexistingpassword
isretained.The<userId>variableintherequestheadershouldbesameastheonespecifiedinXML.TheAPI
returnsupdatedinformationfortheuser.
Example 2-9. Update a local user account
RequestHeader:
PUT https://<vsm-ip>/api/2.0/services/usermgmt/user/local/<userId>
RequestBody:
<userInfo>
<userId>somebody</userId>
<password>123</password>
<fullname>Person Somebody</fullname>
<email>[email protected]</email>
<accessControlEntry>
<role>security_admin</role>
<resource><resourceId>datacenter-312</resourceId></resource>
</accessControlEntry>
</userInfo>
Enable or Disable a User Account
Youcandisableorenableauseraccount,eitherlocaluserorvCenteruser.Whenauseraccountiscreated,the
accountisenabledbydefault.
Example 2-10. Enable or disable a user account
Request:
PUT https://<vsm-ip>/api/2.0/services/usermgmt/user/<userId>/enablestate/<value>
The<value>canbe0(zero)todisabletheaccount,or1(one)toenabletheaccount.
ThisAPIreturns“204NoContent”ifsuccessful.
Remove a User Account
ThefirstAPIremovesalocaluseraccount,orremovestheVSMroleassignmentforavCenteruser,without
affectingthevCenteraccount.ThesecondAPIremovesavCenterusersrolesbutisnotallowedforlocalusers.
Example 2-11. Remove a user account
Request:
DELETE https://<vsm-ip>/api/2.0/services/usermgmt/user/<userId>
Example 2-12. Removing a user role
Request:
DELETE https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
BothAPIsreturn“204NoContent”ifsuccessful.
VMware, Inc. 19
Chapter 2 vShield Manager Management
Role Management
Get Role for a User
Youcanretrieveinformationabouttheroleassignedtothisuser.
Example 2-13. Retrieve the role of a user
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.
Add Role and Resources for a User
Youcanaddroleandaccessibleresourcesforthespecifieduser.ItaffectsonlyvCenterusers,notlocalusers.
ForlocalvShieldManagerusers,itthrowserror“400:Useralreadypresent.”
Example 2-14. Update the role of a user
RequestHeader:
POST https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>
ThisAPIreturns“204NoContent”ifsuccessful.
Change Role for a User
Youcanupdatetheroleassignmentforagivenuser.TheAPIreturnsanoutputrepresentationspecifyinga
new<accessControlEntry>fortheuser.
Example 2-15. Change the role of a user
RequestHeader:
PUT https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>
Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.
vShield API Programming Guide
20 VMware, Inc.
Get a List of Possible Roles
YoucanretrievethepossiblerolesinvShieldManager.
Example 2-16. Retrieve possible roles
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/roles
Get a List of Scoping Objects
Youcanretrievealistofobjectsthatcanbeusedtodefineausersaccessscope.
Example 2-17. Retrieve scoping objects
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/scopingobjects
ThescopingobjectsareusuallymanagedobjectreferencesorvCenterServernamesofdatacentersandfolders.
Creating IPset and MACset Containers
YoucancreatevShieldcontainersbasedonIPaddressesandMACaddresses.TheseAPIscontroltwotypesof
resources:vShieldManagerscopeobject(adatacenterorportgroup)andtheIPsetorMACsetaddresses.
List IPsets Created on a Scope
YoucanretrievealltheIPsetsthatwerecreatedonthespecifiedscope.
Example 2-18. List IPsets on a scope
Request:
GET https://<vsm-ip>/api/2.0/services/ipset/scope/<scope-moref>
The<scope-moref>canbeadatacenterorportgroupofthevCentertowhichvShieldManagerisconnected.
Create an IPset on a Scope
YoucancreateanewIPsetonthespecifiedscope.
Example 2-19. Create IPset on a scope
Request:
POST https://<vsm-ip>/api/2.0/services/ipset/scope/<scope-moref>
RequestBodyExample:
<ipset>
<objectId />
<type>
<typeName />
</type>
<description>
New Description
</description>
<name>TestIPSet2</name>
<revision>0</revision>
<objectTypeName />
/