wslagent

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wslagent keeps the Linux agent binary that the Windows agent runs inside WSL distributions next to the Windows agent.

The MSI and the PowerShell loader both install that binary (as dmg-linux). Installs that have neither, such as a binary run with `install`, an old loader, or a loader run that skipped it, otherwise never get WSL telemetry. Ensure fills that gap: it downloads the linux_<arch> asset for the running agent's version from the GitHub release and accepts it only if its checksum carries a valid release signature (see internal/releasesig).

A copy this package did not install belongs to whoever did (MSI, loader) and is used as is. A copy it did install is tracked by a marker file and replaced when the agent version changes.

Index

Constants

View Source
const BinaryName = "dmg-linux"

BinaryName is the file name the Windows agent looks for next to itself. The MSI and the loader install the Linux agent under the same name.

View Source
const DefaultReleaseBase = "https://github.com/step-security/dev-machine-guard/releases/download"

DefaultReleaseBase is where release assets are downloaded from.

View Source
const DefaultTimeout = 90 * time.Second

DefaultTimeout bounds one download, so a slow network cannot hold the host's scheduled run open. Under the wsl_scan phase budget, leaving time to launch the distros afterwards.

Variables

View Source
var NativeArch = nativeArch

NativeArch returns the architecture the Linux agent must be built for on this host: the machine's own, not this executable's. An amd64 agent can run under x64 emulation on Windows on Arm, where WSL distros are arm64 and cannot run a linux_amd64 binary. A variable so tests can stand in for the host.

Functions

func AssetName

func AssetName(version, arch string) string

AssetName is the release asset for the Linux agent of version and arch. Must match linuxBinaryAssetName in agent-api's release sync.

Types

type Fetcher

type Fetcher struct {
	HTTP        *http.Client
	ReleaseBase string
	// Verify checks a release signature over a hex checksum. Replaceable in
	// tests; production uses releasesig.VerifyChecksum.
	Verify func(checksum string, sig []byte) error
}

Fetcher downloads and installs the Linux agent. The zero value is not usable; use New.

func New

func New() *Fetcher

New returns a Fetcher that downloads from the GitHub release.

func (*Fetcher) Ensure

func (f *Fetcher) Ensure(ctx context.Context, dir, version, arch string) (path string, downloaded bool, err error)

Ensure returns the path of a Linux agent binary in dir that is safe to run for agent version, downloading one when needed. downloaded reports whether this call installed a new copy.

When replacing an older copy of our own fails (offline, GitHub blocked), Ensure returns that older copy together with the error: a guest from a recent release still scans, and the next run tries again.

Jump to

Keyboard shortcuts

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