Skip to content

Commit

Permalink
Implement the insecure version of the Cluster.AutoConfig RPC endpoint
Browse files Browse the repository at this point in the history
Right now this is only hooked into the insecure RPC server and requires JWT authorization. If no JWT authorizer is setup in the configuration then we inject a disabled “authorizer” to always report that JWT authorization is disabled.
  • Loading branch information
mkeeler committed Jun 16, 2020
1 parent 1dba943 commit 39d5bfa
Show file tree
Hide file tree
Showing 16 changed files with 4,713 additions and 10 deletions.
12 changes: 12 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,18 @@ func (a *Agent) consulConfig() (*consul.Config, error) {
}
}

// copy over auto config settings
base.AutoConfigEnabled = a.config.AutoConfig.Enabled
base.AutoConfigIntroToken = a.config.AutoConfig.IntroToken
base.AutoConfigIntroTokenFile = a.config.AutoConfig.IntroTokenFile
base.AutoConfigServerAddresses = a.config.AutoConfig.ServerAddresses
base.AutoConfigDNSSANs = a.config.AutoConfig.DNSSANs
base.AutoConfigIPSANs = a.config.AutoConfig.IPSANs
base.AutoConfigAuthzEnabled = a.config.AutoConfig.Authorizer.Enabled
base.AutoConfigAuthzAuthMethod = a.config.AutoConfig.Authorizer.AuthMethod
base.AutoConfigAuthzClaimAssertions = a.config.AutoConfig.Authorizer.ClaimAssertions
base.AutoConfigAuthzAllowReuse = a.config.AutoConfig.Authorizer.AllowReuse

// Setup the user event callback
base.UserEventHandler = func(e serf.UserEvent) {
select {
Expand Down
21 changes: 21 additions & 0 deletions agent/agentpb/auto_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package agentpb

func (req *AutoConfigRequest) RequestDatacenter() string {
return req.Datacenter
}

func (req *AutoConfigRequest) IsRead() bool {
return false
}

func (req *AutoConfigRequest) AllowStaleRead() bool {
return false
}

func (req *AutoConfigRequest) TokenSecret() string {
return req.ConsulToken
}

func (req *AutoConfigRequest) SetTokenSecret(token string) {
req.ConsulToken = token
}
28 changes: 28 additions & 0 deletions agent/agentpb/auto_config.pb.binary.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 39d5bfa

Please sign in to comment.