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

make tls option InsecureSkipVerify configurable by alertmanager #1140

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
ec.RequireTLS = new(bool)
*ec.RequireTLS = c.Global.SMTPRequireTLS
}
if ec.InsecureSkipVerify == nil {
ec.InsecureSkipVerify = new(bool)
*ec.InsecureSkipVerify = c.Global.InsecureSkipVerify
}
}
for _, sc := range rcv.SlackConfigs {
if sc.APIURL == "" {
Expand Down Expand Up @@ -326,6 +330,7 @@ var DefaultGlobalConfig = GlobalConfig{
OpsGenieAPIURL: "https://api.opsgenie.com/",
WeChatAPIURL: "https://qyapi.weixin.qq.com/cgi-bin/",
VictorOpsAPIURL: "https://alert.victorops.com/integrations/generic/20131114/alert/",
InsecureSkipVerify: false,
}

// GlobalConfig defines configuration parameters that are valid globally
Expand Down Expand Up @@ -353,6 +358,7 @@ type GlobalConfig struct {
WeChatAPICorpID string `yaml:"wechat_api_corp_id,omitempty" json:"wechat_api_corp_id,omitempty"`
VictorOpsAPIURL string `yaml:"victorops_api_url,omitempty" json:"victorops_api_url,omitempty"`
VictorOpsAPIKey Secret `yaml:"victorops_api_key,omitempty" json:"victorops_api_key,omitempty"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify,omitempty" json:"insecure_skip_verify",omitempty"`

// Catches all undefined fields and must be empty after parsing.
XXX map[string]interface{} `yaml:",inline" json:"-"`
Expand Down
2 changes: 2 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ func TestJSONUnmarshalMarshaled(t *testing.T) {

func TestEmptyFieldsAndRegex(t *testing.T) {
boolFoo := true
boolFalse := false
var regexpFoo Regexp
regexpFoo.Regexp, _ = regexp.Compile("^(?:^(foo1|foo2|baz)$)$")

Expand Down Expand Up @@ -318,6 +319,7 @@ func TestEmptyFieldsAndRegex(t *testing.T) {
Smarthost: "localhost:25",
HTML: "{{ template \"email.default.html\" . }}",
RequireTLS: &boolFoo,
InsecureSkipVerify: &boolFalse,
},
},
},
Expand Down
1 change: 1 addition & 0 deletions config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ type EmailConfig struct {
HTML string `yaml:"html,omitempty" json:"html,omitempty"`
Text string `yaml:"text,omitempty" json:"text,omitempty"`
RequireTLS *bool `yaml:"require_tls,omitempty" json:"require_tls,omitempty"`
InsecureSkipVerify *bool `yaml:"insecure_skip_verify,omitempty" json:"insecure_skip_verify,omitempty"`

// Catches all undefined fields and must be empty after parsing.
XXX map[string]interface{} `yaml:",inline" json:"-"`
Expand Down