REQUESTED

Windows pass through authentication

Overview

Example of using pyVim.SmartConnect with mechanism="sspi" to provide windows passthrough authentication.

I have pieced together this so far, but it doesn’t work.

import sspi
import pyVim.connect
from pyVmomi import vim
from base64 import encodestring, decodestring

def connect_to_vmware():
ca = sspi.ClientAuth("Kerberos", targetspn="<somethinghere>")
data = None
c = None
while not ca.authenticated:
err, out_buf = ca.authorize(data)
data = out_buf[0].Buffer
print ca.pkg_info
auth = encodestring(data)
print "auth -> ", auth
try:
c = pyVim.connect.SmartConnect(host="<servername>", mechanism="sspi", b64token=auth)
return c
except vim.fault.SSPIChallenge as e:
print e
data = decodestring(e.base64Token)
print "auth <- ", e.base64Token

connect_to_vmware()