6.0

Table Of Contents
vSphere SDK for Perl Programming Guide
62 VMware, Inc.
Apersistencefileusedtostoreauthenticationcredentials.Currently,onlypasswordsaresupported.The
persistencefilemapsaremoteuseraccountfromanESX/ESXihosttothatuserspasswordonthehost.
vSphereWebServicesSDK(C#andJav a)andvSphereSDKforPerllibrariesforprogrammatically
managingthefile.vSphereWebServicesSDKandvSphereSDKforPerlaccessthesamecredentialstore.
Credential Store Components
ThevSphereSDKforPerlincludestwocredentialstorefilesinitsinstallationpackage:
VICredStore.pmThePerlpackageforthecredentialstorelibrarylocatedin:
Windows: \Program Files\VMware\VMware vSphere CLI\Perl\lib\VMware\VICredStore.pm
Linux: /usr/lib/perl5/site_perl/5.8.8/VMware/VICredStore.pm
Perlapplicationscanusethispackagetoadd,retrieve,delete,update,andlisttheentriesstoredinthe
credentialstore.Theapps/general/credstore_admin.plfileisanexampleforcredentialstoreuse.
Eachentryinthecredentialstoreisatupleofhostname,username,andpassword.Thepasswordis
storedin
anobfuscatedmannerinthecredentialstore.
credstore_admin.plAPerlapplicationthatusesVICredStore.pmforaccessingthecredentialstore.
Youcanusecredstore_admin.pl,whichisanexample,asacommandlineinterfacetothecredential
store.credstore_admin.plislocatedin:
Windows: \Program Files\VMware\VMware vSphere CLI\Perl\apps\general\credstore_admin.pl
Linux: /usr/lib/vmware-viperl/apps/general/credstore_admin.pl
Managing the Credential Store
YoucanusePerltomanagethecredentialstoreinoneoftwoways:
UsethesubroutinesinVICredStore.pminyourPerlscript.See“vSphereCredentialStoreSubroutine
Reference”onpage 63forreferencedocumentation.Thecredstore_admin.plscriptillustrateshowto
usethesubroutines.
Usethe\apps\general\credstore_admin.plcommandstomanagethestoreinteractively.
Using the Credential Store
Afteryouhavesetupthecredentialstorewithusersandpasswords,youcanusethecredentialsasfollows:
InyourownPerlscripts,youcanretrievepasswordsorotherinformationasneededusingthelibrary
subroutine.
WhenyourunanexistingvSphereSDKforPerlorvSphereCLIscript,youcanspecifythehostanduser
nameeitherfromthecommandlineorinanenvironmentvariable.Whenthathostandusernamehasan
entrywithavalidpasswordinthecredentialstore,thescriptis
run.
Ifyourunascriptthatincludesahostnamebutnouser,andifthecredentialstorecontainsexactlyone
entryforthathost,thescripttakestheuserfromthatcredentialstoreentryandnotpromptforauser.
WhenyoucallanexistingvSphereSDKforPerlorvSphereCLIscript,andyouspecifyonlythehostname,
theauthenticationmechanismpromptsforausername.Ifnoentryexistsforthatuser,theauthentication
mechanismalsopromptsforapassword.
I
MPORTANTThepasswordsinthefileareobfuscatedbutnotencrypted.Youmustprotectthefilebyother
meansandcarefullycontrolwhocanaccessit.
IMPORTANTCreateauserwithappropriateprivilegesandstorethecorrespondingusernameandpassword
inthecredentialstore.Donotusetherootoradministratoruserandthecorrespondingpassword.