Documentation
¶
Overview ¶
Package enrollment implements one-use, CSR-bound management bootstrap issuance. It is not wired to an HTTP route or controller staging yet.
Index ¶
- Constants
- Variables
- type BootstrapImporter
- type CurrentIdentity
- type KubernetesResolver
- type Service
- func (s *Service) Enroll(ctx context.Context, token string, csrDER []byte) ([]byte, error)
- func (s *Service) EnrollBound(ctx context.Context, expected pki.Identity, token string, csrDER []byte) ([]byte, error)
- func (s *Service) Mint(ctx context.Context, identity pki.Identity, lifetime time.Duration) (string, error)
- func (s *Service) Register(ctx context.Context, i pki.Identity, token string, expiresAt time.Time) error
Constants ¶
const MaxBootstrapLifetime = 15 * time.Minute
Variables ¶
var ( ErrDenied = errors.New("management enrollment denied") )
Functions ¶
This section is empty.
Types ¶
type BootstrapImporter ¶
type BootstrapImporter struct {
// contains filtered or unexported fields
}
BootstrapImporter reads only the configured protected control-plane namespace. It never accepts a caller-selected token, Secret namespace or Secret name. Construct it only with the production resolver and shared issuance service.
func NewBootstrapImporter ¶
func NewBootstrapImporter(client dynamic.Interface, namespace string, resolver *KubernetesResolver, service *Service) (*BootstrapImporter, error)
type CurrentIdentity ¶
CurrentIdentity must fetch authoritative workspace existence/UID/provisioning generation/epoch and policy. It must reject any mismatch or lookup outage.
type KubernetesResolver ¶
type KubernetesResolver struct {
// contains filtered or unexported fields
}
KubernetesResolver performs uncached reads through the Kubernetes API. A VM UID is the management incarnation: root reset/recreation changes it, VMI restart does not. Epochs come only from VM-bound controller-owned status.
func NewKubernetesResolver ¶
func NewKubernetesResolver(client dynamic.Interface, policy executionPolicyReader) (*KubernetesResolver, error)
func (*KubernetesResolver) Authorize ¶
Authorize can be passed directly as Service.CurrentIdentity. It never trusts generation/epoch values supplied by a CSR, request body or certificate alone.
func (*KubernetesResolver) Resolve ¶
func (r *KubernetesResolver) Resolve(ctx context.Context, namespace, name string) (pki.Identity, error)
Resolve is for trusted provisioning and capability selection, not end-user permission. Policy is read on both sides of the workspace/VM snapshot; a changed resource version denies instead of authorizing a mixed incarnation.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(store storage.EnrollmentStore, issuer *pki.Authority, current CurrentIdentity, leafLifetime time.Duration) (*Service, error)
func (*Service) Enroll ¶
Enroll returns only the single persisted certificate for the exact same CSR. Another key/CSR cannot redeem the token, including from another API replica. Both initial issuance and retries require unexpired bootstrap and current workspace identity; a reset while issuance commits is checked again before returning, and subsequent TLS authorization independently fences stale leaves.
func (*Service) EnrollBound ¶
func (s *Service) EnrollBound(ctx context.Context, expected pki.Identity, token string, csrDER []byte) ([]byte, error)
EnrollBound prevents a token for one machine from being redeemed through a transport request naming another scope/incarnation. Expected identity must come from current authoritative resolution, never the caller's certificate.
func (*Service) Mint ¶
func (s *Service) Mint(ctx context.Context, identity pki.Identity, lifetime time.Duration) (string, error)
Mint is an internal provisioning operation, not end-user delegation. Only the returned token is staged through a trusted per-clone channel; the database keeps its hash. The caller must never log the raw return value.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, i pki.Identity, token string, expiresAt time.Time) error
Register imports only trusted controller provisioning material, never an end-user token request. Repeated imports preserve committed CSR/certificate state; an existing token cannot be rebound, extended or reset to unused.