runner

package
v0.0.0-...-4a87c2a Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SocketPath = "/run/paretosecurity.sock"

Functions

func Check

func Check(ctx context.Context, claimsTorun []claims.Claim, skipUUIDs []string, onlyUUID string)

Check runs a series of checks concurrently for a list of claims.

It iterates over each claim provided in claimsTorun and, for each claim, over its associated checks. Each check is executed in its own goroutine.

func HandleConnection

func HandleConnection(conn net.Conn)

handleConnection handles an incoming network connection. It reads input from the connection, processes the input to run checks, and sends back the status of the checks as a JSON response.

The input is expected to be a JSON object containing a "uuid" key. The function will look for checks that are runnable, require root, and match the provided UUID. It will run those checks and collect their status.

func IsSocketServicePresent

func IsSocketServicePresent() bool

func PrintSchemaJSON

func PrintSchemaJSON(claimsTorun []claims.Claim)

PrintSchemaJSON constructs and prints a JSON schema generated from a slice of claims. For each claim, the function builds a nested map where the claim's title is the key and its value is another map. This inner map associates each check's UUID with a slice that contains the check's passed message and failed message. The resulting schema is marshalled into an indented JSON string and printed to standard output. In case of an error during marshalling, the function logs a warning with the error details.

Types

type CheckStatus

type CheckStatus struct {
	UUID    string `json:"uuid"`
	Passed  bool   `json:"passed"`
	Details string `json:"details"`
}

func RunCheckViaRoot

func RunCheckViaRoot(uuid string) (*CheckStatus, error)

RunCheckViaRoot connects to a Unix socket, sends a UUID, and receives a boolean status. It is used to execute a check with root privileges via a helper process. The function establishes a connection to the socket specified by SocketPath, sends the UUID as a JSON-encoded string, and then decodes the JSON response to determine the status of the check. It returns the boolean status associated with the UUID and any error encountered during the process.

Jump to

Keyboard shortcuts

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