localorigin

package
v0.42.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package localorigin realizes the node-local mTLS publication inside the existing StackKits server. Only Apply-owned, signed publication state is read.

Index

Constants

This section is empty.

Variables

View Source
var ErrPeerSelection = errors.New("localorigin: CSR identity differs from explicit Owner peer selection")

Functions

func Bind

Bind issues the server certificate through the existing step-ca and installs the supplied publication. Callers must validate its executor artifact before granting this local capability. It cannot select an arbitrary URL: the backend must already be attested by the application runtime producer.

func InstallPeer

func InstallPeer(root string, credential PeerCredential, rootFingerprint string) error

InstallPeer requires the Home root fingerprint through a separate approved channel. A certificate response cannot bootstrap its own trust anchor.

func NewServer

func NewServer(workspaceRoot, address string) (*http.Server, error)

NewServer constructs the dedicated origin-only TLS listener in the existing StackKits process. No management route or caller-selected upstream is exposed. It is disabled unless the process explicitly supplies a loopback listen socket.

func ProbePeer

func ProbePeer(ctx context.Context, root, peerRef, address string) (int, error)

ProbePeer exercises the installed Cloud credential over the separately established federation loopback socket. The credential selects the sole origin identity; redirects cannot forward it to a different destination.

func ProbePeerOrigin

func ProbePeerOrigin(ctx context.Context, root, peerRef, address, serverName string) (int, error)

ProbePeerOrigin additionally pins the expected origin identity supplied by an adopted external fabric. It reuses the same local credential custody.

func RecordBackend

func RecordBackend(workspaceRoot string, backend Backend) error

func RemoveObsolete

func RemoveObsolete(root string, serverNames []string) error

RemoveObsolete disables omitted publications in signed custody. Both new TLS handshakes and the next request on an existing connection consult that state. Keys remain in custody so interruption cannot accidentally resurrect a route.

func WithdrawBackend

func WithdrawBackend(workspaceRoot string, backend Backend) error

WithdrawBackend removes the exact signed origin backend record for the removed container. Missing exact state may converge. A replaced directory, a non-regular occupancy of the hashed path, or a newer ContainerID is left untouched.

Types

type Backend

type Backend struct {
	ModuleRef   string    `json:"moduleRef"`
	UnitRef     string    `json:"unitRef"`
	InstanceRef string    `json:"instanceRef"`
	NodeRef     string    `json:"nodeRef"`
	ServiceRef  string    `json:"serviceRef"`
	TargetPort  int       `json:"targetPort"`
	Address     string    `json:"address"`
	ContainerID string    `json:"containerId"`
	ObservedAt  time.Time `json:"observedAt"`
}

Backend is produced only after the existing application runtime has observed the exact running container, its scoped loopback mapping and HTTP readiness.

type PeerCredential

type PeerCredential struct {
	PeerRef            string `json:"peerRef"`
	ServerName         string `json:"serverName"`
	CertificatePEM     string `json:"certificatePEM"`
	RootCertificatePEM string `json:"rootCertificatePEM"`
}

PeerCredential is returned after Home has issued and admitted the exact leaf. Only certificate material crosses nodes; the private key stays at Cloud.

func EnrollPeer

func EnrollPeer(ctx context.Context, root, serverName, selectedPeer string, request PeerRequest, replaceKey bool) (PeerCredential, error)

EnrollPeer is called by the explicitly approved local Owner lifecycle. It binds the CSR to an installed origin publication, then uses the existing signed, current-state-bound admission operation after step-ca issuance.

type PeerRequest

type PeerRequest struct {
	PeerRef string `json:"peerRef"`
	CSRPEM  string `json:"csrPEM"`
}

PeerRequest contains only public proof of a Cloud-held key. PeerRef is an explicit local Owner choice; it is never inferred from a site or hostname.

func RequestPeer

func RequestPeer(root, peerRef string) (PeerRequest, error)

func RequestPeerWithRotation

func RequestPeerWithRotation(root, peerRef string, rotate bool) (PeerRequest, error)

type Proof

type Proof struct {
	Nonce                     string                                                   `json:"nonce"`
	Policy                    architecturev2renderer.BridgeOriginMTLSPublicationPolicy `json:"policy"`
	CertificatePEM            string                                                   `json:"certificatePEM"`
	ObservedAt                time.Time                                                `json:"observedAt"`
	TLSVersion                uint16                                                   `json:"tlsVersion"`
	ClientCertificateRequired bool                                                     `json:"clientCertificateRequired"`
	LoopbackOnly              bool                                                     `json:"loopbackOnly"`
}

Proof is read from the real listener after current publication, backend and peer authorization have been evaluated. It never contains private key data.

func Observe

func Observe(ctx context.Context, root, serverName string) (Proof, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL