Merge pull request #3061 from goodwinb99/master
Implement WinRM-over-HTTPS
This commit is contained in:
commit
8580e7dac0
|
@ -26,8 +26,10 @@ type Communicator struct {
|
|||
// New creates a new communicator implementation over WinRM.
|
||||
func New(config *Config) (*Communicator, error) {
|
||||
endpoint := &winrm.Endpoint{
|
||||
Host: config.Host,
|
||||
Port: config.Port,
|
||||
Host: config.Host,
|
||||
Port: config.Port,
|
||||
HTTPS: config.Https,
|
||||
Insecure: config.Insecure,
|
||||
|
||||
/*
|
||||
TODO
|
||||
|
@ -145,6 +147,8 @@ func (c *Communicator) newCopyClient() (*winrmcp.Winrmcp, error) {
|
|||
User: c.config.Username,
|
||||
Password: c.config.Password,
|
||||
},
|
||||
Https: c.config.Https,
|
||||
Insecure: c.config.Insecure,
|
||||
OperationTimeout: c.config.Timeout,
|
||||
MaxOperationsPerShell: 15, // lowest common denominator
|
||||
})
|
||||
|
|
|
@ -11,4 +11,6 @@ type Config struct {
|
|||
Username string
|
||||
Password string
|
||||
Timeout time.Duration
|
||||
Https bool
|
||||
Insecure bool
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ type Config struct {
|
|||
WinRMHost string `mapstructure:"winrm_host"`
|
||||
WinRMPort int `mapstructure:"winrm_port"`
|
||||
WinRMTimeout time.Duration `mapstructure:"winrm_timeout"`
|
||||
WinRMUseSSL bool `mapstructure:"winrm_use_ssl"`
|
||||
WinRMInsecure bool `mapstructure:"winrm_insecure"`
|
||||
}
|
||||
|
||||
// Port returns the port that will be used for access based on config.
|
||||
|
|
|
@ -129,6 +129,8 @@ func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, cancel <-chan
|
|||
Username: user,
|
||||
Password: password,
|
||||
Timeout: s.Config.WinRMTimeout,
|
||||
Https: s.Config.WinRMUseSSL,
|
||||
Insecure: s.Config.WinRMInsecure,
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] WinRM connection err: %s", err)
|
||||
|
|
|
@ -111,3 +111,8 @@ The WinRM communicator has the following options.
|
|||
* `winrm_timeout` (string) - The amount of time to wait for WinRM to
|
||||
become available. This defaults to "30m" since setting up a Windows
|
||||
machine generally takes a long time.
|
||||
|
||||
* `winrm_use_ssl` (boolean) - If true, use HTTPS for WinRM
|
||||
|
||||
* `winrm_insecure` (boolean) - If true, do not check server certificate
|
||||
chain and host name
|
||||
|
|
Loading…
Reference in New Issue