Skip to content

Commit

Permalink
reduce to one configuration option
Browse files Browse the repository at this point in the history
There should be just one option, verify_https_client, which
controls incoming and outgoing validation for the HTTPS wrapper
  • Loading branch information
Pete Wildsmith committed Apr 28, 2017
1 parent 6ca0575 commit a4ad6eb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
3 changes: 1 addition & 2 deletions command/agent/config-test-fixtures/basic.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,5 @@ tls {
ca_file = "foo"
cert_file = "bar"
key_file = "pipe"
verify_incoming = true
verify_outgoing = true
verify_https_client = true
}
3 changes: 1 addition & 2 deletions command/agent/config_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,7 @@ func parseTLSConfig(result **config.TLSConfig, list *ast.ObjectList) error {
"ca_file",
"cert_file",
"key_file",
"verify_incoming",
"verify_outgoing",
"verify_https_client",
}

if err := checkHCLKeys(listVal, valid); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions command/agent/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func NewHTTPServer(agent *Agent, config *Config) (*HTTPServer, error) {
// If TLS is enabled, wrap the listener with a TLS listener
if config.TLSConfig.EnableHTTP {
tlsConf := &tlsutil.Config{
VerifyIncoming: config.TLSConfig.VerifyIncoming,
VerifyOutgoing: config.TLSConfig.VerifyOutgoing,
VerifyIncoming: config.TLSConfig.VerifyHTTPSClient,
VerifyOutgoing: config.TLSConfig.VerifyHTTPSClient,
VerifyServerHostname: config.TLSConfig.VerifyServerHostname,
CAFile: config.TLSConfig.CAFile,
CertFile: config.TLSConfig.CertFile,
Expand Down
15 changes: 4 additions & 11 deletions nomad/structs/config/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ type TLSConfig struct {
// Must be provided to serve TLS connections.
KeyFile string `mapstructure:"key_file"`

// VerifyIncoming
VerifyIncoming bool `mapstructure:"verify_incoming"`

// VerifyOutgoing
VerifyOutgoing bool `mapstructure:"verify_outgoing"`
// Verify connections to the HTTPS API
VerifyHTTPSClient bool `mapstructure:"verify_https_client"`
}

// Merge is used to merge two TLS configs together
Expand All @@ -58,12 +55,8 @@ func (t *TLSConfig) Merge(b *TLSConfig) *TLSConfig {
if b.KeyFile != "" {
result.KeyFile = b.KeyFile
}
if b.VerifyIncoming {
result.VerifyIncoming = true
}
if b.VerifyOutgoing {
result.VerifyOutgoing = true
if b.VerifyHTTPSClient {
result.VerifyHTTPSClient = true
}

return &result
}

0 comments on commit a4ad6eb

Please sign in to comment.