Backport of backport ent changes to oss into release/1.16.x (#17617)

* backport of commit dc9c08d3b8cc1eda95a05a8b041ab2a3a5248dd0

* backport of commit 1271705a5cce5fe5e9487fed2ac965ab7aac3d59

---------

Co-authored-by: Ronald Ekambi <ronekambi@gmail.com>
Co-authored-by: Ronald <roncodingenthusiast@users.noreply.github.com>
This commit is contained in:
hc-github-team-consul-core 2023-06-08 12:45:28 -04:00 committed by GitHub
parent 4d369c4aa4
commit dcf9b04c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

3
.changelog/_5669.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
audit-logging: **(Enterprise only)** enable error response and request body logging
```

View File

@ -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) { func makeNonBootstrappedACLClient(t *testing.T, defaultPolicy string) (*Client, *testutil.TestServer) {
return makeClientWithConfig(t, return makeClientWithConfig(t,
func(clientConfig *Config) { func(clientConfig *Config) {

View File

@ -75,6 +75,11 @@ type TestNetworkSegment struct {
Advertise string `json:"advertise"` 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. // Locality is used as the TestServerConfig's Locality.
type Locality struct { type Locality struct {
Region string `json:"region"` Region string `json:"region"`
@ -124,6 +129,7 @@ type TestServerConfig struct {
Stderr io.Writer `json:"-"` Stderr io.Writer `json:"-"`
Args []string `json:"-"` Args []string `json:"-"`
ReturnPorts func() `json:"-"` ReturnPorts func() `json:"-"`
Audit *TestAuditConfig `json:"audit,omitempty"`
} }
type TestACLs struct { type TestACLs struct {