@@ -28,7 +28,7 @@ type Config struct {
28
28
Port int
29
29
User string
30
30
Password string
31
- Tls bool
31
+ NoTls bool
32
32
Insecure bool
33
33
TlsCAPath string
34
34
tlsCA []byte
@@ -55,9 +55,9 @@ func BuildConfigFlags(fs *pflag.FlagSet) (config *Config) {
55
55
fs .StringVarP (& config .User , "user" , "U" , "" , "Username of the remote host" )
56
56
fs .StringVarP (& config .Password , "password" , "P" , "" , "Password of the user" )
57
57
58
- fs .BoolVarP (& config .Tls , "tls" , "S" , false , "Use TLS connection (default: false)" )
59
58
fs .BoolVarP (& config .Insecure , "insecure" , "k" , false ,
60
59
"Don't verify the hostname on the returned certificate" )
60
+ fs .BoolVar (& config .NoTls , "no-tls" , false , "Don't use a TLS connection, use the HTTP protocol" )
61
61
fs .StringVar (& config .TlsCAPath , "ca" , "" , "CA certificate" )
62
62
fs .StringVar (& config .TlsCertPath , "cert" , "" , "Client certificate" )
63
63
fs .StringVar (& config .TlsKeyPath , "key" , "" , "Client Key" )
@@ -100,9 +100,9 @@ func (c *Config) Validate() (err error) {
100
100
101
101
// Set default port if unset
102
102
if c .Port < 1 {
103
- c .Port = Port
104
- if c .Tls {
105
- c .Port = TlsPort
103
+ c .Port = TlsPort
104
+ if c .NoTls {
105
+ c .Port = Port
106
106
}
107
107
}
108
108
@@ -189,7 +189,7 @@ func (c *Config) Run(timeout time.Duration) (err error, rc int, output string) {
189
189
endpoint := winrm .NewEndpoint (
190
190
c .Host , // Host to connect to
191
191
c .Port , // Winrm port
192
- c . Tls , // Use TLS
192
+ ! c . NoTls , // Use TLS
193
193
c .Insecure , // Allow insecure connection
194
194
c .tlsCA , // CA certificate
195
195
c .tlsCert , // Client Certificate
0 commit comments