Repository navigation
Removable media policy for Santa sync - #1186
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.
Removable media policy for Santa sync
Closes #1167
Problem
osctrl could only turn removable media blocking on or off for an environment (
block_usb_mount). The stable v1 sync protocol also supports remounting volumes with restrictive mount options, and a separate policy for encrypted volumes. osctrl offered neither.Change
Policy
ALLOW(default): mounts are not touched.BLOCK: mounts are denied.REMOUNT: mounts are remounted with the selected options (rdonly,noexec,nosuid,nodev,nobrowse,noowners,async,-j).Sync (
osctrl-tls)removable_media_policy, plusencrypted_removable_media_policywhen the override is set.block_usb_mountandremount_usb_mode, derived from the main policy. Those clients ignore the encrypted override.API (
osctrl-api)PUT /api/v1/santa/{env}/configacceptsremovable_media,removable_media_flags,encrypted_removable_mediaandencrypted_removable_media_flags.400: an unknown action, an unknown mount option,REMOUNTwithout options, or options sent withALLOWorBLOCK.block_usb_mountkeep working:trueis treated asBLOCK.santa.Manager.SaveConfig, so callers other than the API handler cannot store an invalid config.UI
REMOUNTis selected, a set of mount option checkboxes appears.Schema
santa_env_configs, added by the startupAutoMigrate.block_usb_mount = truebecomesBLOCK, any other row becomesALLOW. Rows that already have a policy are left alone, so running it again changes nothing.Docs
pkg/santa/README.mdhas a new "Removable media" section.osctrl-api.yamlhas been regenerated.Security / operational impact
block_usb_mountis still stored, derived from the policy on every save. Rolling back to an older build therefore keeps the previous blocking behavior. AnyREMOUNTsetting degrades to a plain block.Validation
go test ./pkg/santa/... ./cmd/api/... ./cmd/tls/...pkg/santa/media_test.gocovers validation, the preflight response for each policy and the encrypted override, and the legacy backfill.PUT /configcover the legacy field, the default, flag normalization and rejection cases.go vetandgolangci-lint(santa package and handlers): 0 issues;gofmtclean.make openapi-checkpasses.cd frontend && npm test(786 tests) andnpm run checkpass. A new test saves aREMOUNTpolicy with options and leaves the encrypted override unset.Not verified: