diff --git a/builder/vmware/common/step_configure_vnc.go b/builder/vmware/common/step_configure_vnc.go index cfe1cfe56..bc65fc649 100644 --- a/builder/vmware/common/step_configure_vnc.go +++ b/builder/vmware/common/step_configure_vnc.go @@ -63,7 +63,7 @@ func VNCPassword(skipPassword bool) string { } length := int(8) - charSet := []byte("1234567890-=qwertyuiop[]asdfghjkl;zxcvbnm,./!@#%^*()_+QWERTYUIOP{}|ASDFGHJKL:XCVBNM<>?") + charSet := []byte("012345689abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") charSetLength := len(charSet) password := make([]byte, length) diff --git a/builder/vmware/common/step_configure_vnc.go.rej b/builder/vmware/common/step_configure_vnc.go.rej deleted file mode 100644 index 621d524fd..000000000 --- a/builder/vmware/common/step_configure_vnc.go.rej +++ /dev/null @@ -1,46 +0,0 @@ -diff a/builder/vmware/common/step_configure_vnc.go b/builder/vmware/common/step_configure_vnc.go (rejected hunks) -@@ -52,6 +52,21 @@ func (StepConfigureVNC) VNCAddress(portMin, portMax uint) (string, uint, error) - return "127.0.0.1", vncPort, nil - } - -+func VNCPassword() (string) { -+ length := int(8) -+ -+ charSet := []byte("1234567890-=qwertyuiop[]asdfghjkl;zxcvbnm,./!@#%^*()_+QWERTYUIOP{}|ASDFGHJKL:XCVBNM<>?") -+ charSetLength := len(charSet) -+ -+ password := make([]byte, length) -+ -+ for i := 0; i < length; i++ { -+ password[i] = charSet[ rand.Intn(charSetLength) ] -+ } -+ -+ return string(password) -+} -+ - func (s *StepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction { - driver := state.Get("driver").(Driver) - ui := state.Get("ui").(packer.Ui) -@@ -86,12 +101,14 @@ func (s *StepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction { - ui.Error(err.Error()) - return multistep.ActionHalt - } -+ vncPassword := VNCPassword() - - log.Printf("Found available VNC port: %d", vncPort) - - vmxData := ParseVMX(string(vmxBytes)) - vmxData["remotedisplay.vnc.enabled"] = "TRUE" - vmxData["remotedisplay.vnc.port"] = fmt.Sprintf("%d", vncPort) -+ vmxData["remotedisplay.vnc.password"] = vncPassword - - if err := WriteVMX(vmxPath, vmxData); err != nil { - err := fmt.Errorf("Error writing VMX data: %s", err) -@@ -102,6 +119,7 @@ func (s *StepConfigureVNC) Run(state multistep.StateBag) multistep.StepAction { - - state.Put("vnc_port", vncPort) - state.Put("vnc_ip", vncIp) -+ state.Put("vnc_password", vncPassword) - - return multistep.ActionContinue - } diff --git a/builder/vmware/common/step_type_boot_command.go.rej b/builder/vmware/common/step_type_boot_command.go.rej deleted file mode 100644 index ee084c6bb..000000000 --- a/builder/vmware/common/step_type_boot_command.go.rej +++ /dev/null @@ -1,26 +0,0 @@ -diff a/builder/vmware/common/step_type_boot_command.go b/builder/vmware/common/step_type_boot_command.go (rejected hunks) -@@ -45,6 +45,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction - ui := state.Get("ui").(packer.Ui) - vncIp := state.Get("vnc_ip").(string) - vncPort := state.Get("vnc_port").(uint) -+ vncPassword := state.Get("vnc_password") - - // Connect to VNC - ui.Say("Connecting to VM via VNC") -@@ -57,7 +58,15 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction - } - defer nc.Close() - -- c, err := vnc.Client(nc, &vnc.ClientConfig{Exclusive: true}) -+ var auth []vnc.ClientAuth -+ -+ if vncPassword != nil { -+ auth = []vnc.ClientAuth{&vnc.PasswordAuth{Password: vncPassword.(string)}} -+ } else { -+ auth = []vnc.ClientAuth{} -+ } -+ -+ c, err := vnc.Client(nc, &vnc.ClientConfig{Auth: auth, Exclusive: true}) - if err != nil { - err := fmt.Errorf("Error handshaking with VNC: %s", err) - state.Put("error", err)