Documentation ¶
Index ¶
- Constants
- type AlwaysValidSigner
- type BootBall
- func (ball *BootBall) Clean() error
- func (ball *BootBall) Dir() string
- func (ball *BootBall) GetBootConfigByIndex(index int) (*jsonboot.BootConfig, error)
- func (ball *BootBall) Hash() error
- func (ball *BootBall) Pack() error
- func (ball *BootBall) Sign(privKeyFile, certFile string) error
- func (ball *BootBall) VerifyBootconfigByID(id string) (found, verified int, err error)
- type HostVars
- type Sha512PssSigner
- type Signature
- type Signer
- type Stconfig
Constants ¶
const ( // BallName is the file name of the archive, which is expected to contain // the stboot configuration file along with the corresponding files BallName string = "stboot.ball" // ConfigName is the name of the stboot configuration file ConfigName string = "stconfig.json" //HostVarsName is the name of file containing host-specific data HostVarsName string = "hostvars.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlwaysValidSigner ¶
type AlwaysValidSigner struct{}
AlwaysValidSigner creates signatures that are always valid.
func (AlwaysValidSigner) Hash ¶
func (AlwaysValidSigner) Hash(files ...string) ([]byte, error)
Hash hashes the the provided files. I case of AlwaysValidSigner just 8 random bytes are returned.
type BootBall ¶
type BootBall struct { Archive string RootCertPEM []byte NumSignatures int Signer Signer // contains filtered or unexported fields }
BootBall contains data to operate on the system transparency bootball archive. There is an underlying temporary directory representing the extracted archive.
func BootBallFromArchive ¶
BootBallFromArchive constructs a BootBall zip file at archive
func BootBallFromConfig ¶
BootBallFromConfig constructs a BootBall from a stconfig.json at configFile. the underlying tmporary directory is created with standardized paths and an updated copy of stconfig.json
func (*BootBall) GetBootConfigByIndex ¶
func (ball *BootBall) GetBootConfigByIndex(index int) (*jsonboot.BootConfig, error)
GetBootConfigByIndex returns the Bootconfig at index from the BootBall's configs arrey.
func (*BootBall) Hash ¶
Hash calculates hashes of all boot configurations in BootBall using the BootBall.Signer's hash function
func (*BootBall) Pack ¶
Pack archives the all contents of the underlying temporary directory using zip.
func (*BootBall) Sign ¶
Sign signes the hashes of all boot configurations in BootBall using the BootBall.Signer's hash function with the provided privKeyFile. The signature is stored along with the provided certFile inside the BootBall.
func (*BootBall) VerifyBootconfigByID ¶
VerifyBootconfigByID validates the certificates stored together with the signatures of BootConfig id and verifies the signatures. The number of valid signatures is returned.
type HostVars ¶
type HostVars struct { HostIP string `json:"host_ip"` HostNetmask string `json:"netmask"` DefaultGateway string `json:"gateway"` DNSServer string `json:"dns"` BootstrapURL string `json:"bootstrap_url"` MinimalSignaturesMatch int `json:"minimal_signatures_match"` }
HostVars contains contains platform-specific data
func FindHostVarsInInitramfs ¶
FindHostVarsInInitramfs looks for netvars.json at a given path inside the initramfs file system. The hostvars.json is expected to be in /etc.
type Sha512PssSigner ¶
type Sha512PssSigner struct{}
Sha512PssSigner uses SHA512 hashes ans PSS signatures along with x509 certificates.
func (Sha512PssSigner) Hash ¶
func (Sha512PssSigner) Hash(files ...string) ([]byte, error)
Hash hashes the the provided files. In case of Sha512PssSigner it is a SHA512 hash.
type Signature ¶
type Signature struct { Bytes []byte Cert *x509.Certificate }
type Signer ¶
type Signer interface { Hash(files ...string) ([]byte, error) Sign(privKey string, data []byte) ([]byte, error) Verify(sig Signature, hash []byte) error }
Signer is used by BootBall to hash, sign and varify the BootConfigs with appropriate algorithms
type Stconfig ¶
type Stconfig struct { // configs is an array of u-root BootConfigs BootConfigs []jsonboot.BootConfig `json:"boot_configs"` // rootCertPath is the path to root certificate of the signing RootCertPath string `json:"root_cert"` }
Stconfig contains multiple u-root BootConfig stucts and additional information for stboot