Repository navigation
Per-node flags overrides: host identity and a rollback guard for osquery restarts - #27
Merged
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.
Per-node flags overrides: host identity and a rollback guard for osquery restarts
Companion to the osctrl change that adds per-node osquery flags overrides. With it, an osctrl admin can give one host extra flags during an investigation: events, file integrity monitoring, process auditing and other startup-only settings. osctrl serves those flags only when osctrld says which host is asking. Because a bad flag stops osqueryd at startup, osctrld now also guards every restart it triggers.
Problem
What changes
Host identity (service mode only)
osqueryd -S --json "select uuid from system_info;". That is the identity osquery enrolls with (--host_identifier=uuid).uuidandapply(result=ok|rejected,sha256,error,at).applyreports the outcome of the last flags change.install,verifyandflagssend neither field. Only the service loop can later remove an override, so only it may receive one.Restart guard
uuid, which returns the environment's flags;rejectedon the next sync.Pendinghash is saved before new flags are written. If the check was cut short by a restart command error, SIGTERM, a crash or a reboot, the next sync runs it without restarting osqueryd again.osquerydorosqueryd.exe. The old command-line substring check didn't work on Windows.State file
<flagfile>.osctrld-state.jsonholds the last apply status, the rejected hash, the pending hash and the cached host UUID. Mode0600.Security and operational impact
Validation
go test ./... -count=1passes, also with-race.go vet ./...is clean forGOOS=darwin,linuxandwindows;gofmt -l cmdprints nothing.golangci-lint run ./...: 0 issues.go build -o /dev/null ./cmd/osctrld: ok.uuidandapplysent in service mode, and absent otherwise.0600mode.syncOncecycles, including "a second cycle does nothing".