mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +02:00
config: require shared key if using redis backed databroker (#1801)
This commit is contained in:
parent
d4037f0010
commit
f946d940f5
2 changed files with 7 additions and 1 deletions
|
@ -496,7 +496,7 @@ func (o *Options) Validate() error {
|
||||||
|
|
||||||
if IsAll(o.Services) {
|
if IsAll(o.Services) {
|
||||||
// mutual auth between services on the same host can be generated at runtime
|
// mutual auth between services on the same host can be generated at runtime
|
||||||
if o.SharedKey == "" {
|
if o.SharedKey == "" && o.DataBrokerStorageType == StorageInMemoryName {
|
||||||
o.SharedKey = cryptutil.NewBase64Key()
|
o.SharedKey = cryptutil.NewBase64Key()
|
||||||
}
|
}
|
||||||
// in all in one mode we are running just over the local socket
|
// in all in one mode we are running just over the local socket
|
||||||
|
|
|
@ -47,6 +47,11 @@ func Test_Validate(t *testing.T) {
|
||||||
badSignoutRedirectURL := testOptions()
|
badSignoutRedirectURL := testOptions()
|
||||||
badSignoutRedirectURL.SignOutRedirectURLString = "--"
|
badSignoutRedirectURL.SignOutRedirectURLString = "--"
|
||||||
|
|
||||||
|
missingSharedSecretWithPersistence := testOptions()
|
||||||
|
missingSharedSecretWithPersistence.SharedKey = ""
|
||||||
|
missingSharedSecretWithPersistence.DataBrokerStorageType = StorageRedisName
|
||||||
|
missingSharedSecretWithPersistence.DataBrokerStorageConnectionString = "redis://somehost:6379"
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
testOpts *Options
|
testOpts *Options
|
||||||
|
@ -60,6 +65,7 @@ func Test_Validate(t *testing.T) {
|
||||||
{"invalid databroker storage type", invalidStorageType, true},
|
{"invalid databroker storage type", invalidStorageType, true},
|
||||||
{"missing databroker storage dsn", missingStorageDSN, true},
|
{"missing databroker storage dsn", missingStorageDSN, true},
|
||||||
{"invalid signout redirect url", badSignoutRedirectURL, true},
|
{"invalid signout redirect url", badSignoutRedirectURL, true},
|
||||||
|
{"no shared key with databroker persistence", missingSharedSecretWithPersistence, true},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue