From f46a629d7214abe860a8c4eb2a527e07c41f8840 Mon Sep 17 00:00:00 2001 From: David Meyer Date: Mon, 21 Mar 2016 12:12:45 -0500 Subject: [PATCH] communicator/winrm: Fixed HTTPS when using copy client. --- communicator/winrm/communicator.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/communicator/winrm/communicator.go b/communicator/winrm/communicator.go index 30998e0b1..177efdcb9 100644 --- a/communicator/winrm/communicator.go +++ b/communicator/winrm/communicator.go @@ -193,12 +193,21 @@ func (c *Communicator) UploadDir(dst string, src string) error { func (c *Communicator) newCopyClient() (*winrmcp.Winrmcp, error) { addr := fmt.Sprintf("%s:%d", c.endpoint.Host, c.endpoint.Port) - return winrmcp.New(addr, &winrmcp.Config{ + + config := winrmcp.Config{ Auth: winrmcp.Auth{ User: c.connInfo.User, Password: c.connInfo.Password, }, + Https: c.connInfo.HTTPS, + Insecure: c.connInfo.Insecure, OperationTimeout: c.Timeout(), MaxOperationsPerShell: 15, // lowest common denominator - }) + } + + if c.connInfo.CACert != nil { + config.CACertBytes = *c.connInfo.CACert + } + + return winrmcp.New(addr, &config) }