Documentation
¶
Overview ¶
Package config provides configuration management for muster.
This package implements a simple configuration system that loads configuration from a single directory. The default configuration directory is ~/.config/muster, but users can specify a custom directory using the --config-path flag in commands.
Configuration Directory ¶
Configuration is loaded from a single directory containing:
- config.yaml (main configuration file)
- subdirectories for entity definitions (workflows/, capabilities/, mcpservers/)
Default location: ~/.config/muster Custom location: Specified via --config-path flag
Entity Storage System ¶
The Storage system provides generic YAML-based persistence for entity definitions including workflows, capabilities, and mcpservers. This unified storage system allows users to create, modify, and manage entities through both API operations and direct file manipulation.
## Storage Locations
Entities are stored in YAML files in type-specific subdirectories within the configuration directory:
- Default: ~/.config/muster/{entityType}/
- Custom: {customConfigPath}/{entityType}/
Where {entityType} is one of: workflows, capabilities, mcpservers
## Supported Operations
The Storage interface provides CRUD operations:
- Save: Store entity data as YAML file
- Load: Retrieve entity data from file
- Delete: Remove entity file
- List: Get all available entity names
## File Format
All entities are stored as YAML files with .yaml extension. Filenames are automatically sanitized to ensure filesystem compatibility.
## Usage Example
// Create storage instance (uses default ~/.config/muster)
storage := config.NewStorage()
// Create storage instance with custom path
storage := config.NewStorageWithPath("/custom/config/path")
// Save a workflow
workflowYAML := []byte(`name: "my-workflow"
description: "Example workflow"
steps: []`)
err := storage.Save("workflows", "my-workflow", workflowYAML)
// Load the workflow
data, err := storage.Load("workflows", "my-workflow")
// List all workflows
names, err := storage.List("workflows")
// Delete the workflow
err = storage.Delete("workflows", "my-workflow")
Configuration Structure ¶
The configuration file uses YAML format with the following main sections:
aggregator: port: 8090 # Port for the aggregator service (default: 8090) host: "localhost" # Host to bind to (default: localhost) transport: "streamable-http" # Transport to use (default: streamable-http) enabled: true # Whether the aggregator is enabled (default: true) musterPrefix: "x" # Pre-prefix for all tools (default: "x")
Configuration API ¶
The configuration can be accessed and modified at runtime through the Configuration API. The API adapter (ConfigAdapter) is located in the app package rather than here to avoid circular import dependencies, as the adapter needs to import the api package for registration, while the api package imports this package for type definitions.
Usage Examples ¶
// Load configuration from the default location (~/.config/muster);
// without a home directory this returns an error naming --config-path
cfg, err := config.LoadConfig("")
if err != nil {
log.Fatal(err)
}
// Access aggregator configuration
fmt.Printf("Aggregator running on %s:%d\n", cfg.Aggregator.Host, cfg.Aggregator.Port)
Index ¶
- Constants
- Variables
- func DefaultConfigPath() (string, error)
- func DefaultConfigPathFlag() string
- func DurationFromEnv(name string, def time.Duration) time.Duration
- func OAuthProxyNamespaceCallbackPath(namespace string) string
- func ResolveConfigPath(configPath string) (string, error)
- func ValidateProviderApps(apps []ProviderAppConfig) error
- func ValidateSignInCheckOrigin(publicURL, issuerURL string) error
- type ActorBearerConfig
- type AdminConfig
- type AggregatorConfig
- type BrokerClientConfig
- type BrokerSecretRefConfig
- type BrokerTargetConfig
- type CredentialProviderConfig
- type DelegationConfig
- type DexConfig
- type GoogleConfig
- type LabelSelector
- type LabelSelectorRequirement
- type MCPServerType
- type MusterConfig
- type OAuthCIMDConfig
- type OAuthConfig
- type OAuthMCPClientConfig
- func (c *OAuthMCPClientConfig) GetCIMDPath() string
- func (c *OAuthMCPClientConfig) GetCIMDScopes() string
- func (c *OAuthMCPClientConfig) GetEffectiveClientID() string
- func (c *OAuthMCPClientConfig) GetRedirectURI() string
- func (c *OAuthMCPClientConfig) ShouldServeCIMD() bool
- func (c *OAuthMCPClientConfig) ValidateNamespaceCallback() error
- type OAuthServerConfig
- type OAuthStorageConfig
- type OAuthTokenExchangeClientConfig
- type ProviderAppConfig
- type SecretBindingConfig
- type Storage
- type TokenExchangeBrokerConfig
- type TrustedIssuerConfig
- type TrustedIssuerDelegationConfig
- type ValkeyConfig
- type WritesAsCallerConfig
Constants ¶
const ( // DefaultOAuthCallbackPath is the default path for OAuth server callbacks (Cursor -> Muster auth) DefaultOAuthCallbackPath = "/oauth/callback" // DefaultOAuthProxyCallbackPath is the default path for OAuth proxy callbacks (Muster -> Remote server auth) // This MUST be different from DefaultOAuthCallbackPath to avoid route conflicts DefaultOAuthProxyCallbackPath = "/oauth/proxy/callback" // DefaultOAuthProxyStartPath is the path for the OAuth proxy start endpoint. // Auth challenges point the browser here; it redirects to the upstream // authorization server, optionally recording a post-login redirect target. DefaultOAuthProxyStartPath = "/oauth/proxy/start" // DefaultOAuthCIMDPath is the default path for serving the Client ID Metadata Document (CIMD) DefaultOAuthCIMDPath = "/.well-known/oauth-client.json" // DefaultOAuthCIMDScopes contains the default OAuth scopes for the CIMD. // Operators can customize this via Helm values (muster.oauth.cimdScopes) to add // additional scopes needed by downstream MCP servers (e.g., Google API scopes). // The "groups" scope is included because group claims are required for RBAC // decisions in downstream services like mcp-kubernetes. Provider-level scope // filtering in mcp-oauth handles provider differences (e.g., Google's // filterGoogleScopes strips unsupported scopes like "groups" automatically). DefaultOAuthCIMDScopes = "openid profile email groups offline_access" // DefaultOAuthServerProvider is the default OAuth provider for server protection. DefaultOAuthServerProvider = "dex" // DefaultOAuthStorageType is the default storage type for OAuth tokens. DefaultOAuthStorageType = "memory" )
const ( // OAuthProxyNamespaceCallbackPrefix starts the OAuth proxy callback path // of a namespace other than muster's: a server outside muster's namespace // signs in through <publicURL>/oauth/ns/<namespace>/callback, never // through the plain callback. OAuthProxyNamespaceCallbackPrefix = "/oauth/ns/" // OAuthProxyNamespaceCallbackPattern is the ServeMux pattern of the // namespace callbacks. OAuthProxyNamespaceCallbackPattern = OAuthProxyNamespaceCallbackPrefix + "{namespace}/callback" )
const ( ChatGPTClientID = "app_EMoamEEZ73f0CkXaXp7hrann" ChatGPTIssuer = "https://auth.openai.com" ChatGPTScopes = "openid profile email offline_access" )
ChatGPT sign-in defaults, the Codex CLI's: its public client and OpenAI's authorization server.
const ( // MCPTransportStreamableHTTP is the streamable HTTP transport. MCPTransportStreamableHTTP = "streamable-http" // MCPTransportSSE is the Server-Sent Events transport. MCPTransportSSE = "sse" // MCPTransportStdio is the standard I/O transport. MCPTransportStdio = "stdio" )
const DefaultValkeyKeyPrefix = "muster:"
DefaultValkeyKeyPrefix is the default prefix prepended to every Valkey key used by muster's backed stores when the operator does not override it via ValkeyConfig.KeyPrefix. Centralised here so the OAuth client/state stores and the aggregator session/capability stores agree on the namespace.
const ProviderAppFlowChatGPTDeviceCode = "chatgptDeviceCode"
ProviderAppFlowChatGPTDeviceCode is the flow of a provider App a person connects their ChatGPT subscription with: OpenAI's device-code sign-in.
Variables ¶
var ErrRemovedConfigKey = errors.New("removed configuration key")
ErrRemovedConfigKey reports a configuration key muster no longer reads.
Functions ¶
func DefaultConfigPath ¶ added in v5.39.2
DefaultConfigPath returns the default configuration directory, ~/.config/muster. Without a home directory (HOME unset) it returns an error that tells the caller to pass --config-path.
func DefaultConfigPathFlag ¶ added in v5.39.2
func DefaultConfigPathFlag() string
DefaultConfigPathFlag returns the default of a --config-path flag: the default configuration directory, or "" without a home directory, so that the binary starts and only a command that needs the directory fails, with the error of ResolveConfigPath.
func DurationFromEnv ¶
DurationFromEnv reads a Go duration from the named environment variable, falling back to def when the variable is unset, unparsable or not positive.
muster's lifecycle timings -- the reconnect backoff and its cap, the orchestrator's retry and health-probe ticks, the reconciler's resync -- are production-length defaults with one environment override each, so the integration test harness can run them in seconds instead of minutes. The knobs share this reader so they agree on what a malformed value means: the default, never a zero that would spin a ticker.
func OAuthProxyNamespaceCallbackPath ¶ added in v5.47.0
OAuthProxyNamespaceCallbackPath returns the callback path of a namespace other than muster's.
func ResolveConfigPath ¶ added in v5.39.2
ResolveConfigPath returns configPath, or the default configuration directory when configPath is empty.
func ValidateProviderApps ¶ added in v5.48.0
func ValidateProviderApps(apps []ProviderAppConfig) error
ValidateProviderApps checks the provider Apps: a valid, unique name, an absolute issuer no other App files its grants under, endpoints set together, and a git user without a colon.
func ValidateSignInCheckOrigin ¶ added in v5.52.30
ValidateSignInCheckOrigin refuses an OAuth proxy public URL that is not on the origin of muster's OAuth server. The start endpoint's sign-in check returns the browser to <publicURL>/oauth/proxy/start, and the OAuth server sends an identity sign-in back only to its own origin: with the two apart, every sign-in to a server would fail.
Types ¶
type ActorBearerConfig ¶ added in v5.45.0
type ActorBearerConfig struct {
// Enabled accepts actor JWTs on /mcp, /sse and /message and lets a
// binding list the provider "muster". Default: false.
Enabled bool `yaml:"enabled,omitempty"`
// Issuer is the iss of Substrate's actor JWTs (ate-api's
// --actor-jwt-issuer, https://idp.<namespace>.svc by default). Required.
Issuer string `yaml:"issuer,omitempty"`
// JwksURL is the key set the JWTs are verified with
// (default <issuer>/openid/v1/jwks, where Substrate serves it).
JwksURL string `yaml:"jwksUrl,omitempty"`
// Audience is the aud the gateway's rule binds the actor JWT to for the
// muster host. Required: a JWT minted for another host is refused.
Audience string `yaml:"audience,omitempty"`
// CAFile is a PEM bundle the key set endpoint's certificate must chain
// to, added to the system roots (Substrate's in-cluster CA).
CAFile string `yaml:"caFile,omitempty"`
// AllowPrivateIPJWKSHosts lists the key set hosts that may resolve to a
// private address, as an in-cluster Service does.
AllowPrivateIPJWKSHosts []string `yaml:"allowPrivateIPJWKSHosts,omitempty"`
}
ActorBearerConfig accepts Substrate's actor JWT, which the egress gateway injects on the muster host, as the bearer of an MCP request. muster verifies it against Substrate's actor-JWT issuer and serves the request as the person the actor is bound to. Only a binding that lists the reserved provider "muster" is accepted; FetchSecret never releases it.
type AdminConfig ¶
type AdminConfig struct {
// Enabled controls whether the admin listener is started. Default: false.
Enabled bool `yaml:"enabled,omitempty"`
// Port is the TCP port for the admin listener (default: 9999).
Port int `yaml:"port,omitempty"`
// BindAddress is the interface to bind to (default: "127.0.0.1").
// Change this at your own risk: the admin surface has no auth.
BindAddress string `yaml:"bindAddress,omitempty"`
}
AdminConfig defines the configuration for the admin web UI.
The admin surface exposes session management (list, inspect, delete) on a dedicated HTTP listener. It does not implement authentication; rely on network-level controls (loopback binding, kubectl port-forward RBAC) to gate access.
type AggregatorConfig ¶
type AggregatorConfig struct {
Port int `yaml:"port,omitempty"` // Port for the aggregator SSE endpoint (default: 8080)
Host string `yaml:"host,omitempty"` // Host to bind to (default: localhost)
Transport string `yaml:"transport,omitempty"` // Transport to use (default: streamable-http)
MusterPrefix string `yaml:"musterPrefix,omitempty"` // Pre-prefix for all tools (default: "x")
// OAuth contains all OAuth-related configuration with explicit mcpClient/server roles.
// - oauth.mcpClient: muster as OAuth client/proxy for authenticating TO remote MCP servers
// - oauth.server: muster as OAuth resource server for protecting ITSELF
OAuth OAuthConfig `yaml:"oauth,omitempty"`
// Admin exposes a read-only web UI for listing and managing sessions on a
// separate HTTP listener. Disabled by default. When enabled, the listener
// binds to AdminBindAddress:AdminPort without authentication, so it is
// only safe when bound to a loopback address or reached via port-forward.
Admin AdminConfig `yaml:"admin,omitempty"`
// CredentialProvider serves Substrate's CredentialProvider.FetchSecret to
// the egress gateway: a workspace Session's git and gh requests get the
// access token of the person the Session is bound to. Disabled by default.
CredentialProvider CredentialProviderConfig `yaml:"credentialProvider,omitempty"`
// ProviderApps are the OAuth Apps of the provider instances a person
// grants once in muster, apart from any MCPServer: a GitHub App, a GitLab
// OAuth application, one per instance. core_auth_login app=<name> starts a
// grant, core_auth_logout app=<name> drops and revokes it. An MCPServer
// names the Apps whose grants it receives (spec.auth.providerApps), and the
// credential provider releases them to the egress gateway (each App is
// releasable under its name, with its git user).
ProviderApps []ProviderAppConfig `yaml:"providerApps,omitempty"`
}
AggregatorConfig defines the configuration for the MCP aggregator service.
type BrokerClientConfig ¶
type BrokerClientConfig struct {
// ClientCredentialsSecretRef references the Kubernetes Secret holding the
// broker client's id and secret. The same secret the broker client (e.g.
// Backstage) authenticates with. The ClientID resolved from the secret must
// match the map key; the map key wins if they differ.
ClientCredentialsSecretRef *BrokerSecretRefConfig `yaml:"clientCredentialsSecretRef,omitempty"`
// ClientSecretFile is a file holding the broker client's secret (the map
// key is the client id), for deployments without a Kubernetes Secret
// store -- muster serve against a local config directory. Takes
// precedence over ClientCredentialsSecretRef when both are set.
ClientSecretFile string `yaml:"clientSecretFile,omitempty"`
// Scopes optionally records the scopes granted to the seeded client. The
// audiences a client may request are gated by ClientAudiences, not by these
// scopes; this is informational on the client record.
Scopes []string `yaml:"scopes,omitempty"`
}
BrokerClientConfig declaratively seeds one confidential broker client. The map key is the client ID; the secret is resolved from the referenced Kubernetes Secret at startup and the client record is idempotently ensured in mcp-oauth's store.
type BrokerSecretRefConfig ¶
type BrokerSecretRefConfig struct {
// Name is the secret name. Required.
Name string `yaml:"name"`
// Namespace defaults to the broker's DefaultSecretNamespace (the muster
// namespace) when empty.
Namespace string `yaml:"namespace,omitempty"`
// ClientIDKey defaults to "client-id".
ClientIDKey string `yaml:"clientIdKey,omitempty"`
// ClientSecretKey defaults to "client-secret".
ClientSecretKey string `yaml:"clientSecretKey,omitempty"`
}
BrokerSecretRefConfig references a Kubernetes Secret with OAuth client credentials. Mirrors api.ClientCredentialsSecretRef (kept separate to avoid an import cycle between config and api).
type BrokerTargetConfig ¶
type BrokerTargetConfig struct {
// DexTokenEndpoint is the downstream Dex token endpoint URL (HTTPS).
// Example: https://dex.cluster-b.example.com/token
// Mutually exclusive with GrantIssuer.
DexTokenEndpoint string `yaml:"dexTokenEndpoint,omitempty"`
// GrantIssuer makes the target a grant target: instead of exchanging
// the subject token downstream, the broker returns the access token of
// the person's own grant from this authorization server -- the grant an
// MCPServer pinned with spec.auth.authorizationServer.grantScope:
// subject filed under the person (GitHub's user access token, say). The
// person is the Dex subject the exchange request's subject token was
// validated to; the grant is refreshed first when it is due; the
// response carries the access token and its expiry, never the refresh
// token; a person without a grant gets invalid_target. HTTPS issuer,
// identical to the MCPServer pin. Takes none of the exchange fields.
// Example: https://github.com/login/oauth
GrantIssuer string `yaml:"grantIssuer,omitempty"`
// SubjectIssuers lists the issuers whose subject tokens may release a
// grant target's grant: the verified iss of the exchange request's
// subject token must be one of them. Empty means muster's own Dex
// issuer only (dex.issuerUrl); with another provider it is required.
// Each entry must be a trustedIssuers issuer. Grant targets only.
SubjectIssuers []string `yaml:"subjectIssuers,omitempty"`
// ExpectedIssuer is the expected iss claim of the exchanged token. If
// empty, it is derived from DexTokenEndpoint (strip /token suffix).
ExpectedIssuer string `yaml:"expectedIssuer,omitempty"`
// ConnectorID is the downstream Dex OIDC connector that trusts the
// subject token's issuer.
ConnectorID string `yaml:"connectorId"`
// Scopes is the space-separated scope set requested downstream. Defaults
// to "openid profile email groups". For Kubernetes-bound audiences this
// must include the Dex cross-client scope for the apiserver's client,
// e.g. "audience:server:client_id:dex-k8s-authenticator" — without it
// the exchanged token's aud is the exchange client only, which mcp-*
// servers accept but kube-apiserver rejects.
Scopes string `yaml:"scopes,omitempty"`
// ClientCredentialsSecretRef references the Kubernetes Secret holding the
// downstream exchange client credentials (same secrets the per-MCPServer
// tokenExchange config uses; no duplication).
ClientCredentialsSecretRef *BrokerSecretRefConfig `yaml:"clientCredentialsSecretRef,omitempty"`
}
BrokerTargetConfig describes one downstream target of the token broker: either an RFC 8693 exchange at a downstream Dex (DexTokenEndpoint and the exchange fields) or the release of a person's own grant (GrantIssuer).
func (BrokerTargetConfig) IsGrantTarget ¶
func (t BrokerTargetConfig) IsGrantTarget() bool
IsGrantTarget reports whether the target releases a person's grant rather than exchanging the subject token at a downstream Dex.
type CredentialProviderConfig ¶ added in v5.44.0
type CredentialProviderConfig struct {
// Enabled starts the FetchSecret listener and the /session-bindings
// endpoints. Default: false.
Enabled bool `yaml:"enabled,omitempty"`
// ListenAddress is the gRPC listen address (default ":50051").
ListenAddress string `yaml:"listenAddress,omitempty"`
// ServerCredBundle is a PEM file holding the serving key and certificate
// chain (Substrate's servicedns.podcert.ate.dev credential bundle). It is
// re-read when it changes, so a rotated pod certificate is picked up.
ServerCredBundle string `yaml:"serverCredBundle,omitempty"`
// ClientCAFile is the CA bundle the gateway's client certificate must
// chain to (Substrate's podidentity.podcert.ate.dev trust bundle).
ClientCAFile string `yaml:"clientCAFile,omitempty"`
// GatewayIdentity is the egress gateway's SPIFFE id, the only caller
// answered: spiffe://cluster.local/ns/<ns>/sa/<release>-atenet-egress.
GatewayIdentity string `yaml:"gatewayIdentity,omitempty"`
// Authority is the credential URI authority muster answers
// (default "muster.giantswarm.io").
Authority string `yaml:"authority,omitempty"`
// BindingTTL is how long a Session binding lives without use: the
// platform's Session idle TTL. Every answered fetch and every bind
// restarts it. Default: 336h (14 days). Format: Go duration.
BindingTTL string `yaml:"bindingTTL,omitempty"`
// Releasable maps a provider instance, the first path segment of the
// credential URI, to the issuer its grant is filed under (the MCPServer's
// authorizationServer.issuer, pinned with grantScope: subject). Only these
// grants are ever answered: the workspace App, never the login App.
// Example: {github: https://github.com/apps/giantswarm-workspaces}
Releasable map[string]string `yaml:"releasable,omitempty"`
// GitUsers maps a Releasable provider instance to the user name sent
// with its token for git (default "x-access-token", GitHub's). A GitLab
// instance takes "oauth2", the only login GitLab accepts an OAuth access
// token with. Example: {gitlab: oauth2}
GitUsers map[string]string `yaml:"gitUsers,omitempty"`
// ActorBearer lets a bound Session's sandbox call muster itself as its
// person, with no credential in the sandbox. Disabled by default.
ActorBearer ActorBearerConfig `yaml:"actorBearer,omitempty"`
}
CredentialProviderConfig configures muster as a credential provider of Substrate's egress gateway and the Session bindings it answers from.
The gateway calls FetchSecret over mutual TLS on a listener of its own with a credential URI ate-secret://<Authority>/<provider>/<git|api> and the SPIFFE id of the sandbox actor it verified. muster answers the current access token of the person the actor is bound to (PUT /session-bindings on the authenticated port, called as the person), for a provider on the Releasable list only. The refresh token never leaves muster.
type DelegationConfig ¶ added in v5.58.0
type DelegationConfig struct {
// ActorTokenFile is the path of muster's own workload token (a projected
// ServiceAccount token), presented as the RFC 8693 actor_token when muster
// exchanges a delegated caller's token for a backend's token. It is read
// on every exchange, so a rotated token is picked up. Empty disables
// token exchange for delegated callers.
ActorTokenFile string `yaml:"actorTokenFile,omitempty"`
}
DelegationConfig configures how muster serves delegated callers: a token from a trusted issuer whose act claim names an acting party.
type DexConfig ¶
type DexConfig struct {
// IssuerURL is the Dex OIDC issuer URL.
IssuerURL string `yaml:"issuerUrl,omitempty"`
// ClientID is the Dex OAuth client ID.
ClientID string `yaml:"clientId,omitempty"`
// ClientSecret is the Dex OAuth client secret.
// For production, use ClientSecretFile instead to avoid secrets in config files.
ClientSecret string `yaml:"clientSecret,omitempty"`
// ClientSecretFile is the path to a file containing the Dex OAuth client secret.
// This is the recommended way to provide secrets in production deployments.
// The file should contain only the secret value (no newlines at the end).
ClientSecretFile string `yaml:"clientSecretFile,omitempty"`
// ConnectorID is the optional Dex connector ID to bypass connector selection.
ConnectorID string `yaml:"connectorId,omitempty"`
// IdentityCheckConnectors lists Dex connectors besides ConnectorID that
// the OAuth proxy's sign-in check may send a browser to: a session whose
// subject was issued through a listed connector signs in there, every
// other session through ConnectorID. The check is as strong as the weakest
// connector listed, so list only connectors that authenticate a person,
// never a mock or a shared account. muster's Dex client must be allowed to
// use each of them.
IdentityCheckConnectors []string `yaml:"identityCheckConnectors,omitempty"`
// AllowPrivateIPOIDC allows the Dex issuer URL to resolve to a private or
// loopback IP address during OIDC discovery. Required when Dex is fronted by
// an internal-only load balancer (e.g. Azure internal LB, air-gapped clusters)
// where the public hostname resolves to an RFC 1918 address.
// Emits a CWE-918 startup warning when set.
AllowPrivateIPOIDC bool `yaml:"allowPrivateIPOIDC,omitempty"`
}
DexConfig holds configuration for the Dex OIDC provider.
type GoogleConfig ¶
type GoogleConfig struct {
// ClientID is the Google OAuth client ID.
ClientID string `yaml:"clientId,omitempty"`
// ClientSecret is the Google OAuth client secret.
// For production, use ClientSecretFile instead to avoid secrets in config files.
ClientSecret string `yaml:"clientSecret,omitempty"`
// ClientSecretFile is the path to a file containing the Google OAuth client secret.
// This is the recommended way to provide secrets in production deployments.
ClientSecretFile string `yaml:"clientSecretFile,omitempty"`
}
GoogleConfig holds configuration for the Google OAuth provider.
type LabelSelector ¶ added in v5.58.0
type LabelSelector struct {
MatchLabels map[string]string `yaml:"matchLabels,omitempty"`
MatchExpressions []LabelSelectorRequirement `yaml:"matchExpressions,omitempty"`
}
LabelSelector is a Kubernetes label selector (metav1.LabelSelector) in muster's YAML configuration, which yaml.v3 reads by these tags rather than by the json tags of the Kubernetes type.
type LabelSelectorRequirement ¶ added in v5.58.0
type LabelSelectorRequirement struct {
Key string `yaml:"key"`
Operator string `yaml:"operator"`
Values []string `yaml:"values,omitempty"`
}
LabelSelectorRequirement is one entry of LabelSelector.MatchExpressions.
type MCPServerType ¶
type MCPServerType string
MCPServerType defines the type of MCP server.
const ( MCPServerTypeStdio MCPServerType = "stdio" MCPServerTypeStreamableHTTP MCPServerType = "streamable-http" MCPServerTypeSSE MCPServerType = "sse" )
type MusterConfig ¶
type MusterConfig struct {
Aggregator AggregatorConfig `yaml:"aggregator"`
Namespace string `yaml:"namespace,omitempty"` // Namespace for MCPServer and Workflow discovery
Kubernetes bool `yaml:"kubernetes,omitempty"` // Enable Kubernetes CRD mode (uses CRDs instead of filesystem)
WritesAsCaller WritesAsCallerConfig `yaml:"writesAsCaller,omitempty"` // Caller-identity writes: kubernetesAudience override
// MCPServerNamespaceSelector selects, in Kubernetes mode, the namespaces
// besides Namespace whose MCPServer objects muster serves: unset, none;
// empty ({}), every namespace; otherwise the namespaces whose labels
// match. Workflow objects, events and the broker's default Secret
// namespace stay in Namespace. A server outside Namespace is keyed and
// exposed with its namespace and gets no identity from muster.
MCPServerNamespaceSelector *LabelSelector `yaml:"mcpServerNamespaceSelector,omitempty"`
// MCPServerSelector selects, by their labels, the MCPServer objects
// muster serves in Namespace and in the selected namespaces: unset, every
// one.
MCPServerSelector *LabelSelector `yaml:"mcpServerSelector,omitempty"`
// ToolsetPresets are the installation's toolset presets (chart value
// muster.toolsetPresets): named selections of the catalogue an agent's
// X-Muster-Toolset header can reference as preset:<name>. read-only, none
// and full are built in and cannot be redefined here; startup fails on a
// preset that tries, on a malformed rule, or on a composition that names
// an unknown preset.
ToolsetPresets toolset.PresetsConfig `yaml:"toolsetPresets,omitempty"`
// SecretBinding names the Secrets muster never reads for an MCPServer
// (spec.headersFrom and the clientCredentialsSecretRef of its auth).
SecretBinding SecretBindingConfig `yaml:"secretBinding,omitempty"`
}
MusterConfig is the top-level configuration structure for muster.
func GetDefaultConfigWithRoles ¶
func GetDefaultConfigWithRoles() MusterConfig
GetDefaultConfigWithRoles returns default configuration
func LoadConfig ¶
func LoadConfig(configPath string) (MusterConfig, error)
LoadConfig loads configuration from a single specified directory. The directory should contain config.yaml and subdirectories for other configuration types. An empty configPath means the default configuration directory.
type OAuthCIMDConfig ¶
type OAuthCIMDConfig struct {
// Path is the path for serving the Client ID Metadata Document (default: "/.well-known/oauth-client.json").
// Muster will serve the CIMD at this path when OAuth MCP client is enabled and PublicURL is set.
Path string `yaml:"path,omitempty"`
// Scopes is the OAuth scopes to advertise in the self-hosted CIMD.
// This determines what API scopes downstream MCP servers can use when muster
// forwards tokens via SSO. Default: "openid profile email offline_access".
// Operators can add additional scopes (e.g., Google API scopes) as needed.
// Format: space-separated list of scope strings.
Scopes string `yaml:"scopes,omitempty"`
}
OAuthCIMDConfig contains Client ID Metadata Document configuration.
type OAuthConfig ¶
type OAuthConfig struct {
// MCPClient configuration for remote MCP server authentication (muster as OAuth proxy).
// When enabled, muster acts as an OAuth client proxy, handling authentication
// flows on behalf of users without exposing tokens to the Muster Agent.
MCPClient OAuthMCPClientConfig `yaml:"mcpClient,omitempty"`
// Server configuration for protecting the Muster Server itself.
// When enabled, muster acts as an OAuth Resource Server, requiring valid
// access tokens from clients (e.g., Muster Agent) to access protected endpoints.
Server OAuthServerConfig `yaml:"server,omitempty"`
}
OAuthConfig consolidates all OAuth-related configuration with explicit mcpClient/server roles. This structure clearly separates the two distinct OAuth roles that muster can play:
- MCPClient: when muster authenticates TO remote MCP servers on behalf of users
- Server: when muster protects ITSELF and requires clients to authenticate
type OAuthMCPClientConfig ¶
type OAuthMCPClientConfig struct {
// Enabled controls whether OAuth MCP client/proxy functionality is active.
// When false, remote MCP servers requiring auth will return errors.
Enabled bool `yaml:"enabled,omitempty"`
// PublicURL is the publicly accessible URL of the Muster Server.
// This is used to construct OAuth callback URLs (e.g., https://muster.example.com).
// Required when OAuth MCP client is enabled.
PublicURL string `yaml:"publicUrl,omitempty"`
// ClientID is the OAuth client identifier.
// This should be the URL of the Client ID Metadata Document (CIMD).
// If not set and PublicURL is set, the ClientID will be auto-derived as
// {PublicURL}/.well-known/oauth-client.json and muster will serve the CIMD itself.
ClientID string `yaml:"clientId,omitempty"`
// CallbackPath is the path for the OAuth proxy callback endpoint (default: "/oauth/proxy/callback").
// This is used when muster authenticates with remote MCP servers.
// NOTE: This MUST be different from the OAuth server callback (/oauth/callback) to avoid conflicts.
CallbackPath string `yaml:"callbackPath,omitempty"`
// CIMD contains Client ID Metadata Document configuration.
// Muster can serve its own CIMD when acting as an OAuth client for MCP servers.
CIMD OAuthCIMDConfig `yaml:"cimd,omitempty"`
// PostLoginRedirectAllowlist enables the optional "redirect" query
// parameter on the OAuth proxy start endpoint. Each entry is an absolute
// http(s) URL prefix; a caller-supplied redirect target is accepted only
// when its scheme and host match an entry exactly and its path extends
// the entry's path at a segment boundary; targets containing dot
// segments are rejected (the target's query is unconstrained). Host
// matching is port-exact: an entry without a port matches only targets
// without a port. After a successful callback the browser is redirected
// to the accepted target with the connected server's name appended as a
// "server" query parameter (overwriting any "server" the caller set),
// instead of the static success page. This lets a front-end
// (e.g. a chat gateway) observe login completion for the flows it
// initiated without affecting other clients of the same muster. Empty
// (default) rejects all redirect requests; invalid entries are ignored
// with a warning. Failed callbacks always render the error page.
PostLoginRedirectAllowlist []string `yaml:"postLoginRedirectAllowlist,omitempty"`
// TokenExchange configures the RFC 8693 token-exchange client muster uses
// for MCPServers with spec.auth.tokenExchange (a remote cluster's Dex).
TokenExchange OAuthTokenExchangeClientConfig `yaml:"tokenExchange,omitempty"`
// ExtraCAFile mirrors the process-level --extra-ca-file flag for the
// OAuth/token-exchange layer's internal-deployment heuristic. When set,
// the token-exchange HTTP client allows resolution to private IP ranges
// (e.g. in-cluster Dex via .svc.cluster.local).
// Not part of any user-facing config; populated by the serve command.
ExtraCAFile string `yaml:"-"`
// ServesOtherNamespaces is set when muster serves MCPServer objects of
// other namespaces (mcpServerNamespaceSelector in Kubernetes mode): their
// servers sign in through the namespace callbacks. Populated at wiring
// time, never from YAML.
ServesOtherNamespaces bool `yaml:"-"`
}
OAuthMCPClientConfig defines the OAuth client/proxy configuration for remote MCP server authentication. When enabled, the Muster Server acts as an OAuth client proxy, handling authentication flows on behalf of users without exposing tokens to the Muster Agent.
func (*OAuthMCPClientConfig) GetCIMDPath ¶
func (c *OAuthMCPClientConfig) GetCIMDPath() string
GetCIMDPath returns the path for serving the CIMD.
func (*OAuthMCPClientConfig) GetCIMDScopes ¶
func (c *OAuthMCPClientConfig) GetCIMDScopes() string
GetCIMDScopes returns the OAuth scopes to advertise in the CIMD. If not set, returns the default scopes: "openid profile email offline_access".
func (*OAuthMCPClientConfig) GetEffectiveClientID ¶
func (c *OAuthMCPClientConfig) GetEffectiveClientID() string
GetEffectiveClientID returns the effective OAuth client ID. If ClientID is explicitly set, it is returned as-is. If ClientID is empty but PublicURL is set, returns the self-hosted CIMD URL. Otherwise, returns empty string (OAuth proxy requires publicUrl to function).
func (*OAuthMCPClientConfig) GetRedirectURI ¶
func (c *OAuthMCPClientConfig) GetRedirectURI() string
GetRedirectURI returns the full redirect URI for OAuth proxy callbacks. This is where remote MCP server IdPs will redirect after authentication.
func (*OAuthMCPClientConfig) ShouldServeCIMD ¶
func (c *OAuthMCPClientConfig) ShouldServeCIMD() bool
ShouldServeCIMD returns true if muster should serve its own CIMD. This is the case when OAuth MCP client is enabled, PublicURL is set, and ClientID is either empty or matches the auto-derived CIMD URL.
func (*OAuthMCPClientConfig) ValidateNamespaceCallback ¶ added in v5.47.0
func (c *OAuthMCPClientConfig) ValidateNamespaceCallback() error
ValidateNamespaceCallback refuses a callback path that is a prefix of the namespace callbacks, or that starts with their prefix. An authorization server that matches a redirect URI by prefix would otherwise accept a namespace's redirect URI for a client of muster's namespace, or the reverse. It applies only when muster serves other namespaces (ServesOtherNamespaces): otherwise no flow uses a namespace callback.
type OAuthServerConfig ¶
type OAuthServerConfig struct {
// Enabled controls whether OAuth server protection is active.
// When true, all MCP endpoints require valid OAuth tokens.
Enabled bool `yaml:"enabled,omitempty"`
// BaseURL is the publicly accessible base URL of the Muster Server.
// This is used as the OAuth issuer URL (e.g., https://muster.example.com).
// Required when OAuth server is enabled.
BaseURL string `yaml:"baseUrl,omitempty"`
// Provider specifies the OAuth provider to use: "dex" or "google".
// Default: "dex"
Provider string `yaml:"provider,omitempty"`
// Dex configuration (used when Provider is "dex")
Dex DexConfig `yaml:"dex,omitempty"`
// Google configuration (used when Provider is "google")
Google GoogleConfig `yaml:"google,omitempty"`
// Storage configuration for OAuth tokens and client registrations.
Storage OAuthStorageConfig `yaml:"storage,omitempty"`
// RegistrationToken is the token required for dynamic client registration.
// Required if AllowPublicClientRegistration is false.
// For production, use RegistrationTokenFile instead to avoid secrets in config files.
RegistrationToken string `yaml:"registrationToken,omitempty"`
// RegistrationTokenFile is the path to a file containing the registration token.
// This is the recommended way to provide secrets in production deployments.
RegistrationTokenFile string `yaml:"registrationTokenFile,omitempty"`
// AllowPublicClientRegistration allows unauthenticated dynamic client registration.
// WARNING: This can lead to DoS attacks. Default: false.
AllowPublicClientRegistration bool `yaml:"allowPublicClientRegistration,omitempty"`
// EncryptionKey is the AES-256 key for encrypting tokens at rest (32 bytes, base64-encoded).
// Required for production deployments.
// For production, use EncryptionKeyFile instead to avoid secrets in config files.
EncryptionKey string `yaml:"encryptionKey,omitempty"`
// EncryptionKeyFile is the path to a file containing the encryption key.
// This is the recommended way to provide secrets in production deployments.
EncryptionKeyFile string `yaml:"encryptionKeyFile,omitempty"`
// TrustedPublicRegistrationSchemes lists URI schemes allowed for unauthenticated
// client registration. Enables Cursor/VSCode without registration tokens.
// Example: ["cursor", "vscode"]
TrustedPublicRegistrationSchemes []string `yaml:"trustedPublicRegistrationSchemes,omitempty"`
// TrustedPublicRegistrationRedirectURIs lists fully-qualified HTTPS redirect URIs
// allowed to register without a RegistrationAccessToken. Matching is exact after
// RFC 3986 normalization. Enables SaaS MCP clients that cannot send a DCR token.
// Example: ["https://claude.ai/api/mcp/auth_callback"]
TrustedPublicRegistrationRedirectURIs []string `yaml:"trustedPublicRegistrationRedirectURIs,omitempty"`
// EnableCIMD enables Client ID Metadata Documents per MCP 2025-11-25 spec.
// Default: true
EnableCIMD bool `yaml:"enableCIMD,omitempty"`
// AllowLocalhostRedirectURIs allows http://localhost and http://127.0.0.1 redirect URIs.
// Required for native apps (like muster agent) per RFC 8252 Section 7.3.
// Default: true (native app support enabled by default)
AllowLocalhostRedirectURIs bool `yaml:"allowLocalhostRedirectURIs,omitempty"`
// AllowPrivateIPClientMetadata lets a CIMD client_id URL (the Client ID
// Metadata Document a client self-hosts) resolve to a private, loopback or
// link-local address. Needed where the platform's own hostnames resolve to
// an internal load balancer (a management cluster reachable only over VPN):
// without it the SSRF guard rejects such a client with
// "client_id metadata URL resolves to private/internal IP address".
// Reduces SSRF protection for CIMD fetches; mcp-oauth logs a startup
// warning when set. PKCE and redirect-URI checks are unchanged.
// Default: false
// Prefer AllowPrivateIPClientMetadataHosts when only known hosts are private.
AllowPrivateIPClientMetadata bool `yaml:"allowPrivateIPClientMetadata,omitempty"`
// AllowPrivateIPClientMetadataHosts is the host-scoped alternative to
// AllowPrivateIPClientMetadata: a CIMD client_id URL may resolve to a
// private, loopback or link-local address only when its hostname is listed
// (exact match, no port, no wildcard); every other host keeps the SSRF
// guard, at validation and at connection time. mcp-oauth logs a startup
// warning when set. Default: empty
AllowPrivateIPClientMetadataHosts []string `yaml:"allowPrivateIPClientMetadataHosts,omitempty"`
// AllowPrivateIPRedirectURIs lets a client's redirect URI resolve to a
// private address (a literal RFC 1918 host or a hostname that resolves to
// one). Needed where the platform's own hostnames resolve to an internal
// load balancer: the authorization-time check otherwise rejects the
// client's callback with "redirect_uri: hostname resolves to private IP
// address (DNS rebinding protection)" even though the client itself was
// accepted. Reduces open-redirect/SSRF protection for redirect targets;
// mcp-oauth logs a startup warning when set. Default: false
AllowPrivateIPRedirectURIs bool `yaml:"allowPrivateIPRedirectURIs,omitempty"`
// SessionDuration is the maximum session duration before re-authentication
// is required. This sets the server-side refresh token TTL.
// Default: 720h (30 days), aligned with Dex's absoluteLifetime.
// Format: Go duration string (e.g., "720h", "30d" is NOT valid, use hours).
SessionDuration string `yaml:"sessionDuration,omitempty"`
// ProviderTokenRefreshThreshold is how much lifetime the provider (Dex)
// token muster holds for a user must have left before muster hands it out
// as is; a token closer to its expiry is refreshed at the provider first.
// It governs the token muster forwards to downstream servers and the one
// a client's refresh returns. Raise it when a caller needs a forwarded
// token that outlives a long operation (an agent turn of 20 minutes); keep
// it below the provider's token lifetime, or every validation refreshes at
// the provider.
// Default: empty, the mcp-oauth default of 5m.
// Format: Go duration string of at least one second (e.g., "25m").
ProviderTokenRefreshThreshold string `yaml:"providerTokenRefreshThreshold,omitempty"`
// AllowedOrigins is a comma-separated list of allowed CORS origins for
// browser-based MCP clients. Empty disables CORS (default, secure).
AllowedOrigins string `yaml:"allowedOrigins,omitempty"`
// TrustedAudiences lists additional OAuth client IDs (audiences) whose
// JWT ID tokens are accepted directly as bearer tokens, without requiring
// the client to complete muster's own OAuth flow first. This enables
// authenticating muster with tokens generated directly against Dex (e.g.
// by dex-k8s-authenticator or another Dex client), as long as the token's
// `aud` claim matches one of these values and its signature validates
// against the provider's JWKS.
//
// SECURITY: only list client IDs you fully trust. Any JWT signed by the
// configured OIDC provider and carrying one of these audiences is treated
// as a valid muster bearer token.
TrustedAudiences []string `yaml:"trustedAudiences,omitempty"`
// TrustedIssuers registers external OIDC issuers for RFC 8693 token exchange.
// Tokens are accepted as subject_tokens of type id_token, access_token, or jwt.
TrustedIssuers []TrustedIssuerConfig `yaml:"trustedIssuers,omitempty"`
// TrustedProxyCIDRs lists CIDRs from which X-Forwarded-Proto and
// X-Forwarded-Host headers are trusted for DPoP htu URL reconstruction.
// Required when muster runs behind a reverse proxy that terminates TLS.
TrustedProxyCIDRs []string `yaml:"trustedProxyCIDRs,omitempty"`
// ResourceIdentifier is the canonical URI that identifies this muster instance
// as an RFC 8707 resource server. When set, access tokens carry this value in
// their aud claim and tokens bound to a different resource are rejected, preventing
// replay across resource servers sharing the same IdP.
// If empty the library defaults to BaseURL (the issuer URL).
// Example: "https://muster.example.com/mcp"
ResourceIdentifier string `yaml:"resourceIdentifier,omitempty"`
// TokenExchangeBroker exposes muster's RFC 8693 token exchange to external
// confidential clients: a broker client POSTs a token-exchange request with
// an `audience` parameter to /oauth/token and receives a token issued by
// the audience's downstream Dex (not a muster-signed JWT). Subject tokens
// are validated against TrustedIssuers; the per-client allowlist below
// gates which audiences each client may request.
TokenExchangeBroker TokenExchangeBrokerConfig `yaml:"tokenExchangeBroker,omitempty"`
// Delegation configures delegated callers, see DelegationConfig.
Delegation DelegationConfig `yaml:"delegation,omitempty"`
// ExtraCAFile mirrors the process-level --extra-ca-file flag. mcp-oauth's
// permissive JWKS / token-exchange clients (used for private-IP trusted
// issuers and forwarded-ID-token validation) no longer read a CA installed
// on http.DefaultTransport, so the OAuth server must be handed the CA pool
// explicitly. Populated at wiring time, never from YAML.
ExtraCAFile string `yaml:"-"`
}
OAuthServerConfig defines the OAuth server configuration for protecting the Muster Server. When enabled, the Muster Server acts as an OAuth Resource Server, requiring valid access tokens from clients (e.g., Muster Agent) to access protected endpoints. This implements ADR 005 (OAuth Protection for Muster Server).
type OAuthStorageConfig ¶
type OAuthStorageConfig struct {
// Type is the storage backend type: "memory" or "valkey" (default: "memory").
Type string `yaml:"type,omitempty"`
// Valkey configuration (used when Type is "valkey").
Valkey ValkeyConfig `yaml:"valkey,omitempty"`
}
OAuthStorageConfig holds configuration for OAuth token storage backend.
type OAuthTokenExchangeClientConfig ¶
type OAuthTokenExchangeClientConfig struct {
// AllowPrivateIP allows a remote Dex token endpoint (dexTokenEndpoint) to
// resolve to a private or loopback address: a Dex behind an internal-only
// load balancer whose public hostname resolves to an RFC 1918 address, as
// on a private management or workload cluster. Implied by --extra-ca-file
// (in-cluster TLS endpoints). WARNING: reduces the SSRF protection of the
// token-exchange client; emits a startup warning when set.
AllowPrivateIP bool `yaml:"allowPrivateIP,omitempty"`
}
OAuthTokenExchangeClientConfig configures the outbound RFC 8693 token-exchange client (MCPServer spec.auth.tokenExchange).
type ProviderAppConfig ¶ added in v5.48.0
type ProviderAppConfig struct {
// Name is the provider instance, the name core_auth_login, an MCPServer's
// spec.auth.providerApps and the credential URI use: lower-case letters,
// digits and dashes. Required.
Name string `yaml:"name"`
// Issuer is the authorization server's issuer URL, the key the grants are
// filed under. Without endpoints muster discovers the server from it.
// Required.
Issuer string `yaml:"issuer"`
// AuthorizationEndpoint and TokenEndpoint pin the endpoints of an
// authorization server that publishes no discovery document (GitHub).
// Set together or not at all.
AuthorizationEndpoint string `yaml:"authorizationEndpoint,omitempty"`
TokenEndpoint string `yaml:"tokenEndpoint,omitempty"`
// ExpectedIssuer is the RFC 9207 iss the callback must carry when it
// differs from Issuer. Needs the endpoints.
ExpectedIssuer string `yaml:"expectedIssuer,omitempty"`
// RevocationEndpoint is the RFC 7009 endpoint a disconnect revokes the
// grant at. Default: the discovered metadata's.
RevocationEndpoint string `yaml:"revocationEndpoint,omitempty"`
// ClientCredentialsSecretRef is the Secret holding the App's client,
// registered out of band. Its namespace defaults to muster's.
ClientCredentialsSecretRef *BrokerSecretRefConfig `yaml:"clientCredentialsSecretRef,omitempty"`
// ClientID is a public client (one without a secret) the App signs in
// and refreshes as, instead of ClientCredentialsSecretRef. Default for
// flow chatgptDeviceCode: the Codex CLI's client.
ClientID string `yaml:"clientID,omitempty"`
// Flow is how a person signs in: empty for the browser authorization
// code flow, ProviderAppFlowChatGPTDeviceCode for OpenAI's device-code
// sign-in to ChatGPT, whose code the person enters at OpenAI.
Flow string `yaml:"flow,omitempty"`
// Scopes is the space-separated scope requested at sign-in.
Scopes string `yaml:"scopes,omitempty"`
// GitUser is the user name sent with the App's token for git (default
// "x-access-token", GitHub's; "oauth2" for GitLab).
GitUser string `yaml:"gitUser,omitempty"`
}
ProviderAppConfig is one provider instance's OAuth App. Its grants belong to the person (grantScope subject) and are filed under Issuer, as the grants of an MCPServer pinned to the same issuer: an App that takes over such a pin finds the grants people already hold.
func ProviderAppsWithDefaults ¶ added in v5.51.0
func ProviderAppsWithDefaults(apps []ProviderAppConfig) []ProviderAppConfig
ProviderAppsWithDefaults returns the Apps with what a device-code App leaves out filled in (providerAppWithDefaults).
type SecretBindingConfig ¶ added in v5.53.1
type SecretBindingConfig struct {
// ProtectedSecrets are Secrets of muster's namespace no MCPServer may
// read: muster's own (the chart lists those it mounts). Secrets muster's
// configuration names (provider Apps, broker targets and clients) are not
// protected: an MCPServer may share one.
ProtectedSecrets []string `yaml:"protectedSecrets,omitempty"`
// AdmissionPolicyBinding names the ValidatingAdmissionPolicyBinding of
// the chart's policy on Secret references. In Kubernetes mode muster
// reads no Secret for an MCPServer unless that binding denies for every
// MCPServer and its policy exists and fails closed; when empty, it reads
// none.
AdmissionPolicyBinding string `yaml:"admissionPolicyBinding,omitempty"`
}
SecretBindingConfig names the Secrets an MCPServer may never have muster read and send. Which Secrets an MCPServer's writer may name at all is the chart's admission policy: those the writer may get. A change takes effect at muster's restart.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides generic storage functionality for dynamic entities using a single configuration directory approach
func NewStorageWithPath ¶
NewStorageWithPath creates a new Storage instance with a custom config path
type TokenExchangeBrokerConfig ¶
type TokenExchangeBrokerConfig struct {
// ClientAudiences maps an authenticated confidential broker client ID to
// the audiences it may request. Requests for audiences outside the
// client's list are rejected with invalid_target. Maps to mcp-oauth's
// Config.TokenExchangeClientAudiences.
ClientAudiences map[string][]string `yaml:"clientAudiences,omitempty"`
// BrokerClients declaratively seeds confidential broker clients at startup
// from mounted Kubernetes Secrets, keyed by client ID. mcp-oauth stores a
// broker client's record (id -> bcrypt secret hash) only in its backing
// store (Valkey); a store wipe leaves the audience allowlist in config and
// the credentials in the holder's secret, but the client record gone, so
// every exchange returns invalid_client. Seeding re-creates the record from
// the same id+secret on every startup, so a wipe self-heals. The id+secret
// must match those the broker client (e.g. Backstage) presents.
BrokerClients map[string]BrokerClientConfig `yaml:"brokerClients,omitempty"`
// Targets maps an RFC 8693 audience name (e.g. a management cluster name)
// to the downstream credential provider target.
Targets map[string]BrokerTargetConfig `yaml:"targets,omitempty"`
// AllowPrivateIP allows downstream token endpoints to resolve to private
// or loopback IP addresses. WARNING: reduces SSRF protection; only enable
// for internal/VPN deployments where the target Dex is reachable via a
// private address.
AllowPrivateIP bool `yaml:"allowPrivateIP,omitempty"`
// DefaultSecretNamespace is the namespace used for target credential
// secret refs that do not set an explicit namespace. Populated from the
// muster namespace by the serve command; not user-facing config.
DefaultSecretNamespace string `yaml:"-"`
}
TokenExchangeBrokerConfig configures brokered RFC 8693 token exchange (muster as a shared token broker for external clients).
func (TokenExchangeBrokerConfig) Enabled ¶
func (c TokenExchangeBrokerConfig) Enabled() bool
Enabled reports whether brokered token exchange is configured.
type TrustedIssuerConfig ¶
type TrustedIssuerConfig struct {
// Issuer is the expected iss claim value.
Issuer string `yaml:"issuer,omitempty"`
// JwksURL is the JWKS endpoint. Independent of Issuer.
JwksURL string `yaml:"jwksUrl,omitempty"`
// AllowedAudiences lists accepted aud values. Empty accepts any audience.
AllowedAudiences []string `yaml:"allowedAudiences,omitempty"`
// AllowedScopes caps scopes for tokens from this issuer. Nil means no restriction.
AllowedScopes []string `yaml:"allowedScopes,omitempty"`
// SubjectClaim names the verified claim whose value becomes the canonical
// subject (the sub of any token minted from this identity). Empty keeps the
// standard sub claim. Set it to "email" for Dex, whose sub is opaque, when the
// downstream trusts the email. Fail-closed: a token whose claim is absent or
// non-string is rejected.
SubjectClaim string `yaml:"subjectClaim,omitempty"`
// AllowPrivateIPJWKS allows the JwksURL to resolve to a private or loopback
// address, for a Dex on a private network. Emits a startup warning when set
// (mcp-oauth dev-override flag). Default: false.
AllowPrivateIPJWKS bool `yaml:"allowPrivateIPJWKS,omitempty"`
// AllowPrivateIPJWKSHosts is the host-scoped alternative to AllowPrivateIPJWKS:
// the JwksURL may resolve to a private IP only when its hostname matches one of
// these values; all other hosts keep the SSRF guard. Prefer this over the
// blanket bool for a known in-cluster endpoint (e.g. a Dex fronted by an
// internal LB whose public hostname resolves to a private VIP).
AllowPrivateIPJWKSHosts []string `yaml:"allowPrivateIPJWKSHosts,omitempty"`
// AcceptedTypHeaders lists the JWT typ header values accepted for Bearer
// tokens from this issuer. Empty keeps the RFC 9068 default ("at+jwt").
// Dex sets no typ header on ID tokens; use [""] to accept them.
AcceptedTypHeaders []string `yaml:"acceptedTypHeaders,omitempty"`
// Delegation makes this issuer's tokens that name an acting party in the
// act claim (RFC 8693 §4.1) delegated tokens: served as the person, never
// forwarded. Without it, act is unchecked and such a token keeps the
// on-behalf-of path.
Delegation *TrustedIssuerDelegationConfig `yaml:"delegation,omitempty"`
}
TrustedIssuerConfig mirrors server.TrustedIssuer.
type TrustedIssuerDelegationConfig ¶ added in v5.58.0
type TrustedIssuerDelegationConfig struct {
// ActorIssuers are the accepted act.iss values of the current actor.
ActorIssuers []string `yaml:"actorIssuers,omitempty"`
// ActorSubjects maps an issuer of ActorIssuers to a glob pattern ('*'
// spans '/') the current actor's sub must match. An issuer without an
// entry accepts any sub, so an issuer that also signs other workloads'
// tokens, such as a cluster's ServiceAccount issuer, needs one.
ActorSubjects map[string]string `yaml:"actorSubjects,omitempty"`
}
TrustedIssuerDelegationConfig lists the issuers a trusted issuer may name as the current actor (the outermost act) of a delegated token.
type ValkeyConfig ¶
type ValkeyConfig struct {
// URL is the Valkey server address (e.g., "valkey.namespace.svc:6379").
URL string `yaml:"url,omitempty"`
// Password is the optional password for Valkey authentication.
// For production, use PasswordFile instead to avoid secrets in config files.
Password string `yaml:"password,omitempty"`
// PasswordFile is the path to a file containing the Valkey password.
// This is the recommended way to provide secrets in production deployments.
PasswordFile string `yaml:"passwordFile,omitempty"`
// TLSEnabled enables TLS for Valkey connections.
TLSEnabled bool `yaml:"tlsEnabled,omitempty"`
// TLSServerName overrides the server name used for TLS certificate verification.
// Use this when the Valkey server certificate CN/SAN differs from the connection address.
TLSServerName string `yaml:"tlsServerName,omitempty"`
// KeyPrefix is the prefix for all Valkey keys (default: "muster:").
KeyPrefix string `yaml:"keyPrefix,omitempty"`
// DB is the Valkey database number (default: 0).
DB int `yaml:"db,omitempty"`
}
ValkeyConfig holds configuration for Valkey storage backend.
type WritesAsCallerConfig ¶
type WritesAsCallerConfig struct {
// KubernetesAudience is the audience the session's dex id_token must carry
// to be accepted by the local kube-apiserver (requested via the login scope
// set's cross-client audience mechanism). Defaults to
// "dex-k8s-authenticator". A session token without this audience gets an
// actionable re-login error instead of a generic apiserver 401.
KubernetesAudience string `yaml:"kubernetesAudience,omitempty"`
}
WritesAsCallerConfig configures caller-identity writes. In Kubernetes mode, session-initiated MCPServer spec mutations (create/update/delete and CR-driven lifecycle) are always written against the Kubernetes API with the caller's own dex id_token as the bearer, so the apiserver authenticates the real user, k8s RBAC authorizes the write, and the audit log records the true subject. Muster's own controllers (status reconciliation, service registration, startup sync) keep using the ServiceAccount client. In filesystem mode there is no apiserver and mutations write through the local client.