Sign-in is set up from the console, and a directory tried before it is kept
People → Sign-in shows single sign-on, Active Directory and SCIM, and the directory's last sync. E sets up Entra ID from the tenant and client IDs; D sets up Active Directory, tried from the control plane first: each server bound, people who may sign in, members of each mapped group. The secrets go into the store as store:auth/..., sealed by the master key, and the CA into the settings, so no control plane needs a file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4b6b3eeddb
commit
ac25a9136a
24 files changed
+1753
-18
No files matched your search
@@ -8,6 +8,8 @@
|
||||
// /etc/llmgw/secrets/store-dsn a file, trimmed
|
||||
// env:LLMGW_STORE_DSN an environment variable
|
||||
// vault:secret/llmgw/store#dsn a field of a KV secret in Vault
|
||||
// store:auth/ldap-bind a secret the cluster's store keeps,
|
||||
// on a control plane only
|
||||
//
|
||||
// A Vault path's first segment is its KV v2 mount; secret/data/… is taken
|
||||
// as written. KV v1 mounts work too.
|
||||
@@ -85,7 +87,21 @@ func Configure(v Vault) error {
|
||||
|
||||
// IsReference says whether s names a secret somewhere other than a file.
|
||||
func IsReference(s string) bool {
|
||||
return strings.HasPrefix(s, "env:") || strings.HasPrefix(s, "vault:")
|
||||
return strings.HasPrefix(s, "env:") || strings.HasPrefix(s, "vault:") || strings.HasPrefix(s, "store:")
|
||||
}
|
||||
|
||||
var (
|
||||
storeMu sync.RWMutex
|
||||
storeRead func(ctx context.Context, name string) (string, error)
|
||||
)
|
||||
|
||||
// SetStore is how store: references are read: a control plane sets it once
|
||||
// its store is open. A secret kept there is the same for every control
|
||||
// plane, where a file would have to be put on each.
|
||||
func SetStore(read func(ctx context.Context, name string) (string, error)) {
|
||||
storeMu.Lock()
|
||||
defer storeMu.Unlock()
|
||||
storeRead = read
|
||||
}
|
||||
|
||||
// Read reads a secret by reference, trimmed of surrounding space.
|
||||
@@ -100,6 +116,18 @@ func Read(ctx context.Context, ref string) ([]byte, error) {
|
||||
return []byte(strings.TrimSpace(v)), nil
|
||||
case strings.HasPrefix(ref, "vault:"):
|
||||
return readVault(ctx, strings.TrimPrefix(ref, "vault:"))
|
||||
case strings.HasPrefix(ref, "store:"):
|
||||
storeMu.RLock()
|
||||
read := storeRead
|
||||
storeMu.RUnlock()
|
||||
if read == nil {
|
||||
return nil, fmt.Errorf("%s: a store: secret is read on a control plane, which has the store", ref)
|
||||
}
|
||||
v, err := read(ctx, strings.TrimPrefix(ref, "store:"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", ref, err)
|
||||
}
|
||||
return []byte(strings.TrimSpace(v)), nil
|
||||
}
|
||||
b, err := os.ReadFile(ref) //nolint:gosec // a path the operator configured
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package secrets
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
@@ -140,3 +141,15 @@ func TestSealersSealAndOpen(t *testing.T) {
|
||||
t.Errorf("transit open: %q %v", got, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAStoreReferenceIsReadFromTheStoreOnAControlPlaneOnly(t *testing.T) {
|
||||
SetStore(nil)
|
||||
if _, err := Read(t.Context(), "store:auth/ldap-bind"); err == nil || !strings.Contains(err.Error(), "control plane") {
|
||||
t.Errorf("without a store: %v", err)
|
||||
}
|
||||
SetStore(func(_ context.Context, name string) (string, error) { return " kept:" + name + "\n", nil })
|
||||
t.Cleanup(func() { SetStore(nil) })
|
||||
if b, err := Read(t.Context(), "store:auth/ldap-bind"); err != nil || string(b) != "kept:auth/ldap-bind" {
|
||||
t.Errorf("%q %v", b, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user