Documentation
¶
Index ¶
- Constants
- Variables
- func AddChecked(path string)
- func BundleIter(state *config.State, fn func(s *Bundle) error) error
- func CheckEventlogOprom(vfs afero.Fs, eventlog string) error
- func CheckIfKeysInitialized(vfs afero.Fs, output string) bool
- func CheckImmutable(vfs afero.Fs) error
- func CheckMSDos(r io.Reader) (bool, error)
- func CombineFiles(vfs afero.Fs, microcode, initramfs string) (afero.File, error)
- func CopyDirectory(vfs afero.Fs, src, dst string) error
- func CopyFile(vfs afero.Fs, src, dst string) error
- func CreateBundle(state *config.State, bundle Bundle) error
- func CreateDirectory(vfs afero.Fs, path string) error
- func CreateGUID(vfs afero.Fs, guidPath string) ([]byte, error)
- func CreateUUID() []byte
- func DetectTPMEventlog(sb *signature.SignatureDatabase) bool
- func EnrollCustom(customBytes []byte, efivar string) error
- func GenerateBundle(vfs afero.Fs, bundle *Bundle) (bool, error)
- func GetAttr(f *os.File) (int32, error)
- func GetESP(vfs afero.Fs) (string, error)
- func GetEfistub(vfs afero.Fs) (string, error)
- func GetEnrolledVendorCerts() []string
- func GetEventlogChecksums(vfs afero.Fs, eventlog string) (*signature.SignatureDatabase, error)
- func GetEventlogEvents(vfs afero.Fs, eventlog string) ([]attest.Event, error)
- func InChecked(path string) bool
- func IsImmutable(vfs afero.Fs, file string) error
- func LandlockFromFileDatabase(state *config.State) error
- func ReadOrCreateFile(vfs afero.Fs, filePath string) ([]byte, error)
- func SetAttr(f *os.File, attr int32) error
- func Sign(state *config.State, keys *backend.KeyHierarchy, file, output string, ...) error
- func SignFile(state *config.State, kh *backend.KeyHierarchy, ev hierarchy.Hierarchy, ...) error
- func SigningEntryIter(state *config.State, fn func(s *SigningEntry) error) error
- func VerifyFile(state *config.State, kh *backend.KeyHierarchy, ev hierarchy.Hierarchy, ...) (bool, error)
- func WriteBundleDatabase(vfs afero.Fs, dbpath string, bundles Bundles) error
- func WriteFileDatabase(vfs afero.Fs, dbpath string, files SigningEntries) error
- type Bundle
- type Bundles
- type EFIVariables
- type LsblkEntry
- type LsblkRoot
- type SigningEntries
- type SigningEntry
Constants ¶
View Source
const ( // from /usr/include/linux/fs.h FS_SECRM_FL = 0x00000001 /* Secure deletion */ FS_UNRM_FL = 0x00000002 /* Undelete */ FS_COMPR_FL = 0x00000004 /* Compress file */ FS_SYNC_FL = 0x00000008 /* Synchronous updates */ FS_IMMUTABLE_FL = 0x00000010 /* Immutable file */ FS_APPEND_FL = 0x00000020 /* writes to file may only append */ FS_NODUMP_FL = 0x00000040 /* do not dump file */ FS_NOATIME_FL = 0x00000080 /* do not update atime */ FS_DIRTY_FL = 0x00000100 FS_COMPRBLK_FL = 0x00000200 /* One or more compressed clusters */ FS_NOCOMP_FL = 0x00000400 /* Don't compress */ FS_ECOMPR_FL = 0x00000800 /* Compression error */ FS_BTREE_FL = 0x00001000 /* btree format dir */ FS_INDEX_FL = 0x00001000 /* hash-indexed directory */ FS_IMAGIC_FL = 0x00002000 /* AFS directory */ FS_JOURNAL_DATA_FL = 0x00004000 /* Reserved for ext3 */ FS_NOTAIL_FL = 0x00008000 /* file tail should not be merged */ FS_DIRSYNC_FL = 0x00010000 /* dirsync behaviour (directories only) */ FS_TOPDIR_FL = 0x00020000 /* Top of directory hierarchies*/ FS_EXTENT_FL = 0x00080000 /* Extents */ FS_DIRECTIO_FL = 0x00100000 /* Use direct i/o */ FS_NOCOW_FL = 0x00800000 /* Do not cow file */ FS_PROJINHERIT_FL = 0x20000000 /* Create with parents projid */ FS_RESERVED_FL = 0x80000000 /* reserved for ext2 lib */ )
Variables ¶
View Source
var ( // TODO: Remove this at some point // Only here for legacy reasons to denote the old path DatabasePath = "/usr/share/secureboot/" Version = "unknown" )
View Source
var ( ErrOprom = errors.New("uefi has oprom") ErrNoEventlog = errors.New("no eventlog found") )
View Source
var EfivarFSFiles = []string{
"/sys/firmware/efi/efivars/PK-8be4df61-93ca-11d2-aa0d-00e098032b8c",
"/sys/firmware/efi/efivars/KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c",
"/sys/firmware/efi/efivars/db-d719b2cb-3d3a-4596-a3bc-dad00e67656f",
}
View Source
var ErrAlreadySigned = errors.New("already signed file")
View Source
var ErrImmutable = errors.New("file is immutable")
View Source
var ErrNoESP = errors.New("failed to find EFI system partition")
View Source
var ErrNotImmutable = errors.New("file is not immutable")
View Source
var Immutable = false
View Source
var SecureBootKeys = []struct { Key string Description string }{ { Key: "PK", Description: "Platform Key", }, { Key: "KEK", Description: "Key Exchange Key", }, { Key: "db", Description: "Database Key", }, }
Map up our default keys in a struct
Functions ¶
func AddChecked ¶
func AddChecked(path string)
func CheckIfKeysInitialized ¶
Check if we have already intialized keys in the given output directory
func CheckImmutable ¶
Check if any files in efivarfs has the immutable bit set
func CombineFiles ¶
func CopyDirectory ¶
CopyDirectory moves files and creates directories
func CreateUUID ¶
func CreateUUID() []byte
func DetectTPMEventlog ¶
func DetectTPMEventlog(sb *signature.SignatureDatabase) bool
func EnrollCustom ¶
func GetEnrolledVendorCerts ¶
func GetEnrolledVendorCerts() []string
func GetEventlogChecksums ¶
func GetEventlogEvents ¶
func IsImmutable ¶
Check if a given file has the immutable bit set
func SigningEntryIter ¶
func SigningEntryIter(state *config.State, fn func(s *SigningEntry) error) error
func VerifyFile ¶
func WriteBundleDatabase ¶
func WriteFileDatabase ¶
func WriteFileDatabase(vfs afero.Fs, dbpath string, files SigningEntries) error
Types ¶
type Bundle ¶
type Bundle struct { Output string `json:"output"` IntelMicrocode string `json:"intel_microcode"` AMDMicrocode string `json:"amd_microcode"` KernelImage string `json:"kernel_image"` Initramfs string `json:"initramfs"` Cmdline string `json:"cmdline"` Splash string `json:"splash"` OSRelease string `json:"os_release"` EFIStub string `json:"efi_stub"` ESP string `json:"esp"` }
type EFIVariables ¶
type EFIVariables struct { PK *signature.SignatureDatabase KEK *signature.SignatureDatabase Db *signature.SignatureDatabase Dbx *signature.SignatureDatabase // contains filtered or unexported fields }
func NewEFIVariables ¶
func NewEFIVariables(fs *efivarfs.Efivarfs) *EFIVariables
func SystemEFIVariables ¶
func SystemEFIVariables(fs *efivarfs.Efivarfs) (*EFIVariables, error)
func (*EFIVariables) EnrollAllKeys ¶
func (e *EFIVariables) EnrollAllKeys(hier *backend.KeyHierarchy) error
func (*EFIVariables) EnrollKey ¶
func (e *EFIVariables) EnrollKey(ev efivar.Efivar, hier *backend.KeyHierarchy) error
func (*EFIVariables) GetSiglist ¶
func (e *EFIVariables) GetSiglist(ev efivar.Efivar) *signature.SignatureDatabase
type LsblkEntry ¶
type LsblkRoot ¶
type LsblkRoot struct {
Blockdevices []*LsblkEntry `json:"blockdevices"`
}
type SigningEntries ¶
type SigningEntries map[string]*SigningEntry
func ReadFileDatabase ¶
func ReadFileDatabase(vfs afero.Fs, dbpath string) (SigningEntries, error)
type SigningEntry ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.