environment

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectProxmoxType

func DetectProxmoxType() types.ProxmoxType

DetectProxmoxType detects whether the system is running Proxmox VE or Proxmox Backup Server

func GetVersion

func GetVersion(pType types.ProxmoxType) (string, error)

GetVersion returns the version string of the detected Proxmox system

Types

type EnvVarInfo added in v0.15.1

type EnvVarInfo struct {
	Key   string
	Set   bool
	Value string
}

EnvVarInfo describes a best-effort environment variable lookup.

type EnvironmentInfo

type EnvironmentInfo struct {
	Type    types.ProxmoxType
	Version string
}

EnvironmentInfo holds information about the current Proxmox environment

func Detect

func Detect() (*EnvironmentInfo, error)

Detect detects the Proxmox environment and returns detailed information

type FilePresenceInfo added in v0.15.1

type FilePresenceInfo struct {
	OK        bool
	Present   bool
	StatError string
	Source    string
}

FilePresenceInfo describes whether a file exists, based on a best-effort stat call.

type FileValueInfo added in v0.15.1

type FileValueInfo struct {
	OK        bool
	Value     string
	ReadError string
	Source    string
}

FileValueInfo describes a best-effort file read with a trimmed value.

type IDMapOutsideZeroInfo added in v0.15.1

type IDMapOutsideZeroInfo struct {
	OK          bool
	Outside0    int64
	Length      int64
	ReadError   string
	ParseError  string
	SourcePath  string
	RawEvidence string // best-effort, sanitized single-line hint
}

IDMapOutsideZeroInfo describes the mapping information for inside ID 0 parsed from /proc/self/{uid_map,gid_map}.

type UnprivilegedContainerInfo added in v0.14.1

type UnprivilegedContainerInfo struct {
	Detected bool
	Details  string

	UIDMap           IDMapOutsideZeroInfo
	GIDMap           IDMapOutsideZeroInfo
	SystemdContainer FileValueInfo

	EnvContainer EnvVarInfo

	DockerMarker FilePresenceInfo
	PodmanMarker FilePresenceInfo

	Proc1CgroupHint FileValueInfo
	SelfCgroupHint  FileValueInfo

	ContainerRuntime string
	ContainerSource  string

	EUID int
}

UnprivilegedContainerInfo describes whether the current process appears to be running in an environment with limited system privileges.

This can be true for unprivileged LXC containers (shifted user namespace), rootless containers, non-root execution, and many container runtimes where access to low-level system interfaces is intentionally restricted.

func DetectUnprivilegedContainer added in v0.14.1

func DetectUnprivilegedContainer() UnprivilegedContainerInfo

DetectUnprivilegedContainer detects whether the current process appears to be running in an environment with limited system privileges.

Detection is based on /proc/self/{uid_map,gid_map}. When the mapping for inside-ID 0 maps to a non-zero outside-ID, the process is in a shifted user namespace and likely lacks low-level hardware/block-device privileges.

In addition, best-effort container heuristics are used to reduce false negatives on container runtimes where uid_map is not shifted (for example, rootful Docker/Podman or privileged LXC with restricted device access).

The return value is intentionally best-effort and never returns an error.

Jump to

Keyboard shortcuts

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