Skip to content

Commit

Permalink
config update and modules (#152)
Browse files Browse the repository at this point in the history
* santactl/sync: #150

* pch to modules
  • Loading branch information
tburgin authored Mar 9, 2017
1 parent 8684cc3 commit a2a660d
Show file tree
Hide file tree
Showing 73 changed files with 175 additions and 91 deletions.
70 changes: 12 additions & 58 deletions Santa.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions Source/SantaGUI/Resources/Santa-Prefix.pch

This file was deleted.

2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTAboutWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

@interface SNTAboutWindowController : NSWindowController

@property IBOutlet NSButton *moreInfoButton;
Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTAccessibleTextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

/**
An NSTextField subclass that provides an accessiblity label equal to:
(self.toolTip + self.stringValue) where available. It also sets the
Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

///
/// Initiates and manages the connection to santad
///
Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTMessageWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

///
/// An NSPanel that can become key/main and can fade in/out.
///
Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTMessageWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

@class SNTStoredEvent;

@protocol SNTMessageWindowControllerDelegate
Expand Down
2 changes: 1 addition & 1 deletion Source/SantaGUI/SNTMessageWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#import "SNTMessageWindowController.h"

#import <SecurityInterface/SFCertificatePanel.h>
@import SecurityInterface.SFCertificatePanel;

#import "MOLCertificate.h"
#import "SNTBlockMessage.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/SNTNotificationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

#import "SNTMessageWindowController.h"
#import "SNTXPCNotifierInterface.h"

Expand Down
2 changes: 2 additions & 0 deletions Source/SantaGUI/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Cocoa;

#import "SNTAppDelegate.h"

int main(int argc, const char *argv[]) {
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTBlockMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

@class SNTStoredEvent;

@interface SNTBlockMessage : NSObject
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTCommonEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

///
/// These enums are used in various places throughout the Santa client code.
/// The integer values are also stored in the database and so shouldn't be changed.
Expand Down
20 changes: 20 additions & 0 deletions Source/common/SNTConfigurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommonEnums.h"

///
Expand Down Expand Up @@ -162,6 +164,24 @@ extern NSString *const kDefaultConfigFilePath;
///
@property(readonly, nonatomic) NSString *machineID;

///
/// The number of seconds in-between full syncs while connected to FCM
///
/// @note The default value is 14400.
/// @note The minimum value is 600.
///
@property(readonly, nonatomic) NSInteger FCMFullSyncInterval;

///
/// The maximum number of seconds to wait before a rule sync when
/// receiving a global rule sync message. Each client will choose a random
/// number of seconds between 0 and FCMGlobalRuleLeeway.
///
/// @note The default value is 600.
/// @note The minimum value is 60.
///
@property(readonly, nonatomic) NSInteger FCMGlobalRuleLeeway;

#pragma mark Server Auth Settings

///
Expand Down
13 changes: 13 additions & 0 deletions Source/common/SNTConfigurator.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ @implementation SNTConfigurator
static NSString *const kMachineIDPlistFileKey = @"MachineIDPlist";
static NSString *const kMachineIDPlistKeyKey = @"MachineIDKey";

static NSString *const kFCMFullSyncInterval = @"FCMFullSyncInterval";
static NSString *const kFCMGlobalRuleLeeway = @"FCMGlobalRuleLeeway";

- (instancetype)initWithFilePath:(NSString *)filePath {
self = [super init];
if (self) {
Expand Down Expand Up @@ -326,6 +329,16 @@ - (NSString *)machineID {
return machineId;
}

- (NSInteger)FCMFullSyncInterval {
NSInteger interval = [self.configData[kFCMFullSyncInterval] integerValue];
return (interval < 600) ? 1440 : interval;
}

- (NSInteger)FCMGlobalRuleLeeway {
NSInteger leeway = [self.configData[kFCMGlobalRuleLeeway] integerValue];
return (leeway < 60) ? 600 : leeway;
}

- (void)reloadConfigData {
NSFileManager *fm = [NSFileManager defaultManager];
if (![fm fileExistsAtPath:self.configFilePath]) return;
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTDropRootPrivs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

///
/// Simple function to check and drop root privileges.
///
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTFileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

///
/// Represents a binary on disk, providing access to details about that binary
/// such as the SHA-1, SHA-256, Info.plist and the Mach-O data.
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTFileWatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

///
/// Simple file watching class using dispatch sources. Will automatically
/// reload the watch if the file is deleted and continue watching for
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#else // KERNEL

@import Foundation;

typedef enum : NSUInteger {
LOG_LEVEL_ERROR,
LOG_LEVEL_WARN,
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTRule.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommonEnums.h"

///
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTStoredEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommonEnums.h"

///
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTSystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

///
/// Simple class for fetching system information
///
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTXPCConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

/**
A wrapper around NSXPCListener and NSXPCConnection to provide client multiplexing, signature
validation of connecting clients and forced connection establishment.
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTXPCControlInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import <MOLCertificate/MOLCertificate.h>

#import "SNTCachedDecision.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTXPCNotifierInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommonEnums.h"

@class SNTStoredEvent;
Expand Down
2 changes: 2 additions & 0 deletions Source/common/SNTXPCSyncdInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommonEnums.h"

@class SNTStoredEvent;
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/SNTCommandCheckCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#import "SNTLogging.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/SNTCommandFileInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#import <MOLCertificate/MOLCertificate.h>
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/SNTCommandFlushCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#import "SNTLogging.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/SNTCommandRule.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#include "SNTLogging.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/SNTCommandStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#import "SNTConfigurator.h"
Expand Down
4 changes: 3 additions & 1 deletion Source/santactl/Commands/SNTCommandVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#include <IOKit/kext/KextManager.h>
@import IOKit.kext;

#import "SNTCommonEnums.h"
#import "SNTFileInfo.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/NSData+Zlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

/// Category on NSData providing the option of getting zlib or gzip compressed data.
@interface NSData (Zlib)

Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/SNTCommandSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandController.h"

#import "SNTCommandSyncManager.h"
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/SNTCommandSyncConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

extern NSString *const kXSRFToken;

extern NSString *const kSerialNumber;
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/SNTCommandSyncEventUpload.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandSyncStage.h"

@interface SNTCommandSyncEventUpload : SNTCommandSyncStage
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/SNTCommandSyncLogUpload.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTCommandSyncStage.h"

@interface SNTCommandSyncLogUpload : SNTCommandSyncStage
Expand Down
2 changes: 2 additions & 0 deletions Source/santactl/Commands/sync/SNTCommandSyncManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/// See the License for the specific language governing permissions and
/// limitations under the License.

@import Foundation;

#import "SNTXPCSyncdInterface.h"

@class SNTXPCConnection;
Expand Down
Loading

0 comments on commit a2a660d

Please sign in to comment.