Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -insecure flag to import_dashboards #3163

Merged
merged 1 commit into from
Dec 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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