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
- Variables
- func GuestKey(dir string) (*rsa.PublicKey, error)
- func GuestUUID(file string) (string, error)
- func NewToken(key *rsa.PrivateKey, guest string) (string, error)
- func OEMString(key *rsa.PublicKey) (string, error)
- func ParseSignKey(b []byte) (*rsa.PrivateKey, error)
- func Verify(s string, key *rsa.PublicKey, guest string) error
Constants ¶
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 ¶
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 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 ParseSignKey ¶
func ParseSignKey(b []byte) (*rsa.PrivateKey, error)
ParseSignKey parses the key a hypervisor signs with, in PEM.
Types ¶
This section is empty.