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

backport ent changes to oss #17614

Merged
merged 2 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .changelog/_5669.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
audit-logging: (Enterprise only) enable error response and request body logging
```
16 changes: 16 additions & 0 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ func makeACLClient(t *testing.T) (*Client, *testutil.TestServer) {
})
}

// Makes a client with Audit enabled, it requires ACLs
func makeAuditClient(t *testing.T) (*Client, *testutil.TestServer) {
return makeClientWithConfig(t, func(clientConfig *Config) {
clientConfig.Token = "root"
}, func(serverConfig *testutil.TestServerConfig) {
serverConfig.PrimaryDatacenter = "dc1"
serverConfig.ACL.Tokens.InitialManagement = "root"
serverConfig.ACL.Tokens.Agent = "root"
serverConfig.ACL.Enabled = true
serverConfig.ACL.DefaultPolicy = "deny"
serverConfig.Audit = &testutil.TestAuditConfig{
Enabled: true,
}
})
}

func makeNonBootstrappedACLClient(t *testing.T, defaultPolicy string) (*Client, *testutil.TestServer) {
return makeClientWithConfig(t,
func(clientConfig *Config) {
Expand Down
6 changes: 6 additions & 0 deletions sdk/testutil/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ type TestNetworkSegment struct {
Advertise string `json:"advertise"`
}

// TestAudigConfig contains the configuration for Audit
type TestAuditConfig struct {
Enabled bool `json:"enabled,omitempty"`
}

// Locality is used as the TestServerConfig's Locality.
type Locality struct {
Region string `json:"region"`
Expand Down Expand Up @@ -124,6 +129,7 @@ type TestServerConfig struct {
Stderr io.Writer `json:"-"`
Args []string `json:"-"`
ReturnPorts func() `json:"-"`
Audit *TestAuditConfig `json:"audit,omitempty"`
}

type TestACLs struct {
Expand Down