From 44908fa7de6f9f387ddc68aa9a58539cdd36df5a Mon Sep 17 00:00:00 2001 From: Alter Step Date: Thu, 9 Feb 2017 02:01:13 +0100 Subject: [PATCH] many many changes! --- DNSCrypt-Menubar/COPYING | 16 -- .../DNSCrypt-Menubar-Info.plist | 4 +- .../DNSCrypt-OSX-Installer.pkgproj | 4 +- DNSCrypt-OSX-Installer/sign.sh | 2 +- DNSCrypt-Preference-Pane/COPYING | 21 -- .../DNSCrypt.xcodeproj/project.pbxproj | 14 + .../DNSCrypt/DNSCrypt-Info.plist | 4 +- DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.h | 36 +-- DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m | 117 +++++--- .../DNSCrypt/NSPlaceHolderTextView.h | 15 ++ .../DNSCrypt/NSPlaceHolderTextView.m | 33 +++ .../DNSCrypt/en.lproj/DNSCrypt.xib | 250 +++++++++++------- .../DNSCrypt/extra/html/about.haml | 22 +- .../DNSCrypt/extra/html/about.html | 22 +- .../DNSCrypt/extra/html/help.haml | 21 +- .../DNSCrypt/extra/html/help.html | 22 +- .../DNSCrypt/extra/html/releasenotes.haml | 78 ++---- .../DNSCrypt/extra/html/releasenotes.html | 99 ++----- .../DNSCrypt/extra/usr/scripts/afterboot.sh | 1 + .../DNSCrypt/extra/usr/scripts/common.inc | 9 +- .../extra/usr/scripts/exceptions-add.sh | 63 ----- .../extra/usr/scripts/exceptions-remove.sh | 13 - .../get-blocked-query-logging-status.sh | 9 + .../extra/usr/scripts/get-dhcp-resolvers.sh | 19 +- .../extra/usr/scripts/set-static-resolvers.sh | 2 + .../usr/scripts/switch-aaaa-blocking-off.sh | 1 - .../extra/usr/scripts/switch-blacklists-on.sh | 3 + .../switch-blocked-query-logging-off.sh | 9 + .../switch-blocked-query-logging-on.sh | 7 + .../usr/scripts/switch-exceptions-off.sh | 5 + .../extra/usr/scripts/switch-exceptions-on.sh | 39 +++ .../usr/scripts/update-blacklist-domains.sh | 4 +- .../extra/usr/scripts/update-blacklist-ips.sh | 7 +- .../extra/usr/scripts/update-exceptions.sh | 7 +- DNSCrypt-Uninstaller/Uninstall.scpt | Bin 6726 -> 6802 bytes 35 files changed, 520 insertions(+), 458 deletions(-) delete mode 100644 DNSCrypt-Menubar/COPYING delete mode 100644 DNSCrypt-Preference-Pane/COPYING create mode 100644 DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.h create mode 100644 DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.m delete mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-add.sh delete mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-remove.sh create mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-blocked-query-logging-status.sh create mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-off.sh create mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-on.sh create mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-off.sh create mode 100755 DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-on.sh diff --git a/DNSCrypt-Menubar/COPYING b/DNSCrypt-Menubar/COPYING deleted file mode 100644 index 7840b7e..0000000 --- a/DNSCrypt-Menubar/COPYING +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2011-2014 OpenDNS, Inc. - * Copyright (c) 2014 AlterStep - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar/DNSCrypt-Menubar-Info.plist b/DNSCrypt-Menubar/DNSCrypt-Menubar/DNSCrypt-Menubar-Info.plist index 927af10..5fec1f1 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar/DNSCrypt-Menubar-Info.plist +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar/DNSCrypt-Menubar-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.12 + 1.0.13 CFBundleSignature ???? CFBundleVersion - 1.0.12 + 1.0.13 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj b/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj index 645c883..5c867c8 100755 --- a/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj +++ b/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj @@ -539,7 +539,7 @@ USE_HFS+_COMPRESSION VERSION - 1.0.12 + 1.0.13 TYPE 0 @@ -1032,7 +1032,7 @@ USE_HFS+_COMPRESSION VERSION - 1.0.12 + 1.0.13 TYPE 0 diff --git a/DNSCrypt-OSX-Installer/sign.sh b/DNSCrypt-OSX-Installer/sign.sh index 4f46764..09b5201 100755 --- a/DNSCrypt-OSX-Installer/sign.sh +++ b/DNSCrypt-OSX-Installer/sign.sh @@ -1,6 +1,6 @@ #! /bin/sh -VERSION='1.0.12' +VERSION='1.0.13' echo '*** Do not forget to increase CURRENT_VERSION in common.inc' sleep 10 diff --git a/DNSCrypt-Preference-Pane/COPYING b/DNSCrypt-Preference-Pane/COPYING deleted file mode 100644 index ca3cc5b..0000000 --- a/DNSCrypt-Preference-Pane/COPYING +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2011-2014 OpenDNS, Inc. - * Copyright (c) 2014-2015 AlterStep - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -The get-dhcp-resolvers.sh and check-network-change.sh scripts use code -snippets from the dnssec-trigger project, by Wouter Wijngaards, NLnet -Labs. (great and similar project, check it out: -http://www.nlnetlabs.nl/projects/dnssec-trigger/) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj b/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj index 3ed6cb9..5dc84c9 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj +++ b/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0932D7F61E4B324A00E8F3FC /* NSPlaceHolderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0932D7F51E4B324A00E8F3FC /* NSPlaceHolderTextView.m */; }; 0946B0C613F47F53008277C6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0946B0C513F47F53008277C6 /* Cocoa.framework */; }; 0946B0C813F47F53008277C6 /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0946B0C713F47F53008277C6 /* PreferencePanes.framework */; }; 0946B0D213F47F53008277C6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0946B0D013F47F53008277C6 /* InfoPlist.strings */; }; @@ -29,6 +30,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0932D7F51E4B324A00E8F3FC /* NSPlaceHolderTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSPlaceHolderTextView.m; sourceTree = ""; }; + 0932D7F71E4B327D00E8F3FC /* NSPlaceHolderTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSPlaceHolderTextView.h; sourceTree = ""; }; 0946B0C213F47F53008277C6 /* DNSCrypt.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DNSCrypt.prefPane; sourceTree = BUILT_PRODUCTS_DIR; }; 0946B0C513F47F53008277C6 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 0946B0C713F47F53008277C6 /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = System/Library/Frameworks/PreferencePanes.framework; sourceTree = SDKROOT; }; @@ -124,6 +127,7 @@ 09AD019F15D2483500638DCE /* html */, 09FB094315C9DE6400B8AAB6 /* usr */, 0946B0CE13F47F53008277C6 /* Supporting Files */, + 096AF93A1E4B565A003C3D67 /* UI Additions */, ); path = DNSCrypt; sourceTree = ""; @@ -139,6 +143,15 @@ name = "Supporting Files"; sourceTree = ""; }; + 096AF93A1E4B565A003C3D67 /* UI Additions */ = { + isa = PBXGroup; + children = ( + 0932D7F51E4B324A00E8F3FC /* NSPlaceHolderTextView.m */, + 0932D7F71E4B327D00E8F3FC /* NSPlaceHolderTextView.h */, + ); + name = "UI Additions"; + sourceTree = ""; + }; 09B1686F1906062E003FDBCC /* CHCSVParser */ = { isa = PBXGroup; children = ( @@ -258,6 +271,7 @@ buildActionMask = 2147483647; files = ( 09B168731906062E003FDBCC /* CHCSVParser.m in Sources */, + 0932D7F61E4B324A00E8F3FC /* NSPlaceHolderTextView.m in Sources */, 0946B0D613F47F53008277C6 /* DNSCrypt.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt-Info.plist b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt-Info.plist index b0d910d..680a62d 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt-Info.plist +++ b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.0.12 + 1.0.13 CFBundleSignature ???? CFBundleVersion - 1.0.12 + 1.0.13 NSHumanReadableCopyright BSD NSMainNibFile diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.h b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.h index ab93f54..0d875bf 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.h +++ b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.h @@ -2,8 +2,11 @@ #import #import #import "CHCSVParser/CHCSVParser.h" +#import "NSPlaceHolderTextView.h" -#define kDNSCRYPT_PACKAGE_VERSION @"1.0.12" +#define kDNSCRYPT_PACKAGE_VERSION @"1.0.13" + +#define kDNSCRYPT_PROJECT_URL @"https://dnscrypt.org/osxclient" #define kDNSCRYPT_PREFPANE_APP_PATH @"/Library/PreferencePanes/DNSCrypt.prefPane" #define kDNSCRYPT_USR_BASE_DIR kDNSCRYPT_PREFPANE_APP_PATH @"/Contents/Resources/usr" @@ -14,6 +17,8 @@ #define kDNSCRYPT_CONTROL_DIR kDNSCRYPT_VAR_BASE_DIR @"/control" #define kDNSCRYPT_QUERY_LOG_FILE @"/var/log/dnscrypt-query.log" +#define kDNSCRYPT_BLOCKED_QUERY_LOG_FILE @"/var/log/dnscrypt-blocked-query.log" + #define kDNSCRYPT_BLACKLIST_IPS_TMP_FILE kDNSCRYPT_CONTROL_DIR @"/blacklist-ips.tmp" #define kDNSCRYPT_BLACKLIST_DOMAINS_TMP_FILE kDNSCRYPT_CONTROL_DIR @"/blacklist-domains.tmp" #define kDNSCRYPT_EXCEPTIONS_TMP_FILE kDNSCRYPT_CONTROL_DIR @"/exceptions.tmp" @@ -30,7 +35,7 @@ typedef enum { kDNS_CONFIGURATION_UNKNOWN, kDNS_CONFIGURATION_VANILLA, kDNS_CONFIGURATION_LOCALHOST } DNSConfigurationState; -@interface DNSCrypt : NSPreferencePane { +@interface DNSCrypt : NSPreferencePane { AuthorizationRef auth; NSTabView *_tabView; @@ -46,13 +51,15 @@ typedef enum { WebView *_releaseNotesWebView; WebView *_aboutWebView; NSTextFieldCell *_staticResolversTextField; - NSTextField *_blacklistIPsTextField; - NSTextField *_blacklistDomainsTextField; - NSTextField *_exceptionsTextField; - WebView *_helpWebView; + NSPlaceHolderTextView *_blacklistIPsTextView; + NSPlaceHolderTextView *_blacklistDomainsTextView; + NSPlaceHolderTextView *_exceptionsTextView; NSButton *_viewLogButton; NSButton *_queryLoggingButton; + NSButton *_viewBlockedLogButton; + NSButton *_blockedQueryLoggingButton; NSPopUpButton *_resolverNamesButton; + NSButton *_saveAndApplyChangesButton; } @property (nonatomic, strong) IBOutlet NSTabView *tabView; @property (nonatomic, strong) IBOutlet NSTabViewItem *aboutTabViewItem; @@ -67,12 +74,12 @@ typedef enum { @property (nonatomic, strong) IBOutlet WebView *releaseNotesWebView; @property (nonatomic, strong) IBOutlet WebView *aboutWebView; @property (nonatomic, strong) IBOutlet NSTextFieldCell *staticResolversTextField; -@property (nonatomic, strong) IBOutlet NSTextField *blacklistIPsTextField; -@property (nonatomic, strong) IBOutlet NSTextField *blacklistDomainsTextField; -@property (nonatomic, strong) IBOutlet NSTextField *exceptionsTextField; -@property (nonatomic, strong) IBOutlet WebView *helpWebView; +@property (nonatomic, strong) IBOutlet NSPlaceHolderTextView *blacklistIPsTextView; +@property (nonatomic, strong) IBOutlet NSPlaceHolderTextView *blacklistDomainsTextView; +@property (nonatomic, strong) IBOutlet NSPlaceHolderTextView *exceptionsTextView; @property (nonatomic, strong) IBOutlet NSButton *viewLogButton; @property (nonatomic, strong) IBOutlet NSButton *queryLoggingButton; +@property (nonatomic, strong) IBOutlet NSButton *blockedQueryLoggingButton; @property (nonatomic, strong) IBOutlet NSPopUpButton *resolverNamesButton; @property (nonatomic, strong) IBOutlet NSTextField *locationText; @@ -85,16 +92,15 @@ typedef enum { - (IBAction)dnscryptButtonPressed:(NSButton *)sender; - (IBAction)disableIPv6ButtonPressed:(NSButton *)sender; - - (IBAction)providerLinkPushed:(NSButton *)sender; - (IBAction)uninstallPushed:(NSButton *)sender; - (IBAction)staticResolversTextFieldChanged:(NSTextField *)sender; - (IBAction)queryLoggingButtonPressed:(NSButtonCell *)sender; - (IBAction)viewLogButtonPushed:(NSButton *)sender; -- (IBAction)blacklistIPsUpdated:(NSTextField *)sender; -- (IBAction)blacklistDomainsUpdated:(NSTextField *)sender; -- (IBAction)exceptionsUpdated:(NSTextField *)sender; -- (IBAction)helpButtonPressed:(NSButton *)sender; +- (IBAction)blockedQueryLoggingButtonPressed:(NSButtonCell *)sender; +- (IBAction)viewBlockedLogButtonPushed:(NSButton *)sender; - (IBAction)resolversNamesPopupButtonPressed:(NSPopUpButton *)sender; +- (IBAction)saveAndApplyChangesButtonPressed:(NSButton *)sender; +- (IBAction)helpButtonPressed:(NSButton *)sender; @end diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m index e2e45c2..eeb5630 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m +++ b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m @@ -8,12 +8,12 @@ @synthesize releaseNotesWebView = _releaseNotesWebView; @synthesize aboutWebView = _aboutWebView; @synthesize staticResolversTextField = _staticResolversTextField; -@synthesize blacklistIPsTextField = _blacklistIPsTextField; -@synthesize blacklistDomainsTextField = _blacklistDomainsTextField; -@synthesize helpWebView = _helpWebView; +@synthesize blacklistIPsTextView = _blacklistIPsTextView; +@synthesize blacklistDomainsTextView = _blacklistDomainsTextView; +@synthesize exceptionsTextView = _exceptionsTextView; @synthesize viewLogButton = _viewLogButton; @synthesize queryLoggingButton = _queryLoggingButton; -@synthesize exceptionsTextField = _exceptionsTextField; +@synthesize blockedQueryLoggingButton = _blockedQueryLoggingButton; @synthesize dnscryptButton = _dnscryptButton; @synthesize disableIPv6Button = _disableIPv6Button; @synthesize statusImageView = _statusImageView; @@ -23,6 +23,10 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; NSArray *resolversList; +BOOL blacklistDomainsUpdated = FALSE; +BOOL blacklistIPsUpdated = FALSE; +BOOL exceptionsUpdated = FALSE; + - (void) setCheckBoxesEnabled: (BOOL) enabled { @@ -57,6 +61,10 @@ NSArray *resolversList; _dnscryptButton.state = 0; _disableIPv6Button.state = 0; + [_blacklistIPsTextView setPlaceHolderText: @"IP addresses to block.\n\nExamples:\n\n203.0.113.7\n198.51.100.*"]; + [_blacklistDomainsTextView setPlaceHolderText: @"Domains and patterns to block.\n\nExamples:\n\nexample.com\nads.*\n*sex*"]; + [_exceptionsTextView setPlaceHolderText: @"Domains bypassing DNSCrypt.\n\nExamples:\n\nlocal\nlocaldomain\nlan"]; + res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && exec ./get-dnscrypt-status.sh", nil]]; if ([res isEqualToString: @"yes"]) { [_dnscryptButton setState: 1]; @@ -71,18 +79,22 @@ NSArray *resolversList; if ([res isEqualToString: @"yes"]) { [_queryLoggingButton setState: 1]; } + res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && exec ./get-blocked-query-logging-status.sh", nil]]; + if ([res isEqualToString: @"yes"]) { + [_blockedQueryLoggingButton setState: 1]; + } NSString *fileContent; fileContent = [NSString stringWithContentsOfFile: kDNSCRYPT_BLACKLIST_IPS_TMP_FILE encoding:NSUTF8StringEncoding error: nil]; if (fileContent != nil) { - [_blacklistIPsTextField setStringValue: fileContent]; + [_blacklistIPsTextView setString: fileContent]; } fileContent = [NSString stringWithContentsOfFile: kDNSCRYPT_BLACKLIST_DOMAINS_TMP_FILE encoding:NSUTF8StringEncoding error: nil]; if (fileContent != nil) { - [_blacklistDomainsTextField setStringValue: fileContent]; + [_blacklistDomainsTextView setString: fileContent]; } fileContent = [NSString stringWithContentsOfFile: kDNSCRYPT_EXCEPTIONS_TMP_FILE encoding:NSUTF8StringEncoding error: nil]; if (fileContent != nil) { - [_exceptionsTextField setStringValue: fileContent]; + [_exceptionsTextView setString: fileContent]; } [_resolverNamesButton removeAllItems]; @@ -294,17 +306,6 @@ NSArray *resolversList; } else { [[_aboutWebView mainFrame] loadRequest:[NSURLRequest requestWithURL: aboutURL]]; } - - [_helpWebView setDrawsBackground:false]; - [_helpWebView setShouldUpdateWhileOffscreen:false]; - [_helpWebView setUIDelegate:self]; - NSURL *helpURL; - NSString *helpURLPath = [[NSBundle bundleForClass: [self class]] pathForResource: @"help" ofType: @"html" inDirectory: @"html"]; - if (! helpURLPath || ! (helpURL = [NSURL fileURLWithPath: helpURLPath])) { - assert(0); - } else { - [[_helpWebView mainFrame] loadRequest:[NSURLRequest requestWithURL: helpURL]]; - } } - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element @@ -346,6 +347,20 @@ NSArray *resolversList; return TRUE; } +- (BOOL) setBlockedQueryLoggingOn { + [self showSpinners]; + NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./switch-blocked-query-logging-on.sh", nil]]; + (void) res; + return TRUE; +} + +- (BOOL) setBlockedQueryLoggingOff { + [self showSpinners]; + NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./switch-blocked-query-logging-off.sh", nil]]; + (void) res; + return TRUE; +} + - (IBAction)queryLoggingButtonPressed:(NSButtonCell *)sender { if (sender.state != 0) { [self setQueryLoggingOn]; @@ -354,10 +369,23 @@ NSArray *resolversList; } } +- (IBAction)blockedQueryLoggingButtonPressed:(NSButtonCell *)sender { + if (sender.state != 0) { + [self setBlockedQueryLoggingOn]; + } else { + [self setBlockedQueryLoggingOff]; + } +} + + - (IBAction)viewLogButtonPushed:(NSButton *)sender { [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"open /Applications/Utilities/Console.app " kDNSCRYPT_QUERY_LOG_FILE " || open " kDNSCRYPT_QUERY_LOG_FILE, nil]]; } +- (IBAction)viewBlockedLogButtonPushed:(NSButton *)sender { + [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"open /Applications/Utilities/Console.app " kDNSCRYPT_BLOCKED_QUERY_LOG_FILE " || open " kDNSCRYPT_BLOCKED_QUERY_LOG_FILE, nil]]; +} + - (BOOL) updateBlacklistIPs { [self showSpinners]; NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./update-blacklist-ips.sh", nil]]; @@ -365,8 +393,8 @@ NSArray *resolversList; return TRUE; } -- (IBAction)blacklistIPsUpdated:(NSTextField *)sender { - NSString *content = sender.stringValue; +- (IBAction)blacklistIPsUpdate:(NSPlaceHolderTextView *)sender { + NSString *content = sender.string; if ([content writeToFile: kDNSCRYPT_BLACKLIST_IPS_TMP_FILE atomically: YES encoding: NSUTF8StringEncoding error: nil] != YES) { return; } @@ -380,8 +408,8 @@ NSArray *resolversList; return TRUE; } -- (IBAction)blacklistDomainsUpdated:(NSTextField *)sender { - NSString *content = sender.stringValue; +- (IBAction)blacklistDomainsUpdate:(NSPlaceHolderTextView *)sender { + NSString *content = sender.string; if ([content writeToFile: kDNSCRYPT_BLACKLIST_DOMAINS_TMP_FILE atomically: YES encoding: NSUTF8StringEncoding error: nil] != YES) { return; } @@ -395,28 +423,43 @@ NSArray *resolversList; return TRUE; } -- (IBAction)exceptionsUpdated:(NSTextField *)sender { - NSString *content = sender.stringValue; +- (IBAction)exceptionsUpdate:(NSPlaceHolderTextView *)sender { + NSString *content = sender.string; if ([content writeToFile: kDNSCRYPT_EXCEPTIONS_TMP_FILE atomically: YES encoding: NSUTF8StringEncoding error: nil] != YES) { return; } [self updateExceptions]; } -- (IBAction)helpButtonPressed:(NSButton *)sender { - if (_helpWebView.isHidden) { - [_helpWebView.window makeFirstResponder: nil]; - [_helpWebView setHidden: NO]; - [_helpWebView setAlphaValue: 0.0F]; - [_helpWebView.animator setAlphaValue: 1.0F]; - [_helpWebView setDrawsBackground: TRUE]; - [_viewLogButton setHidden: YES]; - [_queryLoggingButton setHidden: YES]; - } else { - [_helpWebView.window makeFirstResponder: nil]; - [_helpWebView setHidden: YES]; - [_queryLoggingButton setHidden: NO]; +- (IBAction)saveAndApplyChangesButtonPressed:(NSButton *)sender { + [self showSpinners]; + if (blacklistDomainsUpdated) { + [self blacklistDomainsUpdate: _blacklistDomainsTextView]; + } + if (blacklistIPsUpdated) { + [self blacklistIPsUpdate: _blacklistIPsTextView]; + } + if (exceptionsUpdated) { + [self exceptionsUpdate: _exceptionsTextView]; + } + blacklistDomainsUpdated = FALSE; + blacklistIPsUpdated = FALSE; + exceptionsUpdated = FALSE; +} + +-(void)textDidChange:(NSNotification *)notification { + if (notification.object == _blacklistDomainsTextView) { + blacklistDomainsUpdated = TRUE; + } else if (notification.object == _blacklistIPsTextView) { + blacklistIPsUpdated = TRUE; + } else if (notification.object == _exceptionsTextView) { + exceptionsUpdated = TRUE; } } +-(void)helpButtonPressed:(NSButton *)sender { + (void) sender; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: kDNSCRYPT_PROJECT_URL]]; +} + @end diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.h b/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.h new file mode 100644 index 0000000..016b7ff --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.h @@ -0,0 +1,15 @@ +#ifndef NSPlaceHolderTextView_h +#define NSPlaceHolderTextView_h + +#import + +IB_DESIGNABLE +@interface NSPlaceHolderTextView : NSTextView + +@property (nonatomic, retain) IBInspectable NSAttributedString *placeHolder; + +- (void)setPlaceHolderText:(NSString *)txt; + +@end + +#endif /* NSPlaceHolderTextView_h */ diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.m b/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.m new file mode 100644 index 0000000..2d44c18 --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/NSPlaceHolderTextView.m @@ -0,0 +1,33 @@ +#import "NSPlaceHolderTextView.h" + +@implementation NSPlaceHolderTextView + +@synthesize placeHolder = _placeHolder; + +- (void)setPlaceHolderText:(NSString *)txt { + NSColor *txtColor = [NSColor grayColor]; + NSDictionary *txtDict = [NSDictionary dictionaryWithObjectsAndKeys:txtColor, NSForegroundColorAttributeName, nil]; + _placeHolder = [[NSAttributedString alloc] initWithString:txt attributes:txtDict]; +} + +- (BOOL)becomeFirstResponder +{ + [self setNeedsDisplay:YES]; + return [super becomeFirstResponder]; +} + +- (void)drawRect:(NSRect)rect +{ + [super drawRect:rect]; + if ([[self string] isEqualToString:@""] && self != [[self window] firstResponder]) + [_placeHolder drawAtPoint:NSMakePoint(0,0)]; +} + +- (BOOL)resignFirstResponder +{ + [self setNeedsDisplay:YES]; + return [super resignFirstResponder]; +} + + +@end diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/en.lproj/DNSCrypt.xib b/DNSCrypt-Preference-Pane/DNSCrypt/en.lproj/DNSCrypt.xib index c569cc3..96473d8 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/en.lproj/DNSCrypt.xib +++ b/DNSCrypt-Preference-Pane/DNSCrypt/en.lproj/DNSCrypt.xib @@ -12,14 +12,14 @@ - - + + + - - + @@ -106,7 +106,7 @@ - - - - - - - IP addresses (IPv4/IPv6) to block.

208.67.0.255
192.0.43.10 -::1 - - - - NSAllRomanInputSourcesLocaleIdentifier - - - - - - - - - - - - Domain names to block. -
*sex* -ads.* -*.example.com
suspicious.example.net - - - - NSAllRomanInputSourcesLocaleIdentifier - - - - - - - - - - - - - - - NSAllRomanInputSourcesLocaleIdentifier - - - - - - - - + + @@ -303,8 +252,8 @@ ads.* - - + + @@ -312,8 +261,8 @@ ads.* - - + + @@ -321,8 +270,8 @@ ads.* - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + NSAllRomanInputSourcesLocaleIdentifier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NSAllRomanInputSourcesLocaleIdentifier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NSAllRomanInputSourcesLocaleIdentifier + + + + + + + + + + + + + + + + + @@ -399,7 +467,7 @@ ads.* - + diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.haml b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.haml index 66d03b4..56f9c80 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.haml +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.haml @@ -19,22 +19,13 @@ Tips: %ul %li - If you have a firewall, open TCP and UDP ports 53, 54, 443 - and 1053. These are the most common ports used for DNSCrypt. + If you have a firewall, open TCP and UDP ports 53 and 443. + These are the most common ports used for DNSCrypt. %li - The "Automatically disable if blocked" feature automatically disables - DNSCrypt when DNS queries are not able to reach the DNSCrypt - resolver. This can - happen on public WiFi networks that require going through a captive - portal before you can access external networks. - This function is only provided for conveniency. - When enabled, the protocol can be easily downgraded by - third-parties. In other words, when the "Automatically - disable if blocked" feature is enabled, this software doesn't - provide any security at all against active attackers, but it can - still be useful against passive attackers and in order to bypass - DNS censorship. Don't enable it unless you are frequently - roaming and you don't want to manually disable/enable DNSCrypt. + WiFi captive portals dont work if they can't intercept DNS queries + and often block DNSCrypt. + So on public WiFi network, disable DNSCrypt, log in, then you can + enable it again. %li Using Little Snitch? There are a few rules you need to establish, which Little Snitch should prompt for when trying to @@ -43,6 +34,5 @@ %li Allow any outgoing connection for system processes (dnscrypt-proxy) %li Allow any incoming connection for system process (dnscrypt-proxy) %li Allow any outgoing connection for system processes (dig) - %li Allow outgoing TCP connections to port 80 (http) of www.apple.com for system process (curl) %li For automatic updates, allow outgoing TCP connections to port 80 (http) of updates.dnscrypt.org and download.dnscrypt.org, as well as to port 443 (https) of github.com and download.dnscrypt.org for system process (curl) (Thanks to @cavemandaveman and @TraderStf) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.html b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.html index 781e429..fb4d928 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.html +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/about.html @@ -22,23 +22,14 @@ Tips:
  • - If you have a firewall, open TCP and UDP ports 53, 54, 443 - and 1053. These are the most common ports used for DNSCrypt. + If you have a firewall, open TCP and UDP ports 53 and 443. + These are the most common ports used for DNSCrypt.
  • - The "Automatically disable if blocked" feature automatically disables - DNSCrypt when DNS queries are not able to reach the DNSCrypt - resolver. This can - happen on public WiFi networks that require going through a captive - portal before you can access external networks. - This function is only provided for conveniency. - When enabled, the protocol can be easily downgraded by - third-parties. In other words, when the "Automatically - disable if blocked" feature is enabled, this software doesn't - provide any security at all against active attackers, but it can - still be useful against passive attackers and in order to bypass - DNS censorship. Don't enable it unless you are frequently - roaming and you don't want to manually disable/enable DNSCrypt. + WiFi captive portals dont work if they can't intercept DNS queries + and often block DNSCrypt. + So on public WiFi network, disable DNSCrypt, log in, then you can + enable it again.
  • Using Little Snitch? There are a few rules you need to establish, @@ -48,7 +39,6 @@
  • Allow any outgoing connection for system processes (dnscrypt-proxy)
  • Allow any incoming connection for system process (dnscrypt-proxy)
  • Allow any outgoing connection for system processes (dig)
  • -
  • Allow outgoing TCP connections to port 80 (http) of www.apple.com for system process (curl)
  • For automatic updates, allow outgoing TCP connections to port 80 (http) of updates.dnscrypt.org and download.dnscrypt.org, as well as to port 443 (https) of github.com and download.dnscrypt.org for system process (curl)
  • (Thanks to @cavemandaveman and @TraderStf) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.haml b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.haml index e7586d5..7cff991 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.haml +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.haml @@ -35,9 +35,13 @@ %p Checking the "Log DNS queries" box dumps all DNS queries sent by your computer to a file named /var/log/dnscrypt-query.log + %p + Blocked queries can also go to a log file. The file is named + /var/log/dnscrypt-blocked-query.log %p The "View log" button opens it with the log viewer application - so that you can watch it in real time. + so that you can watch it in real time. The other button shows + the blocked queries. %section %h2 IP addresses blocking %p @@ -57,19 +61,16 @@ %p This is a list of domain names to be blocked. %p - "example.com" will only match this specific name, not - "www.example.com". + "example.com" will match "example.com" and "www.example.com". %p - But wildcards are also supported. "*.example.com" will match - any name ending with ".example.com" whereas "ads.*" will match - any name beginning with "ads." + But wildcards are also supported. "ads.*" will match any name + beginning with "ads." %p Wildcards can also perform substring matching. "*xxx*" will match any name containing the string "xxx". %p - Patterns to be blocked should be separated with spaces, and - the blocking takes effect immediately after you hit the Return - key. Flushing your DNS cache is not required. + Patterns to be blocked should be separated with spaces or new + lines. Flushing your DNS cache is not required. %p This feature is only enabled when using DNSCrypt. %section @@ -81,7 +82,7 @@ This includes local domain names provided by home routers (like "routerlogin.net"), local domain names provided by operating systems and applications (like ".local" or ".lan"), - local domain names served by appliances like st-top boxes, and + local domain names served by appliances like set-top boxes, and internal domains used in corporate networks. %p Domains listed here will bypass DNSCrypt in order to be sent diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.html b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.html index 4d1955b..fd71f98 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.html +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/help.html @@ -44,9 +44,14 @@ Checking the "Log DNS queries" box dumps all DNS queries sent by your computer to a file named /var/log/dnscrypt-query.log

    +

    + Blocked queries can also go to a log file. The file is named + +

    The "View log" button opens it with the log viewer application - so that you can watch it in real time. + so that you can watch it in real time. The other button shows + the blocked queries.

    @@ -74,22 +79,19 @@ This is a list of domain names to be blocked.

    - "example.com" will only match this specific name, not - "www.example.com". + "example.com" will match "example.com" and "www.example.com".

    - But wildcards are also supported. "*.example.com" will match - any name ending with ".example.com" whereas "ads.*" will match - any name beginning with "ads." + But wildcards are also supported. "ads.*" will match any name + beginning with "ads."

    Wildcards can also perform substring matching. "*xxx*" will match any name containing the string "xxx".

    - Patterns to be blocked should be separated with spaces, and - the blocking takes effect immediately after you hit the Return - key. Flushing your DNS cache is not required. + Patterns to be blocked should be separated with spaces or new + lines. Flushing your DNS cache is not required.

    This feature is only enabled when using DNSCrypt. @@ -105,7 +107,7 @@ This includes local domain names provided by home routers (like "routerlogin.net"), local domain names provided by operating systems and applications (like ".local" or ".lan"), - local domain names served by appliances like st-top boxes, and + local domain names served by appliances like set-top boxes, and internal domains used in corporate networks.

    diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.haml b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.haml index accd1a2..6ae5f42 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.haml +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.haml @@ -20,6 +20,26 @@ %body %h1 Release Notes for DNSCrypt-OSXclient by AlterStep + %article + %h2 Version 1.0.13 by AlterStep + %time Thu, Feb 09 2017 + %p + No more "automatic fallback". We trust users to know when they + must disable DNSCrypt. + %p + DNS caching for improved speed. + %p + New buttons to log and view blocked queries. + %p + New system to bypass DNSCrypt using dnscrypt-proxy forwarding + module. + %p + Many bug fixes because old code was removed. + %p + dnscrypt-proxy 1.9.0 with support for the new ChaCha20 encryption. + %p + libsodium 1.0.11. + %article %h2 Version 1.0.12 by AlterStep %time Sun, Jul 31 2016 @@ -90,61 +110,3 @@ Updated DNSCrypt proxy to version 1.4.3 %p Updated libsodium to 1.0.1-minimal - - %article - %h2 Version 1.0.4 by AlterStep - %time Thu, 19 Sep 2014 - %p - Updated DNSCrypt proxy to version 1.4.1 - %p - Updated libsodium to 0.7.0-minimal - - %article - %h2 Version 1.0.3 by AlterStep - %time Thu, 18 Jun 2014 - %p - Runs on OSX 10.8 (Mountain Lion), 10.9 (Mavericks) and 10.10 (Yosemite) - %p - New set of icons, contributed by Aaron VonderHaar - - %article - %h2 Version 1.0.2 by AlterStep - %time Thu, 05 Jun 2014 - %p - Improved installation scripts - %p - LDNS has been downgraded in order to work on systems without - Homebrew. - - %article - %h2 Version 1.0.1 by AlterStep - %time Mon, 28 Apr 2014 - %p - Include the release version of dnscrypt-proxy 1.4, with a new - OpenNIC resolver. - %p - Wait after dnscrypt-proxy has been turned on before sending a - query. This actually makes state changes faster. - %p - Debug log, turned off by default and deleted after every - reboot. In order to enable it, create an empty file named - %code debug.enabled - in - %code /Library/Application Support/DNSCrypt/control - and the debug log file itself is - %code /var/log/dnscrypt-osxclient-debug.log - %p - Thanks a lot for your feedback on the first version! - - %article - %h2 Version 1.0.0 by AlterStep - %time Thu, 21 Apr 2014 - %p - This is my first release, based on the source code of the beta - version written by OpenDNS. - %p - It has only been tested on OSX 10.9. - %p - It includes dnscrypt-proxy 1.4.0, libsodium 0.4.5, libldns 1.6.17. - %p - Contact me on Github: https://github.com/alterstep/dnscrypt-osx-client diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.html b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.html index c7fcb99..180a93f 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.html +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/html/releasenotes.html @@ -23,6 +23,33 @@

    Release Notes for DNSCrypt-OSXclient by AlterStep

    +
    +

    Version 1.0.13 by AlterStep

    + +

    + No more "automatic fallback". We trust users to know when they + must disable DNSCrypt. +

    +

    + DNS caching for improved speed. +

    +

    + New buttons to log and view blocked queries. +

    +

    + New system to bypass DNSCrypt using dnscrypt-proxy forwarding + module. +

    +

    + Many bug fixes because old code was removed. +

    +

    + dnscrypt-proxy 1.9.0 with support for the new ChaCha20 encryption. +

    +

    + libsodium 1.0.11. +

    +

    Version 1.0.12 by AlterStep

    @@ -113,77 +140,5 @@ Updated libsodium to 1.0.1-minimal

    -
    -

    Version 1.0.4 by AlterStep

    - -

    - Updated DNSCrypt proxy to version 1.4.1 -

    -

    - Updated libsodium to 0.7.0-minimal -

    -
    -
    -

    Version 1.0.3 by AlterStep

    - -

    - Runs on OSX 10.8 (Mountain Lion), 10.9 (Mavericks) and 10.10 (Yosemite) -

    -

    - New set of icons, contributed by Aaron VonderHaar -

    -
    -
    -

    Version 1.0.2 by AlterStep

    - -

    - Improved installation scripts -

    -

    - LDNS has been downgraded in order to work on systems without - Homebrew. -

    -
    -
    -

    Version 1.0.1 by AlterStep

    - -

    - Include the release version of dnscrypt-proxy 1.4, with a new - OpenNIC resolver. -

    -

    - Wait after dnscrypt-proxy has been turned on before sending a - query. This actually makes state changes faster. -

    -

    - Debug log, turned off by default and deleted after every - reboot. In order to enable it, create an empty file named - debug.enabled - in - /Library/Application Support/DNSCrypt/control - and the debug log file itself is - /var/log/dnscrypt-osxclient-debug.log -

    -

    - Thanks a lot for your feedback on the first version! -

    -
    -
    -

    Version 1.0.0 by AlterStep

    - -

    - This is my first release, based on the source code of the beta - version written by OpenDNS. -

    -

    - It has only been tested on OSX 10.9. -

    -

    - It includes dnscrypt-proxy 1.4.0, libsodium 0.4.5, libldns 1.6.17. -

    -

    - Contact me on Github: https://github.com/alterstep/dnscrypt-osx-client -

    -
    diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/afterboot.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/afterboot.sh index 347efcd..fa4450c 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/afterboot.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/afterboot.sh @@ -2,6 +2,7 @@ . ./common.inc +rm -f "$BLOCKED_QUERY_LOG_FILE" rm -f "$QUERY_LOG_FILE" rm -f "$DEBUG_LOG_FILE" find -x "$RESOLVERS_LIST_STATE" -type f -mtime +1 -exec rm -f {} \; 2>/dev/null diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/common.inc b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/common.inc index 4b1e4a8..59c7263 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/common.inc +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/common.inc @@ -1,5 +1,5 @@ -CURRENT_VERSION=5 +CURRENT_VERSION=6 DNSCRYPT_USR_BASE_DIR='/Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr' DNSCRYPT_VAR_BASE_DIR='/Library/Application Support/DNSCrypt' @@ -19,6 +19,7 @@ DNSCRYPT_FILE="${CONTROL_DIR}/dnscrypt" HANDLERS_LOCK_FILE="${DNSCRYPT_VAR_RUN_BASE_DIR}/dnscrypt-handlers.lock" DNSCRYPT_PROXY_PLUGINS_BASE_FILE="${CONTROL_DIR}/plugin" STATIC_RESOLVERS_FILE="${CONTROL_DIR}/static-resolvers" +BLOCKED_QUERY_LOGGING_FILE="${CONTROL_DIR}/blocked-query-logging" DEBUG_ENABLED_FILE="${CONTROL_DIR}/debug.enabled" @@ -27,7 +28,9 @@ CACHE_FILE="${CONTROL_DIR}/plugin-cache.enabled" QUERY_LOGGING_FILE="${CONTROL_DIR}/plugin-query-logging.enabled" BLOCKING_FILE="${CONTROL_DIR}/plugin-blocking.enabled" AAAA_BLOCKING_FILE="${CONTROL_DIR}/plugin-aaaa-blocking.enabled" +FORWARDING_FILE="${CONTROL_DIR}/plugin-forwarding.enabled" +BLOCKED_QUERY_LOG_FILE="${DNSCRYPT_LOG_BASE_DIR}/dnscrypt-blocked-query.log" QUERY_LOG_FILE="${DNSCRYPT_LOG_BASE_DIR}/dnscrypt-query.log" DEBUG_LOG_FILE="${DNSCRYPT_LOG_BASE_DIR}/dnscrypt-osxclient-debug.log" DEBUG_LOG_FILE_LOCK="${DEBUG_LOG_FILE}.lock" @@ -52,10 +55,6 @@ RESOLVERS_LIST_STATE="${STATES_DIR}/resolvers-updated" INTERFACE_PROXY="127.0.0.54" INTERFACE_PROXY_MASK="24" -DOMAINS_EXCEPTIONS=' -belkin corp domain example home host invalid lan local localdomain test freebox.fr fritz.box nowtv.com routerlogin.net l onion -' - export PATH="${DNSCRYPT_USR_BASE_DIR}/sbin:${DNSCRYPT_USR_BASE_DIR}/bin:${DNSCRYPT_USR_BASE_DIR}/scripts:$PATH" init_interfaces() { diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-add.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-add.sh deleted file mode 100755 index ebc54ce..0000000 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-add.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh - -RESOLVER_DIR='/etc/resolver' - -. ./common.inc - -[ -r "$EXCEPTIONS_FILE" ] && - DOMAINS_EXCEPTIONS="$(cat "$EXCEPTIONS_FILE") $DOMAINS_EXCEPTIONS" - -get_gw() { - route -n get default | while read line; do - case "$line" in - gateway:\ *) - echo "$line" | sed 's/ *gateway: *//' - return - ;; - esac - done -} - -get_dhcp_dns() { - cat "${STATES_DIR}/dhcp-dns" 2> /dev/null -} - -remove_old_exceptions() { - local found - - find -x "$RESOLVER_DIR" -type f -print | { - while read file; do - found='no' - for domain in $DOMAINS_EXCEPTIONS; do - [ "$file" = "${RESOLVER_DIR}/${domain}" ] && found='yes' && break - done - [ "$found" = 'no' ] || continue - fgrep -ci 'automatically generated by the dnscrypt user interface' \ - $file > /dev/null 2>&1 || continue - rm -f "$file" - done - } -} - -name_servers=$(./get-static-resolvers.sh || get_dhcp_dns || get_gw) -[ x"$name_servers" = 'x' ] && exit 0 - -default_domain=$(./get-current-default-domain.sh) - -mkdir -p "$RESOLVER_DIR" || exit 1 - -remove_old_exceptions - -name_server="$gw" -for domain in $DOMAINS_EXCEPTIONS; do - if [ x"$default_domain" != 'x' ]; then - echo "$domain" | grep -c ".*${default_domain}" > /dev/null - [ $? = 0 ] && continue - fi - echo '# automatically generated by the dnscrypt user interface' \ - > "${RESOLVER_DIR}/${domain}" - for name_server in $name_servers; do - echo "nameserver ${name_server}" >> "${RESOLVER_DIR}/${domain}" - done -done -exit 0 diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-remove.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-remove.sh deleted file mode 100755 index cb259d7..0000000 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/exceptions-remove.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh - -RESOLVER_DIR='/etc/resolver' - -. ./common.inc - -[ -r "$EXCEPTIONS_FILE" ] && - DOMAINS_EXCEPTIONS="$(cat "$EXCEPTIONS_FILE") $DOMAINS_EXCEPTIONS" - -for domain in $DOMAINS_EXCEPTIONS; do - rm -f "${RESOLVER_DIR}/${domain}" -done -exit 0 diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-blocked-query-logging-status.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-blocked-query-logging-status.sh new file mode 100755 index 0000000..bd1d1ed --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-blocked-query-logging-status.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +. ./common.inc + +if [ -e "$BLOCKED_QUERY_LOGGING_FILE" ]; then + echo 'yes' +else + echo 'no' +fi diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-dhcp-resolvers.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-dhcp-resolvers.sh index bb2e6bc..623e562 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-dhcp-resolvers.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/get-dhcp-resolvers.sh @@ -2,9 +2,22 @@ . ./common.inc -ifs=$(ifconfig -a | \ - awk '/^[^ :]*:/ { sub(/:.*$/,empty); iface=$0 } /status: active/ { print iface }') -ifs=$(echo $ifs) +get_ifs() { + ifs_save="$IFS" + IFS='' + ifconfig -a | while read line; do + nif=$(echo "$line" | egrep -i '^[^ ]+:\s+flags' | sed 's/:.*$//') + isact=$(echo "$line" | egrep -i 'status:\s*active') + if [ -n "$nif" ]; then + cif="$nif" + elif [ -n "$isact" -a -n "$cif" ]; then + echo $cif + fi + done + IFS="$ifs_save" +} + +ifs=$(get_ifs) typeset -A found ips="" diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/set-static-resolvers.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/set-static-resolvers.sh index 2a79eaa..9c23f9e 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/set-static-resolvers.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/set-static-resolvers.sh @@ -15,3 +15,5 @@ if [ "$servers" = "" ]; then else echo "$servers" | sed 's/^ *//;s/ *$//' > "$STATIC_RESOLVERS_FILE" fi + +exec ./switch-exceptions-on.sh diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-aaaa-blocking-off.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-aaaa-blocking-off.sh index ea946e3..810a3ef 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-aaaa-blocking-off.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-aaaa-blocking-off.sh @@ -3,4 +3,3 @@ . ./common.inc rm -f "$AAAA_BLOCKING_FILE" - diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blacklists-on.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blacklists-on.sh index 875703f..a2ae0c2 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blacklists-on.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blacklists-on.sh @@ -10,6 +10,9 @@ plugin_args='' [ -s "$BLACKLIST_DOMAINS_FILE" ] && \ plugin_args="${plugin_args},--domains='${BLACKLIST_DOMAINS_FILE}'" +[ -e "$BLOCKED_QUERY_LOGGING_FILE" ] && \ + plugin_args="${plugin_args},--logfile='${BLOCKED_QUERY_LOG_FILE}'" + [ -z "$plugin_args" ] && exec ./switch-blacklists-off.sh echo "libdcplugin_example_ldns_blocking.la${plugin_args}" > \ diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-off.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-off.sh new file mode 100755 index 0000000..09784c3 --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-off.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +. ./common.inc + +rm -f "$BLOCKED_QUERY_LOGGING_FILE" + +exec ./switch-blacklists-on.sh + + diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-on.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-on.sh new file mode 100755 index 0000000..1c738d2 --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-blocked-query-logging-on.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +. ./common.inc + +touch "$BLOCKED_QUERY_LOGGING_FILE" + +exec ./switch-blacklists-on.sh diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-off.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-off.sh new file mode 100755 index 0000000..d7b9214 --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-off.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +. ./common.inc + +rm -f "$FORWARDING_FILE" diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-on.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-on.sh new file mode 100755 index 0000000..1e76bef --- /dev/null +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-exceptions-on.sh @@ -0,0 +1,39 @@ +#! /bin/sh + +. ./common.inc + +get_gw() { + route -n get default | while read line; do + case "$line" in + gateway:\ *) + echo "$line" | sed 's/ *gateway: *//' + return + ;; + esac + done +} + +get_dhcp_dns() { + cat "$DHCP_DNS_FILE" 2> /dev/null | egrep -i '^[0-9a-f:.]+$' +} + +[ -s "$EXCEPTIONS_FILE" ] || exec ./switch-exceptions-off.sh + +domains='' +while read domain; do + domains="${domain} ${domains}" +done < "$EXCEPTIONS_FILE" + +[ -z "$domains" ] && exec ./switch-exceptions-off.sh + +resolvers=$(./get-static-resolvers.sh || get_dhcp_dns || get_gw) + +[ -z "$resolvers" ] && exec ./switch-exceptions-off.sh + +plugin_args='' +plugin_args="${plugin_args},--domains='${domains}'" +plugin_args="${plugin_args},--resolvers='${resolvers}'" + +echo "libdcplugin_example_ldns_forwarding.la${plugin_args}" > \ + "$FORWARDING_FILE" +touch "$PLUGINS_ENABLED_FILE" diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-domains.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-domains.sh index abfb10e..e9d0966 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-domains.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-domains.sh @@ -8,8 +8,10 @@ if [ ! -s "$BLACKLIST_DOMAINS_TMP_FILE" ]; then fi tr -s '[:blank:]' '\n' < "$BLACKLIST_DOMAINS_TMP_FILE" | \ - egrep -vi '^(apple[.]com)$' > \ + egrep -i '^[*]?[.]?[^.][a-z0-9_.-]+[*]?$' > \ "${BLACKLIST_DOMAINS_TMP_FILE}~" && mv "${BLACKLIST_DOMAINS_TMP_FILE}~" "$BLACKLIST_DOMAINS_FILE" +rm -f "$BLACKLIST_DOMAINS_TMP_FILE" + exec ./switch-blacklists-on.sh diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-ips.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-ips.sh index e29b57c..d750329 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-ips.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-blacklist-ips.sh @@ -7,8 +7,11 @@ if [ ! -s "$BLACKLIST_IPS_TMP_FILE" ]; then exec ./switch-blacklists-on.sh fi -tr -s '[:blank:]' '\n' \ - < "$BLACKLIST_IPS_TMP_FILE" > "${BLACKLIST_IPS_TMP_FILE}~" && +tr -s '[:blank:]' '\n' < "$BLACKLIST_IPS_TMP_FILE" | \ + egrep -i '^[0-9a-fA-F:.]+$' > \ + "${BLACKLIST_IPS_TMP_FILE}~" && mv "${BLACKLIST_IPS_TMP_FILE}~" "$BLACKLIST_IPS_FILE" +rm -f "$BLACKLIST_IPS_TMP_FILE" + exec ./switch-blacklists-on.sh diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-exceptions.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-exceptions.sh index b83fd56..80c4236 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-exceptions.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/update-exceptions.sh @@ -4,9 +4,14 @@ if [ ! -s "$EXCEPTIONS_TMP_FILE" ]; then rm -f "$EXCEPTIONS_FILE" "$EXCEPTIONS_TMP_FILE" - exit 0 + exec ./switch-exceptions-off.sh fi tr -s '[:blank:]' '\n' < "$EXCEPTIONS_TMP_FILE" | \ + sed -e 's/^ *[*]*[.]*//' -e 's/ *$//' | \ egrep -i '^\s*[0-9a-z_.-]+\s*$' > "${EXCEPTIONS_TMP_FILE}~" && mv "${EXCEPTIONS_TMP_FILE}~" "$EXCEPTIONS_FILE" + +rm -f "$EXCEPTIONS_TMP_FILE" + +exec ./switch-exceptions-on.sh diff --git a/DNSCrypt-Uninstaller/Uninstall.scpt b/DNSCrypt-Uninstaller/Uninstall.scpt index e9e84c5ab9ada3393ebf097ea22e319b402f71d3..d81e3df5585384ff70c78e8b5e9afa0abf30700c 100644 GIT binary patch delta 60 zcmX?RGRbtq31;>U49N^B3<{GOd4wldu{3N>V!6dK*?>c9asrRg<_gXvUfv{z9ENbhGd2m28GFtJi?Q!SQ<7bvD{)|%%5z?p*cB$M`&{eXA