secupdates

package
v0.2.0-dev.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: AGPL-3.0 Imports: 10 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

Index

Constants

View Source
const (
	UnitName       = "mistgate-security-updates"
	StatusFileName = "security-updates.json"

	// JobTimeout bounds the task's waits and quick steps. An apt-get install that has started is never cut by it: dpkg
	// killed in the middle of a transaction leaves the host half configured, so only the unit's RuntimeMaxSec (30
	// minutes) stops a hung one.
	JobTimeout = 20 * time.Minute
	// LockWait bounds the initial wait for a package manager already using dpkg.
	LockWait = 10 * time.Minute

	// TimerStampDir is where systemd keeps the last run of a Persistent=true timer (stamp-<timer>).
	TimerStampDir = "/var/lib/systemd/timers"
)
View Source
const AptConfigCommand = "apt-config"
View Source
const AptPeriodicArgs = "shell E APT::Periodic::Enable L APT::Periodic::Update-Package-Lists U APT::Periodic::Unattended-Upgrade"
View Source
const CodeOverridden = "overridden"
View Source
const ConfigPath = "/etc/apt/apt.conf.d/99mistgate-security-updates"

Variables

This section is empty.

Functions

func ConfigFor

func ConfigFor(keys []string) string

ConfigFor is the override file that switches the given settings on (each once, in a fixed order; unknown keys are dropped).

func InstallArgs

func InstallArgs() []string

InstallArgs is the apt-get argument list that installs unattended-upgrades without questions and without touching the timers; the OS update job installs it the same way when its security mode finds it missing.

func ManagedKeys

func ManagedKeys(body string) []string

ManagedKeys are the settings an earlier run already switched on in the override file (body = its content). A new run keeps them: without them the owner's lower-numbered "0" would count again.

func SystemdRun

func SystemdRun(exe, statusPath string) func(context.Context) error

SystemdRun starts the host-side task as a transient root unit. systemd-run returns when the unit starts; the job's status file carries the eventual result.

Types

type Job

type Job struct {
	StatusPath string
	Timeout    time.Duration
	LockWait   time.Duration
	Out        io.Writer
	Run        awgprep.Runner
	Sys        awgprep.Sys
	Now        func() time.Time
	// ReadFile reads Mistgate's override file from an earlier run. Nil = os.ReadFile.
	ReadFile func(string) ([]byte, error)
}

Job enables unattended security updates without applying upgrades itself.

func (Job) Do

func (j Job) Do(ctx context.Context) error

Do runs the bounded job and leaves the shared awgprep status format at StatusPath when requested.

type Periodic

type Periodic struct {
	Enable             string
	UpdatePackageLists string
	UnattendedUpgrade  string
}

Periodic contains the effective APT::Periodic values printed by `apt-config shell`.

func ParsePeriodicShell

func ParsePeriodicShell(out string) Periodic

ParsePeriodicShell reads apt-config's shell assignments without evaluating them.

func (Periodic) ConfigForDisabled

func (p Periodic) ConfigForDisabled() string

ConfigForDisabled returns only the settings that need to be enabled in Mistgate's override file.

func (Periodic) DisabledKeys

func (p Periodic) DisabledKeys() []string

DisabledKeys lists the effective settings that keep automatic package updates off.

func (Periodic) OffDetails

func (p Periodic) OffDetails() []string

OffDetails returns the raw setting names and values used in the doctor warning.

Jump to

Keyboard shortcuts

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