Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Add basic support for importing and exporting rules to/from JSON #1170

Merged
merged 15 commits into from
Sep 13, 2023

Conversation

pmarkowsky
Copy link
Contributor

This PR adds support for importing and exporting rules to/from a JSON file when Santa is not configured to use a sync server.

Fixes #56.

The format of the file is:

{"rules": [{ "policy" : "BLOCKLIST",
                   "rule_type" : "BINARY",
                  "identifier" : "84de9c61777ca36b13228e2446d53e966096e78db7a72c632b5c185b2ffe68a6"
                  "custom_url" : "",
                  "custom_msg" : "/bin/ls block for demo"}
               ]}

Example usage of export

$ sudo santactl rules --export rules.json

Example usage of import

$ sudo santactl rules --import rules.json

@pmarkowsky pmarkowsky added this to the 2023.8 Release milestone Aug 31, 2023
@pmarkowsky pmarkowsky requested a review from a team as a code owner August 31, 2023 19:43
Source/santactl/Commands/SNTCommandRule.m Outdated Show resolved Hide resolved
Source/santactl/Commands/SNTCommandRule.m Outdated Show resolved Hide resolved
Source/santactl/Commands/SNTCommandRule.m Outdated Show resolved Hide resolved
Source/santad/SNTDaemonControlController.mm Outdated Show resolved Hide resolved
Source/santactl/Commands/SNTCommandRule.m Outdated Show resolved Hide resolved
Source/santactl/Commands/SNTCommandRule.m Show resolved Hide resolved
Source/santactl/Commands/SNTCommandRule.m Outdated Show resolved Hide resolved
@pmarkowsky pmarkowsky merged commit b8d7ed0 into google:main Sep 13, 2023
@pmarkowsky pmarkowsky deleted the markowsky/json-rules branch September 13, 2023 21:46
@pmarkowsky pmarkowsky mentioned this pull request Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

json 'pack' format to allow import/export of a group of rules
2 participants