Track 2 of the enterprise readiness plan. Extensions now start through a Runtime: RemoteGRPCRuntime dials an endpoint the operator mapped, over mTLS for TCP, and LocalNamespaceRuntime runs the verified binary in its own user and network namespace. A mapped endpoint is the only runtime that may serve that extension, so a broken endpoint refuses instead of quietly falling back to a subprocess. Local availability is checked instead of assumed: user and network namespace limits read from /proc/sys/user report a stage that disabled them, which is what restricted Pod Security Standards and hardened kernels do. A host where the chosen runtime cannot run refuses the extension and names why both runtimes declined, so the operator learns to configure a remote endpoint.
28 lines
842 B
Go
28 lines
842 B
Go
//go:build !linux
|
|
|
|
package host
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
// confinedCommand refuses: extensions run only where their egress can be
|
|
// confined to the hosts the operator accepted.
|
|
func confinedCommand(context.Context, *os.File, []string, string) (*exec.Cmd, error) {
|
|
return nil, errors.New("extensions need Linux network namespaces to confine their egress")
|
|
}
|
|
|
|
// namespacesAvailable refuses for the same reason: this platform has no
|
|
// namespace to confine an extension to.
|
|
func namespacesAvailable() error {
|
|
return errors.New("extensions need Linux network namespaces to confine their egress")
|
|
}
|
|
|
|
func openCommand(ctx context.Context, binary *os.File, args []string) *exec.Cmd {
|
|
//nolint:gosec // the binary is the host-verified one, named by its path.
|
|
return exec.CommandContext(ctx, binary.Name(), args...)
|
|
}
|