Skip to content

Commit

Permalink
Skip TLS hostname verification for both HTTP clients
Browse files Browse the repository at this point in the history
When --insecure-skip-verify is selected, disable hostname verification
checking on both the puppet HTTP client and the sensu HTTP client.

Signed-off-by: Eric Chlebek <[email protected]>
  • Loading branch information
echlebek committed Feb 9, 2023
1 parent b5d3c74 commit 55eb716
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

## [0.5.0] - 2023-02-09

## Changed
- Update sensu-plugin-sdk, use new option types
- Use github.com/sensu/core instead of github.com/sensu/sensu-go/api/core
- Propagate hostname verification skipping option to Sensu HTTP client

## [0.4.0] - 2022-12-02

### Changed
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var (
Path: "insecure-skip-tls-verify",
Env: "PUPPET_INSECURE_SKIP_TLS_VERIFY",
Argument: "insecure-skip-tls-verify",
Usage: "skip SSL verification",
Usage: "skip TLS verification for Puppet and sensu-backend",
Value: &handler.puppetInsecureSkipVerify,
},
&sensu.PluginConfigOption[string]{
Expand Down Expand Up @@ -295,6 +295,9 @@ func deregisterEntity(event *corev2.Event) error {
config.CACert = cert

}
if handler.puppetInsecureSkipVerify {
config.InsecureSkipVerify = true
}
client := httpclient.NewCoreClient(config)
request, err := httpclient.NewResourceRequest("core/v2", "Entity", event.Entity.Namespace, event.Entity.Name)
if err != nil {
Expand Down

0 comments on commit 55eb716

Please sign in to comment.