Skip to content

Added isSecure field in the winrm settings. When isSecure is true, we allow HTTPs connection to end point powershell. If isSecure is false, we allow HTTP connection to end point powershell.#5

Open
aspiremore wants to merge 10 commits intoCiscoM31:masterfrom
aspiremore:powershell_to_m31

Conversation

@aspiremore
Copy link

No description provided.

Copy link

@rabadin rabadin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there isn't a ton of tests in this repo... but how about adding one for your change?

winrm.go Outdated
NTLM
Kerberos
)
const WINRM_HTTP_PORT = 5985
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a detail but this is unused... so I'm wondering why you're adding it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

winrm.go Outdated
operationTimeout string
// Timeout of each HTTP call made
timeout int
//Whether the call is http or https
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits:

  • Missing space before "Whether"
  • http -> HTTP / https -> HTTPS

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

client.winrmSettings = o(client.winrmSettings)
}
client.url = fmt.Sprintf("https://%s:%d/wsman", client.ipAddress, client.port)
if client.isSecure {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a detail but to avoid repeating the whole Sprintf line, how about:

if client.isSecure {
    protocol = "https"
} else {
    protocol = "http"
}

then use protocol

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Kerberos
)
const (
HTTP_PROTOCOL = "http"
Copy link

@rabadin rabadin Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a detail but http/https is usually referred as the "scheme".

}
}

func BenchmarkHTTPRequest(b *testing.B) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this is relevant...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants