Adding security posture checks to schedule#898
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
A system that automatically ingests osquery result logs from scheduled queries prefixed with osctrl:posture: and stores them as per-node posture data, enabling security and compliance posture visibility across the fleet.
How it works
Operator configures posture queries in the environment's schedule config with names prefixed by osctrl:posture:. The prefix is configurable via --posture-query-prefix (default osctrl:posture:, empty disables the feature entirely).
osquery executes the queries on schedule and sends results back to osctrl via the standard /log endpoint as regular result logs.
osctrl-tls intercepts the result logs in the LogHandler goroutine. After normal log processing, it calls ingestPosture() which parses each result entry, checks if the query name starts with the configured prefix, and feeds matching results to the PostureManager.
PostureManager upserts the data into a node_posture table, keyed by (node_uuid, category). The category is extracted from the query name by stripping the prefix (e.g., osctrl:posture:packages_deb → packages_deb). Each record stores the row count, a summary (first 100 rows as JSON), the full snapshot (capped at 256KB), and timestamps.
API endpoint GET
/api/v1/nodes/{env}/node/{uuid}/posturereturns all posture categories for a node.Frontend "Posture" tab on the Node Detail page shows each category as a collapsible card with the row count and last-updated time. Expanding a card shows the data rows in a compact table.