linuximage

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package linuximage defines the fixed Ubuntu Azure VHD source, validation, and content-addressed cache model used by LabLink.

Index

Constants

View Source
const (
	SourceID                    = "ubuntu-24.04-amd64-generic"
	Distribution                = "ubuntu"
	Release                     = "24.04"
	Architecture                = "amd64"
	ImageFilename               = "ubuntu-24.04-server-cloudimg-amd64-azure.vhd.tar.gz"
	ExtractedVHDFilename        = "livecd.ubuntu-cpc.azure.vhd"
	ManifestFilename            = "SHA256SUMS"
	ManifestSigFilename         = "SHA256SUMS.gpg"
	TransformSchema             = "lablink-linux-nocloud-azure-vhd-wsl-builder-v1"
	SourceBaseURL               = "https://cloud-images.ubuntu.com/releases/noble/release"
	ImageURL                    = SourceBaseURL + "/" + ImageFilename
	SHA256SUMSURL               = SourceBaseURL + "/" + ManifestFilename
	SHA256SUMSSignatureURL      = SourceBaseURL + "/" + ManifestSigFilename
	UbuntuSigningKeyFingerprint = "D2EB44626FDDC30B513D5BB71A5D6C4C7DB87C81"
	WSLRuntimeVersion           = "3.0.3"
	WSLRuntimeProductVersion    = "3.0.3.0"
	WSLMSIFilename              = "wsl.3.0.3.0.x64.msi"
	WSLMSIURL                   = "https://github.com/microsoft/WSL/releases/download/3.0.3/" + WSLMSIFilename
	WSLMSISHA256                = "ae977286974255bd26bf925f00f40f5692c6b2084155cbc0563c09aea091f211"
	WSLMSIDisplayName           = "LabLink WSL 3.0.3 x64 MSI"
	WSLDistributionName         = "Ubuntu-24.04"
)

Variables

This section is empty.

Functions

func CacheKey

func CacheKey(imageSHA256 string, diskSizeGB int) (string, error)

func ParseSHA256SUMS

func ParseSHA256SUMS(data []byte, filename string) (string, error)

ParseSHA256SUMS returns the checksum for the exact requested file. Both GNU text (" file") and binary (" *file") markers are accepted.

func SourceStatePaths

func SourceStatePaths(root string, diskSizeGB int) (stateDir, statePath, downloadDir string, err error)

func ValidateDiskSizeGB

func ValidateDiskSizeGB(value int) error

func ValidateHTTPSURL

func ValidateHTTPSURL(raw string) error

Types

type BITSJobState

type BITSJobState struct {
	Kind             string `json:"kind"`
	ID               string `json:"id,omitempty"`
	DisplayName      string `json:"display_name,omitempty"`
	State            string `json:"state,omitempty"`
	BytesTransferred int64  `json:"bytes_transferred,omitempty"`
	BytesTotal       int64  `json:"bytes_total,omitempty"`
	Error            string `json:"error,omitempty"`
}

type CachePaths

type CachePaths struct {
	Root             string `json:"root"`
	CacheKey         string `json:"cache_key"`
	ImageSHA256      string `json:"image_sha256"`
	SourceStateDir   string `json:"source_state_dir"`
	StatePath        string `json:"state_path"`
	DownloadDir      string `json:"download_dir"`
	ImagePath        string `json:"image_path"`
	ManifestPath     string `json:"manifest_path"`
	SignaturePath    string `json:"signature_path"`
	ContentDir       string `json:"content_dir"`
	PreparedVHDXPath string `json:"prepared_vhdx_path"`
	MetadataPath     string `json:"metadata_path"`
	StagingRoot      string `json:"staging_root"`
}

func NewCachePaths

func NewCachePaths(root, imageSHA256 string, diskSizeGB int) (CachePaths, error)

type ImageMetadata

type ImageMetadata struct {
	SchemaVersion             string            `json:"schema_version"`
	CacheKey                  string            `json:"cache_key"`
	Source                    Source            `json:"source"`
	ImageSHA256               string            `json:"image_sha256"`
	PreparedSHA256            string            `json:"prepared_sha256"`
	DiskSizeGB                int               `json:"disk_size_gb"`
	PreparedVHDX              string            `json:"prepared_vhdx"`
	BuilderProfile            string            `json:"image_builder_profile"`
	BuilderProfileFingerprint string            `json:"builder_profile_fingerprint"`
	Verification              VerificationState `json:"verification"`
	PublishedAt               time.Time         `json:"published_at"`
}

type ManifestVerificationRequest

type ManifestVerificationRequest struct {
	Source    Source
	Manifest  []byte
	Signature []byte
}

type ManifestVerifier

type ManifestVerifier interface {
	VerifyManifest(context.Context, ManifestVerificationRequest) (VerificationState, error)
}

ManifestVerifier authenticates SHA256SUMS before its image digest may be trusted. Implementations must verify an approved Ubuntu signing identity.

type Phase

type Phase string
const (
	PhasePlanned              Phase = "planned"
	PhasePrerequisites        Phase = "prerequisites"
	PhaseDownloading          Phase = "downloading"
	PhaseVerificationRequired Phase = "signature_verification_required"
	PhaseImageValidated       Phase = "image_validated"
	PhaseConverted            Phase = "converted"
	PhaseBuilderReady         Phase = "builder_ready"
	PhaseDiskAttached         Phase = "disk_attached"
	PhaseFilesystemUpdated    Phase = "filesystem_updated"
	PhaseDiagnosticRetained   Phase = "diagnostic_retained"
	PhaseReady                Phase = "ready"
	PhaseFailed               Phase = "failed"
)

type PreparationState

type PreparationState struct {
	SchemaVersion    string            `json:"schema_version"`
	Source           Source            `json:"source"`
	Phase            Phase             `json:"phase"`
	StagingID        string            `json:"staging_id"`
	CacheRoot        string            `json:"cache_root"`
	ImageSHA256      string            `json:"image_sha256,omitempty"`
	CacheKey         string            `json:"cache_key,omitempty"`
	DiskSizeGB       int               `json:"disk_size_gb"`
	ImagePath        string            `json:"image_path,omitempty"`
	StagedVHDX       string            `json:"staged_vhdx,omitempty"`
	PreparedVHDX     string            `json:"prepared_vhdx,omitempty"`
	PreparedSHA256   string            `json:"prepared_sha256,omitempty"`
	MetadataPath     string            `json:"metadata_path,omitempty"`
	BuilderProfile   string            `json:"image_builder_profile,omitempty"`
	BuilderVMName    string            `json:"builder_vm_name,omitempty"`
	BuilderNodeName  string            `json:"builder_node_name,omitempty"`
	AttachedDiskPath string            `json:"attached_disk_path,omitempty"`
	DiagnosticState  string            `json:"diagnostic_state,omitempty"`
	Jobs             []BITSJobState    `json:"jobs,omitempty"`
	Verification     VerificationState `json:"verification"`
	UpdatedAt        time.Time         `json:"updated_at"`
	Error            string            `json:"error,omitempty"`
}

type Source

type Source struct {
	ID                  string `json:"id"`
	Distribution        string `json:"distribution"`
	Release             string `json:"release"`
	Architecture        string `json:"architecture"`
	ImageFilename       string `json:"image_filename"`
	ManifestFilename    string `json:"manifest_filename"`
	SignatureFilename   string `json:"signature_filename"`
	ImageURL            string `json:"image_url"`
	SHA256SUMSURL       string `json:"sha256sums_url"`
	SHA256SUMSSignature string `json:"sha256sums_signature_url"`
}

Source is deliberately fixed. Validate rejects substitutions and caller-provided URLs.

func FixedSource

func FixedSource() Source

func (Source) Validate

func (s Source) Validate() error

type UbuntuManifestVerifier

type UbuntuManifestVerifier struct {
	Now func() time.Time
}

UbuntuManifestVerifier verifies the detached SHA256SUMS signature using the embedded Canonical cloud-image key and pins the exact documented primary-key fingerprint. No system keyring or network key lookup participates.

func (UbuntuManifestVerifier) VerifyManifest

type VerificationError

type VerificationError struct {
	State VerificationStatus
	Err   error
}

func (*VerificationError) Error

func (e *VerificationError) Error() string

func (*VerificationError) Unwrap

func (e *VerificationError) Unwrap() error

type VerificationState

type VerificationState struct {
	Status     VerificationStatus `json:"status"`
	Verifier   string             `json:"verifier,omitempty"`
	Signer     string             `json:"signer,omitempty"`
	VerifiedAt *time.Time         `json:"verified_at,omitempty"`
	Error      string             `json:"error,omitempty"`
}

type VerificationStatus

type VerificationStatus string
const (
	VerificationPending     VerificationStatus = "pending"
	VerificationVerified    VerificationStatus = "verified"
	VerificationFailed      VerificationStatus = "failed"
	VerificationUnavailable VerificationStatus = "unavailable"
)

Jump to

Keyboard shortcuts

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