Documentation
¶
Overview ¶
Package openbaoapply executes the fail-closed OpenBao Kubernetes-auth plan. Credentials are accepted only through the bounded stdin request and are retained in memory. Reports contain fixed policy facts only.
Index ¶
- Constants
- func BindingSHA256(request Request) (string, error)
- type Approval
- type Connection
- type KubernetesClient
- type Lease
- type LeaseTarget
- type NegativeIdentities
- type OpenBaoClient
- type ReadResult
- type Report
- type Request
- type ResourceAccess
- type SecretEntry
- type Seed
- type ServiceAccountFacts
- type ServiceAccountToken
- type Status
- type SubjectFacts
- type SupervisorOpenBaoClient
- type SupervisorRequest
- type TokenFacts
- type WorkloadIdentity
- type WrappedToken
Constants ¶
const SupervisorSchemaVersion = "cloudring.openbao-kubernetes-auth-supervise/v1"
Variables ¶
This section is empty.
Functions ¶
func BindingSHA256 ¶
BindingSHA256 binds non-secret target identity and seed content without ever emitting that fingerprint in Report. Callers use it only inside the request.
Types ¶
type Approval ¶
type Approval struct {
ChangeAuthorized bool `json:"changeAuthorized"`
BindingSHA256 string `json:"bindingSHA256"`
}
Approval is an execution-consistency assertion made by an already-authorized protected supervisor. It is not a standalone authorization receipt.
type Connection ¶
type Connection struct {
Address string `json:"address"`
ServerName string `json:"serverName"`
CACertificateBase64 string `json:"caCertificateBase64"`
BearerTokenBase64 string `json:"bearerTokenBase64,omitempty"`
}
Connection pins one HTTPS API authority and its trust material.
type KubernetesClient ¶
type KubernetesClient interface {
GetLease(context.Context, LeaseTarget) (Lease, error)
UpdateLease(context.Context, LeaseTarget, Lease) (Lease, error)
ReviewSelf(context.Context) (SubjectFacts, error)
ReviewAccess(context.Context, ResourceAccess) (bool, error)
GetServiceAccount(context.Context, string, string) (ServiceAccountFacts, error)
RequestServiceAccountToken(context.Context, string, string, string, int64) (ServiceAccountToken, error)
}
KubernetesClient is intentionally narrower than client-go.
func NewKubernetesClient ¶
func NewKubernetesClient(connection Connection) (KubernetesClient, error)
type Lease ¶
type Lease struct {
Name string
Namespace string
UID string
ResourceVersion string
HolderIdentity string
LeaseDurationSec int32
AcquireTime time.Time
RenewTime time.Time
Raw json.RawMessage
}
Lease is the narrow representation required for resourceVersion-guarded coordination. Unknown API fields are preserved by the concrete REST client.
type LeaseTarget ¶
type LeaseTarget struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
HolderIdentity string `json:"holderIdentity"`
}
LeaseTarget identifies a pre-created coordination.k8s.io/v1 Lease. The executor never creates, deletes, patches, or automatically takes over it.
type NegativeIdentities ¶
type NegativeIdentities struct {
WrongServiceAccount WorkloadIdentity `json:"wrongServiceAccount"`
WrongNamespace WorkloadIdentity `json:"wrongNamespace"`
}
NegativeIdentities are pre-created, token-request-capable identities used to prove that the role is bound to both the exact ServiceAccount and namespace.
type OpenBaoClient ¶
type OpenBaoClient interface {
Unwrap(context.Context, string) (string, error)
LookupSelf(context.Context, string) (TokenFacts, error)
CapabilitiesSelf(context.Context, string, []string) (map[string][]string, error)
Read(context.Context, string, string) (ReadResult, error)
List(context.Context, string, string) (ReadResult, error)
Write(context.Context, string, string, any) (ReadResult, error)
Delete(context.Context, string, string) error
Health(context.Context) error
ExpectForbidden(context.Context, string, string, string, any) error
}
OpenBaoClient is intentionally expressed as exact operations, not a generic path client available to the state machine.
func NewOpenBaoClient ¶
func NewOpenBaoClient(connection Connection) (OpenBaoClient, error)
type Report ¶
type Report struct {
SchemaVersion string `json:"schemaVersion"`
Status Status `json:"status"`
MutationPerformed bool `json:"mutationPerformed"`
RollbackAttempted bool `json:"rollbackAttempted"`
InputMaterialEchoed bool `json:"inputMaterialEchoed"`
CompletedGates []string `json:"completedGates,omitempty"`
FailedGate string `json:"failedGate,omitempty"`
NonClaims []string `json:"nonClaims"`
}
Report never contains identifiers, endpoints, fingerprints, or dynamic provider errors. Gate IDs are fixed public vocabulary.
func Apply ¶
Apply parses one request, creates hardened clients, and executes the complete dedicated workload-identity plus one-secret vertical slice.
func Execute ¶
func Execute(ctx context.Context, request Request, kubernetes KubernetesClient, openBao OpenBaoClient) Report
Execute is exported inside the internal package boundary for deterministic state-machine tests with exact fake clients.
type Request ¶
type Request struct {
SchemaVersion string `json:"schemaVersion"`
Contract openbaoauth.Contract `json:"contract"`
OpenBao Connection `json:"openBao"`
Kubernetes Connection `json:"kubernetes"`
Lease LeaseTarget `json:"lease"`
ExecutorIdentity WorkloadIdentity `json:"executorIdentity"`
ManagementPolicyName string `json:"managementPolicyName"`
ManagementAccessor string `json:"managementAccessor"`
WrappingTokenBase64 string `json:"wrappingTokenBase64"`
Seed Seed `json:"seed"`
NegativeIdentities NegativeIdentities `json:"negativeIdentities"`
Approval Approval `json:"approval"`
ExecutorServiceAccountUID string `json:"-"`
}
Request is the complete one-shot apply input. All *Base64 fields may contain credentials and must never be copied to reports, errors, argv, environment, files, or logs.
type ResourceAccess ¶
type SecretEntry ¶
SecretEntry keeps secret bytes encoded while crossing the JSON boundary.
type Seed ¶
type Seed struct {
RelativePath string `json:"relativePath"`
Entries []SecretEntry `json:"entries"`
}
Seed is one create-only KV-v2 value below Contract.DataPrefix.
type ServiceAccountFacts ¶
type ServiceAccountFacts struct {
UID string
}
type ServiceAccountToken ¶
type Status ¶
type Status string
Status is deliberately a closed, evidence-safe result set.
const ( SchemaVersion = "cloudring.openbao-kubernetes-auth-apply/v1" MaxInputBytes = 512 * 1024 StatusBlockedPreflight Status = "blocked_preflight" StatusApplied Status = "applied" StatusRolledBack Status = "rolled_back" StatusPartialManualInterventionRequired Status = "partial_manual_intervention_required" )
type SubjectFacts ¶
type SupervisorOpenBaoClient ¶
type SupervisorOpenBaoClient interface {
ApplyClient() OpenBaoClient
Health(context.Context) error
LookupInitialRoot(context.Context, string) (TokenFacts, error)
ReadTemporaryPolicy(context.Context, string, string) (ReadResult, error)
CreateTemporaryPolicy(context.Context, string, string, string) error
DeleteTemporaryPolicy(context.Context, string, string) error
CreateWrappedManagementToken(context.Context, string, string, string) (WrappedToken, error)
RevokeAccessorAndProve(context.Context, string, string) bool
}
type SupervisorRequest ¶
type SupervisorRequest struct {
SchemaVersion string `json:"schemaVersion"`
Contract openbaoauth.Contract `json:"contract"`
OpenBao Connection `json:"openBao"`
Kubernetes Connection `json:"kubernetes"`
Lease LeaseTarget `json:"lease"`
ExecutorIdentity WorkloadIdentity `json:"executorIdentity"`
RootCredentialBase64 string `json:"rootCredentialBase64"`
Seed Seed `json:"seed"`
NegativeIdentities NegativeIdentities `json:"negativeIdentities"`
ChangeAuthorized bool `json:"changeAuthorized"`
// contains filtered or unexported fields
}
SupervisorRequest is the single pipe-only input for the protected root delegation boundary. The temporary policy, wrapped child credential, and apply binding are generated inside the process.