vsockauth

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vsockauth is what proves a hypervisor to the daemon of its guest, over a vsock connection.

A source port of the hypervisor below 1024 only says the process holds CAP_NET_BIND_SERVICE, not that it is the daemon: a service granted that capability alone would be root on the guests. So the daemon of the hypervisor signs a token, with the key of its cluster only root reads, and the guest verifies it with the public key it finds in its firmware, written there by the definition of the domain.

The firmware is the qemu command line, which every user of the hypervisor reads: that is why it holds a public key, and not a secret. What only the hypervisor can do is writing it, and the guest reads it as root.

Index

Constants

View Source
const (
	// TokenUse is the token_use claim of a token of a hypervisor. The key
	// signing it also signs the access tokens of the api of its cluster,
	// which refuses this one.
	TokenUse = "vsock"

	// OEMPrefix starts the OEM string of the firmware of a guest holding the
	// public key of its hypervisor.
	OEMPrefix = "opensvc-hypervisor-key="

	// DMIEntries is where the kernel of a guest shows its firmware tables,
	// to root alone.
	DMIEntries = "/sys/firmware/dmi/entries"

	// ProductUUID is the file holding the uuid of the domain in a guest, to
	// root alone.
	ProductUUID = "/sys/class/dmi/id/product_uuid"
)

Variables

View Source
var ErrNoKey = errors.New("no hypervisor key in the firmware")

ErrNoKey says the firmware of the guest holds no key of a hypervisor: the domain has not started since it has one, or was not defined for it.

Functions

func GuestKey

func GuestKey(dir string) (*rsa.PublicKey, error)

GuestKey returns the key of the hypervisor in the firmware tables of dir.

func GuestUUID

func GuestUUID(file string) (string, error)

GuestUUID returns the uuid of the domain in the file, ProductUUID.

func NewToken

func NewToken(key *rsa.PrivateKey, guest string) (string, error)

NewToken returns a token proving the holder of the key to the guest of the uuid.

func OEMString

func OEMString(key *rsa.PublicKey) (string, error)

OEMString returns the OEM string telling a guest the key of its hypervisor.

func ParseSignKey

func ParseSignKey(b []byte) (*rsa.PrivateKey, error)

ParseSignKey parses the key a hypervisor signs with, in PEM.

func Verify

func Verify(s string, key *rsa.PublicKey, guest string) error

Verify says s is a token of the holder of the key for the guest of the uuid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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