Skip to content

Commit

Permalink
Add -insecure flag to import_dashboards (#3163)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh authored and tsg committed Dec 9, 2016
1 parent 21e0a7d commit 1ac7bf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ https://github.com/elastic/beats/compare/v5.0.1...master[Check the HEAD diff]
- Added decode_json_fields processor for decoding fields containing JSON strings. {pull}2605[2605]
- Add support for passing list and dictionary settings via -E flag.
- Support for parsing list and dictionary setting from environment variables.
- Added new flags to import_dashboards (-cacert, -cert, -key, -insecure). {pull}3139[3139] {pull}3163[3163]

*Metricbeat*

Expand Down
6 changes: 6 additions & 0 deletions libbeat/dashboards/import_dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Options struct {
Certificate string
CertificateKey string
CertificateAuthority string
Insecure bool // Allow insecure SSL connections.
OnlyDashboards bool
OnlyIndex bool
Snapshot bool
Expand Down Expand Up @@ -99,6 +100,7 @@ func DefineCommandLine() (*CommandLine, error) {
cl.flagSet.StringVar(&cl.opt.CertificateAuthority, "cacert", "", "Certificate Authority for server verification")
cl.flagSet.StringVar(&cl.opt.Certificate, "cert", "", "Certificate for SSL client authentication in PEM format.")
cl.flagSet.StringVar(&cl.opt.CertificateKey, "key", "", "Client Certificate Key in PEM format.")
cl.flagSet.BoolVar(&cl.opt.Insecure, "insecure", false, `Allows "insecure" SSL connections`)

return &cl, nil
}
Expand Down Expand Up @@ -152,6 +154,10 @@ func New() (*Importer, error) {
var tlsConfig outputs.TLSConfig
var tls *transport.TLSConfig

if cl.opt.Insecure {
tlsConfig.VerificationMode = transport.VerifyNone
}

if len(cl.opt.Certificate) > 0 && len(cl.opt.CertificateKey) > 0 {
tlsConfig.Certificate = outputs.CertificateConfig{
Certificate: cl.opt.Certificate,
Expand Down

0 comments on commit 1ac7bf8

Please sign in to comment.