train icon indicating copy to clipboard operation
train copied to clipboard

Add support for powershell credential to VMware train

Open rlakey opened this issue 5 years ago • 2 comments

Describe the Enhancement:

Using a powershell credential to connect to vCenter/ESXi with the VMware train. PowerCLI already supports this natively with the -Credential option on Connect-VIServer.

Describe the Need:

This will allow more credential options like using a smartcard/token for authentication and would be more secure than using environmental variables or username/password.

Current Alternative

None that i know of

Can We Help You Implement This?:

Yes

rlakey avatar Nov 28 '19 16:11 rlakey

It looks like to implement this we could make the following modifications to the vmware transport.

https://github.com/inspec/train/blob/master/lib/train/transports/vmware.rb

Add a credential option after line 13. This might have to be restricted to an environment variable right now since it is a PowerShell construct and ruby won't know what it is. It might also not work if ruby is unable to handle the credential object.

Add a clause for if a credential is defined at line 53 to change the command used to connect.

kclinden avatar Mar 05 '20 12:03 kclinden

Another thought would be to have an option where the vCenter connection was handled outside of inspec.

Say I pre-connected to vCenter before running Inspec which would then handle all the normal authentication options.

So then running inspec would just be something like "inspec exec ./profile -t vmware:// --vcpreauth"

rlakey avatar Mar 05 '20 17:03 rlakey