Skip to content

Commit 51c3a60

Browse files
authored
Merge pull request hashicorp#8035 from hashicorp/feature/auto-config/server-rpc
2 parents 79a862d + 9b01f94 commit 51c3a60

17 files changed

+5337
-10
lines changed

acl/errors.go

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package acl
22

33
import (
44
"errors"
5+
"fmt"
56
"strings"
67
)
78

@@ -70,3 +71,8 @@ func (e PermissionDeniedError) Error() string {
7071
}
7172
return errPermissionDenied
7273
}
74+
75+
func PermissionDenied(msg string, args ...interface{}) PermissionDeniedError {
76+
cause := fmt.Sprintf(msg, args...)
77+
return PermissionDeniedError{Cause: cause}
78+
}

agent/agent.go

+12
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,18 @@ func (a *Agent) consulConfig() (*consul.Config, error) {
14021402
}
14031403
}
14041404

1405+
// copy over auto config settings
1406+
base.AutoConfigEnabled = a.config.AutoConfig.Enabled
1407+
base.AutoConfigIntroToken = a.config.AutoConfig.IntroToken
1408+
base.AutoConfigIntroTokenFile = a.config.AutoConfig.IntroTokenFile
1409+
base.AutoConfigServerAddresses = a.config.AutoConfig.ServerAddresses
1410+
base.AutoConfigDNSSANs = a.config.AutoConfig.DNSSANs
1411+
base.AutoConfigIPSANs = a.config.AutoConfig.IPSANs
1412+
base.AutoConfigAuthzEnabled = a.config.AutoConfig.Authorizer.Enabled
1413+
base.AutoConfigAuthzAuthMethod = a.config.AutoConfig.Authorizer.AuthMethod
1414+
base.AutoConfigAuthzClaimAssertions = a.config.AutoConfig.Authorizer.ClaimAssertions
1415+
base.AutoConfigAuthzAllowReuse = a.config.AutoConfig.Authorizer.AllowReuse
1416+
14051417
// Setup the user event callback
14061418
base.UserEventHandler = func(e serf.UserEvent) {
14071419
select {

agent/agentpb/auto_config.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package agentpb
2+
3+
func (req *AutoConfigRequest) RequestDatacenter() string {
4+
return req.Datacenter
5+
}
6+
7+
func (req *AutoConfigRequest) IsRead() bool {
8+
return false
9+
}
10+
11+
func (req *AutoConfigRequest) AllowStaleRead() bool {
12+
return false
13+
}
14+
15+
func (req *AutoConfigRequest) TokenSecret() string {
16+
return req.ConsulToken
17+
}
18+
19+
func (req *AutoConfigRequest) SetTokenSecret(token string) {
20+
req.ConsulToken = token
21+
}

agent/agentpb/auto_config.pb.binary.go

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)