Skip to content

Commit

Permalink
Ignore https errors (#27412) (#27425)
Browse files Browse the repository at this point in the history
Fixes #27202

NOTE: This requires a version of synthetics with elastic/synthetics#361

Adds an option to disable errors on invalid TLS certificates in heartbeat.

Rather than try to work with ssl.verification_mode: none this adds a new option. The reason being that the behavior here is just too different to share a configuration option.

(cherry picked from commit 6c603a8)

Co-authored-by: Andrew Cholakian <andrew@andrewvc.com>
  • Loading branch information
mergify[bot] and andrewvc committed Aug 17, 2021
1 parent 8229f6a commit fd463b8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions heartbeat/docs/monitors/monitor-browser.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ Example configuration:
path: "/path/to/synthetics/journeys"
-------------------------------------------------------------------------------

[float]
[[monitor-browser-ignore-https-errors]]]]
==== `ignore_https_errors`

Set this option to `true` to disable TLS/SSL validation in the synthetics browser. This is useful for testing
sites that use self-signed certs. This option can also be used to test certs from non-standard CAs,
though you will no longer get errors if there is anything wrong with the certificate.


[float]
[[monitor-browser-sandbox]]
==== `sandbox`
Expand Down
11 changes: 6 additions & 5 deletions x-pack/heartbeat/monitors/browser/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ type Config struct {
// Name is optional for lightweight checks but required for browsers
Name string `config:"name"`
// Id is optional for lightweight checks but required for browsers
Id string `config:"id"`
Sandbox bool `config:"sandbox"`
Screenshots string `config:"screenshots"`
SyntheticsArgs []string `config:"synthetics_args"`
FilterJourneys synthexec.FilterJourneyConfig `config:"filter_journeys"`
Id string `config:"id"`
Sandbox bool `config:"sandbox"`
Screenshots string `config:"screenshots"`
SyntheticsArgs []string `config:"synthetics_args"`
FilterJourneys synthexec.FilterJourneyConfig `config:"filter_journeys"`
IgnoreHTTPSErrors bool `config:"ignore_https_errors"`
}

var ErrNameRequired = fmt.Errorf("config 'name' must be specified for this monitor")
Expand Down
3 changes: 3 additions & 0 deletions x-pack/heartbeat/monitors/browser/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func (s *Suite) Close() error {

func (s *Suite) extraArgs() []string {
extraArgs := s.suiteCfg.SyntheticsArgs
if s.suiteCfg.IgnoreHTTPSErrors {
extraArgs = append(extraArgs, "--ignore-https-errors")
}
if s.suiteCfg.Sandbox {
extraArgs = append(extraArgs, "--sandbox")
}
Expand Down
5 changes: 5 additions & 0 deletions x-pack/heartbeat/monitors/browser/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ func TestExtraArgs(t *testing.T) {
&Config{Sandbox: true},
[]string{"--sandbox"},
},
{
"ignore_https_errors",
&Config{IgnoreHTTPSErrors: true},
[]string{"--ignore-https-errors"},
},
{
"screenshots",
&Config{Screenshots: "off"},
Expand Down

0 comments on commit fd463b8

Please sign in to comment.