mirror of
https://github.com/google/santa.git
synced 2026-01-18 10:38:04 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b22c85a64 | ||
|
|
58fe5d3d76 | ||
|
|
8b2227967e | ||
|
|
65693acea1 | ||
|
|
7cea383930 | ||
|
|
5ae2376158 | ||
|
|
e851337eac | ||
|
|
2e53834980 | ||
|
|
aef139e93c |
@@ -1,34 +0,0 @@
|
||||
Want to contribute? Great! First, read this page (including the small print at the end).
|
||||
|
||||
### Before you contribute
|
||||
Before we can use your code, you must sign the
|
||||
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual)
|
||||
(CLA), which you can do online. The CLA is necessary mainly because you own the
|
||||
copyright to your changes, even after your contribution becomes part of our
|
||||
codebase, so we need your permission to use and distribute your code. We also
|
||||
need to be sure of various other things—for instance that you'll tell us if you
|
||||
know that your code infringes on other people's patents. You don't have to sign
|
||||
the CLA until after you've submitted your code for review and a member has
|
||||
approved it, but you must do it before we can put your code into our codebase.
|
||||
|
||||
Before you start working on a larger contribution, you should get in touch with
|
||||
us first through the [issue tracker](https://github.com/google/santa/issues)
|
||||
with your idea so that we can help out and possibly guide you. Co-ordinating
|
||||
large changes ahead of time can avoid frustration later on.
|
||||
|
||||
### Code reviews
|
||||
All submissions - including submissions by project members - require review. We
|
||||
use GitHub pull requests for this purpose. GitHub will automatically run the
|
||||
tests when you mail your pull request and a proper review won't be started until
|
||||
the tests are complete and passing.
|
||||
|
||||
### Code Style
|
||||
|
||||
All code submissions should try to match the surrounding code. Wherever possible,
|
||||
code should adhere to either the
|
||||
[Google Objective-C Style Guide](https://google.github.io/styleguide/objcguide.xml)
|
||||
or the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
|
||||
|
||||
### The small print
|
||||
Contributions made by corporations are covered by a different agreement than
|
||||
the one above, the [Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).
|
||||
1
CONTRIBUTING.md
Symbolic link
1
CONTRIBUTING.md
Symbolic link
@@ -0,0 +1 @@
|
||||
docs/development/contributing.md
|
||||
@@ -1,13 +1,13 @@
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_apple//apple:macos.bzl",
|
||||
"macos_command_line_application",
|
||||
"macos_kernel_extension",
|
||||
)
|
||||
load("//:helper.bzl", "run_command", "santa_unit_test")
|
||||
load("//:helper.bzl", "run_command")
|
||||
load("//:version.bzl", "SANTA_VERSION")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
cc_library(
|
||||
name = "santa_driver_lib",
|
||||
srcs = [
|
||||
|
||||
@@ -337,6 +337,7 @@ static void reachabilityHandler(
|
||||
#pragma mark syncing chain
|
||||
|
||||
- (void)preflight {
|
||||
LOGD(@"Preflight starting");
|
||||
SNTCommandSyncState *syncState = [self createSyncState];
|
||||
SNTCommandSyncPreflight *p = [[SNTCommandSyncPreflight alloc] initWithState:syncState];
|
||||
if ([p sync]) {
|
||||
@@ -373,6 +374,7 @@ static void reachabilityHandler(
|
||||
}
|
||||
|
||||
- (void)eventUploadWithSyncState:(SNTCommandSyncState *)syncState {
|
||||
LOGD(@"Event upload starting");
|
||||
SNTCommandSyncEventUpload *p = [[SNTCommandSyncEventUpload alloc] initWithState:syncState];
|
||||
if ([p sync]) {
|
||||
LOGD(@"Event upload complete");
|
||||
@@ -384,6 +386,7 @@ static void reachabilityHandler(
|
||||
}
|
||||
|
||||
- (void)ruleDownloadWithSyncState:(SNTCommandSyncState *)syncState {
|
||||
LOGD(@"Rule download starting");
|
||||
SNTCommandSyncRuleDownload *p = [[SNTCommandSyncRuleDownload alloc] initWithState:syncState];
|
||||
if ([p sync]) {
|
||||
LOGD(@"Rule download complete");
|
||||
@@ -395,6 +398,7 @@ static void reachabilityHandler(
|
||||
}
|
||||
|
||||
- (void)postflightWithSyncState:(SNTCommandSyncState *)syncState {
|
||||
LOGD(@"Postflight starting");
|
||||
SNTCommandSyncPostflight *p = [[SNTCommandSyncPostflight alloc] initWithState:syncState];
|
||||
if ([p sync]) {
|
||||
LOGD(@"Postflight complete");
|
||||
|
||||
@@ -83,20 +83,33 @@
|
||||
- (NSDictionary *)performRequest:(NSURLRequest *)request timeout:(NSTimeInterval)timeout {
|
||||
NSHTTPURLResponse *response;
|
||||
NSError *error;
|
||||
NSData *data = [self performRequest:request timeout:timeout response:&response error:&error];
|
||||
NSData *data;
|
||||
|
||||
// If the original request failed, attempt to get a new XSRF token and try again.
|
||||
// Unfortunately some servers cause NSURLSession to return 'client cert required' or
|
||||
// 'could not parse response' when a 403 occurs and SSL cert auth is enabled.
|
||||
if ((response.statusCode == 403 ||
|
||||
error.code == NSURLErrorClientCertificateRequired ||
|
||||
error.code == NSURLErrorCannotParseResponse) &&
|
||||
[self fetchXSRFToken]) {
|
||||
NSMutableURLRequest *mutableRequest = [request mutableCopy];
|
||||
[mutableRequest setValue:self.syncState.xsrfToken forHTTPHeaderField:kXSRFToken];
|
||||
return [self performRequest:mutableRequest timeout:timeout];
|
||||
for (int attempt = 1; attempt < 6; ++attempt) {
|
||||
if (attempt > 1) {
|
||||
struct timespec ts = {.tv_sec = (attempt * 2)};
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
LOGD(@"Performing request, attempt %d", attempt);
|
||||
data = [self performRequest:request timeout:timeout response:&response error:&error];
|
||||
if (response.statusCode == 200) break;
|
||||
|
||||
// If the original request failed because of an auth error, attempt to get a new XSRF token and
|
||||
// try again. Unfortunately some servers cause NSURLSession to return 'client cert required' or
|
||||
// 'could not parse response' when a 403 occurs and SSL cert auth is enabled.
|
||||
if ((response.statusCode == 403 ||
|
||||
error.code == NSURLErrorClientCertificateRequired ||
|
||||
error.code == NSURLErrorCannotParseResponse) &&
|
||||
[self fetchXSRFToken]) {
|
||||
NSMutableURLRequest *mutableRequest = [request mutableCopy];
|
||||
[mutableRequest setValue:self.syncState.xsrfToken forHTTPHeaderField:kXSRFToken];
|
||||
request = mutableRequest;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If the final attempt resulted in an error, log the error and return nil.
|
||||
if (response.statusCode != 200) {
|
||||
long code;
|
||||
NSString *errStr;
|
||||
|
||||
@@ -97,6 +97,8 @@ template<> uint64_t SantaCacheHasher<santa_vnode_id_t>(santa_vnode_id_t const& t
|
||||
ES_AUTH_RESULT_ALLOW, true);
|
||||
break;
|
||||
case ACTION_RESPOND_DENY:
|
||||
[self addToCache:sm.vnode_id decision:ACTION_RESPOND_DENY timeout:GetCurrentUptime()];
|
||||
OS_FALLTHROUGH;
|
||||
case ACTION_RESPOND_TOOLONG:
|
||||
ret = es_respond_auth_result(self.client, (es_message_t *)sm.es_message,
|
||||
ES_AUTH_RESULT_DENY, false);
|
||||
|
||||
@@ -195,9 +195,6 @@
|
||||
// if a response hasn't already been sent. This block will still be enqueued if
|
||||
// the the deadline - 2 secs is < DISPATCH_TIME_NOW.
|
||||
// As of 10.15.2, a typical deadline is 60 seconds.
|
||||
// TODO(bur/rah): Possibly cache decisions made after the deadline. Currently a
|
||||
// large enough binary will never be allowed to execute. This should be a rare edge case;
|
||||
// it's probably not worth adding a caching layer just for this.
|
||||
auto responded = std::make_shared<std::atomic<bool>>(false);
|
||||
dispatch_after(dispatch_time(m->deadline, NSEC_PER_SEC * -2), self.esAuthQueue, ^(void) {
|
||||
if (responded->load()) return;
|
||||
|
||||
@@ -175,7 +175,7 @@ Configuration profiles have a `.mobileconfig` file extension. There are many way
|
||||
| fcm_full_sync_interval* | Integer | The full sync interval if a fcm_token is set. Defaults to 14400 secs (4 hours). |
|
||||
| fcm_global_rule_sync_deadline* | Integer | The max time to wait before performing a rule sync when a global rule sync FCM message is received. This allows syncing to be staggered for global events to avoid spikes in server load. Defaults to 600 secs (10 min). |
|
||||
| enable_bundles* | Bool | If set to `True` the bundle scanning feature is enabled. Defaults to `False`. |
|
||||
| enabled_transitive_rules | Bool | If set to `True` the transitive rule feature is enabled. Defaults to `False`. |
|
||||
| enable_transitive_rules | Bool | If set to `True` the transitive rule feature is enabled. Defaults to `False`. |
|
||||
|
||||
*Held only in memory. Not persistent upon process restart.
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PayloadContent</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NotificationSettings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>AlertType</key>
|
||||
<integer>1</integer>
|
||||
<key>BadgesEnabled</key>
|
||||
<true/>
|
||||
<key>BundleIdentifier</key>
|
||||
<string>com.google.santa</string>
|
||||
<key>CriticalAlertEnabled</key>
|
||||
<true/>
|
||||
<key>NotificationsEnabled</key>
|
||||
<true/>
|
||||
<key>ShowInLockScreen</key>
|
||||
<true/>
|
||||
<key>ShowInNotificationCenter</key>
|
||||
<true/>
|
||||
<key>SoundsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>Notifications Payload</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>com.google.santa.notificationsettings.F1817DA0-0044-43DD-9540-36EBC60FDA8F</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadType</key>
|
||||
<string>com.apple.notificationsettings</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>510236AE-D7F8-4131-A4CA-5CC930C51866</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PayloadDescription</key>
|
||||
<string>Configures your Mac to automatically enable Notifications settings for Santa</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>Santa Notifications settings</string>
|
||||
<key>PayloadEnabled</key>
|
||||
<true/>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>com.google.santa.notificationsettings.069CA123-6129-46A5-8FD1-49322E5A5755</string>
|
||||
<key>PayloadOrganization</key>
|
||||
<string></string>
|
||||
<key>PayloadRemovalDisallowed</key>
|
||||
<true/>
|
||||
<key>PayloadScope</key>
|
||||
<string>System</string>
|
||||
<key>PayloadType</key>
|
||||
<string>Configuration</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>069CA123-6129-46A5-8FD1-49322E5A5755</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -8,8 +8,8 @@ This may be the most complex part of Santa. It does two types of work:
|
||||
can also inspect individual files. When running without a sync server it
|
||||
also a supported method of managing the rules database.
|
||||
|
||||
The details of santactl's syncing functionality are covered in the syncing.md
|
||||
document. This document will cover the status work that santactl performs.
|
||||
The details of santactl's syncing functionality are covered in [introduction/syncing-overview.md](syncing-overview.md).
|
||||
This document will cover the status work that santactl performs.
|
||||
|
||||
##### status
|
||||
|
||||
|
||||
34
docs/development/contributing.md
Normal file
34
docs/development/contributing.md
Normal file
@@ -0,0 +1,34 @@
|
||||
Want to contribute? Great! First, read this page (including the small print at the end).
|
||||
|
||||
### Before you contribute
|
||||
Before we can use your code, you must sign the
|
||||
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual)
|
||||
(CLA), which you can do online. The CLA is necessary mainly because you own the
|
||||
copyright to your changes, even after your contribution becomes part of our
|
||||
codebase, so we need your permission to use and distribute your code. We also
|
||||
need to be sure of various other things—for instance that you'll tell us if you
|
||||
know that your code infringes on other people's patents. You don't have to sign
|
||||
the CLA until after you've submitted your code for review and a member has
|
||||
approved it, but you must do it before we can put your code into our codebase.
|
||||
|
||||
Before you start working on a larger contribution, you should get in touch with
|
||||
us first through the [issue tracker](https://github.com/google/santa/issues)
|
||||
with your idea so that we can help out and possibly guide you. Co-ordinating
|
||||
large changes ahead of time can avoid frustration later on.
|
||||
|
||||
### Code reviews
|
||||
All submissions - including submissions by project members - require review. We
|
||||
use GitHub pull requests for this purpose. GitHub will automatically run the
|
||||
tests when you mail your pull request and a proper review won't be started until
|
||||
the tests are complete and passing.
|
||||
|
||||
### Code Style
|
||||
|
||||
All code submissions should try to match the surrounding code. Wherever possible,
|
||||
code should adhere to either the
|
||||
[Google Objective-C Style Guide](https://google.github.io/styleguide/objcguide.xml)
|
||||
or the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
|
||||
|
||||
### The small print
|
||||
Contributions made by corporations are covered by a different agreement than
|
||||
the one above, the [Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate).
|
||||
@@ -9,7 +9,7 @@ contribute.
|
||||
The following documents give an overview of how Santa accomplishes binary
|
||||
authorization at the enterprise scale.
|
||||
|
||||
- [Binary Authorization](introduction/binary-authorization.md): How Santa makes allow or deny decisions for any `execve()` taking place.
|
||||
- [Binary Authorization](introduction/binary-authorization-overview.md): How Santa makes allow or deny decisions for any `execve()` taking place.
|
||||
- [Syncing](introduction/syncing-overview.md): How configuration and rules are applied from a sync server.
|
||||
|
||||
#### Deployment
|
||||
@@ -19,7 +19,7 @@ authorization at the enterprise scale.
|
||||
#### Development
|
||||
|
||||
* [Building Santa](development/building.md): How to build and load Santa for testing on a development machine.
|
||||
* [Contributing](../CONTRIBUTING.md): How to contribute a bug fix or new feature to Santa.
|
||||
* [Contributing](development/contributing.md): How to contribute a bug fix or new feature to Santa.
|
||||
|
||||
#### Details
|
||||
|
||||
@@ -43,7 +43,6 @@ Additional documentation on the concepts that support the operation of the main
|
||||
* [events](details/events.md): Represents an `execve()` that was blocked, or would have been blocked, depending on the mode.
|
||||
* [rules](details/rules.md): Represents allow or deny decisions for a given `execve()`. Can either be a binary's SHA-256 hash or a leaf code-signing certificate's SHA-256 hash.
|
||||
* [scopes](details/scopes.md): The level at which an `execve()` was allowed or denied from taking place.
|
||||
* [syncing](introduction/syncing-overview.md): How Santa communicates with a TLS server for configuration, rules and event uploading.
|
||||
* [ipc](details/ipc.md): How all the components of Santa communicate.
|
||||
duction/syncing-overview.
|
||||
* [logs](details/logs.md): What and where Santa logs.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""The version for all Santa components."""
|
||||
|
||||
SANTA_VERSION = "2021.1"
|
||||
SANTA_VERSION = "2021.2"
|
||||
|
||||
Reference in New Issue
Block a user