Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SocketPath = "/run/paretosecurity.sock"
Functions ¶
func Check ¶
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 ¶
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 ¶
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.