Documentation
¶
Overview ¶
Package host exposes functionality to interact with the host mashine.
Package host exposes functionality to interact with the host mashine.
Index ¶
- Constants
- Variables
- func ConfigAutodetect(ctx context.Context) (io.Reader, error)
- func DataChannelIdentity(ctx context.Context) (*x509.Certificate, error)
- func Recover()
- func UxIdentity(ctx context.Context) (string, error)
- type BondingMode
- type Config
- type Event
- type EventType
- type IPAddrMode
- type Measurements
- type NetworkInterface
Constants ¶
const ( HostConfigInitrdPath = "/etc/host_configuration.json" HostConfigEFIVarName = "STHostConfig-f401f2c1-b005-4be0-8cee-f2e5945bcbe7" HostConfigProvisionOSPKGName = "provision.zip" )
Sources used by ConfigAutodetect.
const ( // The SHA-256 hash of ospkg zip archive. The event log note is the archive's // file name. Only measured once. OspkgArchive EventType = 0xa0000000 // The SHA-256 hash of the ospkg JSON manifest. The event log note is the // manifest itself. Only measured once. OspkgManifest EventType = 0xa0000001 // The SHA-256 hash of the stboot trust policy. The event log note is the // policy itself. Only measured once. SecurityConfig EventType = 0xa0000002 // The SHA-256 hash of the root X.509 certificate used to verify the ospkg // signing key. The event log note is the X.509 DER certificate. Only measured once. SigningRoot EventType = 0xa0000003 // The SHA-256 hash of all X.509 certificate used to verify the TLS connection // used to fetch the ospkg. The X.509 certificates are concatenated. The // event log note is the X.509 DER certificate. Only measured once. HTTPSRoot EventType = 0xa0000004 // The SHA-256 hash of the platform's human-readable identity. The event log // note is the identity itself. UxIdentityEvent EventType = 0xa0000005 DataChannel EventType = 0xa0000006 DetailPcr uint32 = 12 AuthorityPcr uint32 = 13 IdentityPcr uint32 = 14 )
stboot events.
const (
Null = "null"
)
Variables ¶
var ( ErrMissingIPAddrMode = errors.New("field IP address mode must be set") ErrMissingBondName = errors.New("bond name must be set") ErrInvalidBondMode = errors.New("bond mode is unknown") ErrMissingNetworkInterfaces = errors.New("one or more network interfaces must be set") ErrEmptyNetworkInterfaces = errors.New("network interfaces are set but empty") ErrMissingOSPkgPointer = errors.New("missing OS package pointer") ErrMissingIPAddr = errors.New("field IP address must not be empty when static IP mode is set") ErrMissingGateway = errors.New("default gateway must not be empty when static IP mode is set") )
Errors which may be raised and wrapped in this package.
Errors which may be raised and wrapped in this package.
Functions ¶
func ConfigAutodetect ¶
ConfigAutodetect looks for a known host configuration name in following order: - inside the initramfs at HostConfigInitrdPath - at the efivar filesystem for HostConfigEFIVarName
If no host configuration is found, a special provisioning host config is created and taken as return value. This config points to "ospkg/provision.zip"
It returns with a non-nil io.Reader, if an item exists with the defined name at a probed location. In case there is no match an ErrConfigNotFound is returned.
Note: No validation is made on found configuration.
func DataChannelIdentity ¶ added in v0.3.0
func DataChannelIdentity(ctx context.Context) (*x509.Certificate, error)
func Recover ¶
func Recover()
Recover reboots the system after a few seconds. If reboot fails, it will try rebooting forever.
Types ¶
type BondingMode ¶
type BondingMode int
BondingMode sets the mode for bonding.
const ( BondingUnset BondingMode = iota BondingBalanceRR BondingActiveBackup BondingBalanceXOR BondingBroadcast Bonding8023AD BondingBalanceTLB BondingBalanceALB BondingUnknown )
func StringToBondingMode ¶
func StringToBondingMode(str string) BondingMode
func (BondingMode) MarshalJSON ¶
func (b BondingMode) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*BondingMode) UnmarshalJSON ¶
func (b *BondingMode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Config ¶
type Config struct { IPAddrMode *IPAddrMode `json:"network_mode"` HostIP *netlink.Addr `json:"host_ip"` DefaultGateway *net.IP `json:"gateway"` DNSServer *[]*net.IP `json:"dns"` NetworkInterfaces *[]*NetworkInterface `json:"network_interfaces"` OSPkgPointer *string `json:"ospkg_pointer"` BondingMode BondingMode `json:"bonding_mode"` BondName *string `json:"bond_name"` }
Config stores host specific configuration.
func (Config) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type Event ¶ added in v0.2.1
type IPAddrMode ¶
type IPAddrMode int
IPAddrMode sets the method for network setup.
const ( IPUnset IPAddrMode = iota IPStatic IPDynamic )
func (IPAddrMode) MarshalJSON ¶
func (i IPAddrMode) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*IPAddrMode) UnmarshalJSON ¶
func (i *IPAddrMode) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Measurements ¶ added in v0.2.1
type Measurements struct {
// contains filtered or unexported fields
}
func NewMeasurements ¶ added in v0.2.1
func NewMeasurements(ctx context.Context) *Measurements
func (*Measurements) Add ¶ added in v0.2.1
func (*Measurements) Finalize ¶ added in v0.2.1
func (m *Measurements) Finalize() ([]byte, error)
returns serialized TPM 2.0 event log.
func (*Measurements) Info ¶ added in v0.2.1
func (m *Measurements) Info() (*tss.TPMInfo, error)
type NetworkInterface ¶ added in v0.1.0
type NetworkInterface struct { InterfaceName *string `json:"interface_name"` MACAddress *net.HardwareAddr `json:"mac_address"` }
func (NetworkInterface) MarshalJSON ¶ added in v0.1.0
func (n NetworkInterface) MarshalJSON() ([]byte, error)
func (*NetworkInterface) UnmarshalJSON ¶ added in v0.1.0
func (n *NetworkInterface) UnmarshalJSON(data []byte) error