Goodbye fallback!
This commit is contained in:
@@ -38,7 +38,6 @@ typedef enum {
|
||||
NSTabViewItem *_releaseNotesTabViewItem;
|
||||
|
||||
NSButton *_dnscryptButton;
|
||||
NSButton *_fallbackButton;
|
||||
NSButton *_disableIPv6Button;
|
||||
|
||||
NSTextField *_currentResolverTextField;
|
||||
@@ -60,7 +59,6 @@ typedef enum {
|
||||
@property (nonatomic, strong) IBOutlet NSTabViewItem *releaseNotesTabViewItem;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet NSButton *dnscryptButton;
|
||||
@property (nonatomic, strong) IBOutlet NSButton *fallbackButton;
|
||||
@property (nonatomic, strong) IBOutlet NSButton *disableIPv6Button;
|
||||
|
||||
@property (nonatomic, strong) IBOutlet NSTextField *currentResolverTextField;
|
||||
@@ -86,7 +84,6 @@ typedef enum {
|
||||
- (void) mainViewDidLoad;
|
||||
|
||||
- (IBAction)dnscryptButtonPressed:(NSButton *)sender;
|
||||
- (IBAction)fallbackButtonPressed:(NSButton *)sender;
|
||||
- (IBAction)disableIPv6ButtonPressed:(NSButton *)sender;
|
||||
|
||||
- (IBAction)providerLinkPushed:(NSButton *)sender;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
@synthesize queryLoggingButton = _queryLoggingButton;
|
||||
@synthesize exceptionsTextField = _exceptionsTextField;
|
||||
@synthesize dnscryptButton = _dnscryptButton;
|
||||
@synthesize fallbackButton = _fallbackButton;
|
||||
@synthesize disableIPv6Button = _disableIPv6Button;
|
||||
@synthesize statusImageView = _statusImageView;
|
||||
@synthesize statusText = _statusText;
|
||||
@@ -28,7 +27,6 @@ NSArray *resolversList;
|
||||
- (void) setCheckBoxesEnabled: (BOOL) enabled
|
||||
{
|
||||
[_dnscryptButton setEnabled: enabled];
|
||||
[_fallbackButton setEnabled: enabled];
|
||||
[_disableIPv6Button setEnabled: enabled];
|
||||
[_resolverNamesButton setEnabled: enabled];
|
||||
}
|
||||
@@ -57,17 +55,12 @@ NSArray *resolversList;
|
||||
NSString *res;
|
||||
|
||||
_dnscryptButton.state = 0;
|
||||
_fallbackButton.state = 0;
|
||||
_disableIPv6Button.state = 0;
|
||||
|
||||
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];
|
||||
}
|
||||
res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && exec ./get-fallback-status.sh", nil]];
|
||||
if ([res isEqualToString: @"yes"]) {
|
||||
[_fallbackButton setState: 1];
|
||||
}
|
||||
res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && exec ./get-aaaa-blocking-status.sh", nil]];
|
||||
if ([res isEqualToString: @"yes"]) {
|
||||
[_disableIPv6Button setState: 1];
|
||||
@@ -196,20 +189,6 @@ NSArray *resolversList;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
- (BOOL) setFallbackOn {
|
||||
[self showSpinners];
|
||||
NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./switch-fallback-on.sh", nil]];
|
||||
(void) res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
- (BOOL) setFallbackOff {
|
||||
[self showSpinners];
|
||||
NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./switch-fallback-off.sh", nil]];
|
||||
(void) res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
- (BOOL) setDisableIPv6On {
|
||||
[self showSpinners];
|
||||
NSString *res = [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-f", @"-c", @"cd '" kDNSCRYPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./switch-aaaa-blocking-on.sh", nil]];
|
||||
@@ -233,15 +212,6 @@ NSArray *resolversList;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)fallbackButtonPressed:(NSButton *)sender
|
||||
{
|
||||
if (sender.state != 0) {
|
||||
[self setFallbackOn];
|
||||
} else {
|
||||
[self setFallbackOff];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)disableIPv6ButtonPressed:(NSButton *)sender
|
||||
{
|
||||
if (sender.state != 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16D17a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16E144f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment version="1070" identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
||||
@@ -14,11 +14,11 @@
|
||||
<outlet property="aboutWebView" destination="358" id="359"/>
|
||||
<outlet property="blacklistDomainsTextField" destination="404" id="446"/>
|
||||
<outlet property="blacklistIPsTextField" destination="402" id="444"/>
|
||||
<outlet property="currentResolverTextField" destination="Laq-Rf-7ph" id="IoP-Tf-apC"/>
|
||||
<outlet property="descriptionText" destination="2aF-7O-SkX" id="nM9-H2-22g"/>
|
||||
<outlet property="disableIPv6Button" destination="ESJ-Kf-yNj" id="xFL-L3-vLp"/>
|
||||
<outlet property="dnscryptButton" destination="179" id="363"/>
|
||||
<outlet property="exceptionsTextField" destination="406" id="452"/>
|
||||
<outlet property="fallbackButton" destination="281" id="365"/>
|
||||
<outlet property="helpWebView" destination="449" id="450"/>
|
||||
<outlet property="locationText" destination="e9H-pq-zb6" id="Elc-qh-Z8b"/>
|
||||
<outlet property="providerLink" destination="323" id="Riq-Cc-CLa"/>
|
||||
@@ -55,7 +55,7 @@
|
||||
<rect key="frame" x="10" y="33" width="543" height="313"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button toolTip="Use OpenDNS resolvers with the DNSCrypt protocol" id="179">
|
||||
<button toolTip="Use the DNSCrypt protocol" id="179">
|
||||
<rect key="frame" x="15" y="234" width="204" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Enable DNSCrypt" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="180">
|
||||
@@ -67,28 +67,6 @@
|
||||
<action selector="dnscryptButtonPressed:" target="-2" id="368"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button id="281">
|
||||
<rect key="frame" x="15" y="164" width="239" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<string key="toolTip">Only check this box if you often have to connect to public WiFi hotspots and you don't want to manually disable DNSCrypt in order to pass a captive portal.</string>
|
||||
<buttonCell key="cell" type="check" title="Automatically disable if blocked" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="282">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system" size="14"/>
|
||||
</buttonCell>
|
||||
<accessibility description="Fallback to insecure DNS"/>
|
||||
<connections>
|
||||
<action selector="fallbackButtonPressed:" target="-2" id="372"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="162">
|
||||
<rect key="frame" x="14" y="96" width="173" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Current DNS settings:" id="163">
|
||||
<font key="font" metaFont="system" size="16"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="Wkj-kT-maK">
|
||||
<rect key="frame" x="278" y="208" width="70" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
@@ -168,8 +146,17 @@
|
||||
<action selector="resolversNamesPopupButtonPressed:" target="-2" id="fEP-TP-PCO"/>
|
||||
</connections>
|
||||
</popUpButton>
|
||||
<button toolTip="Do not try to resolve IPv6 records" id="ESJ-Kf-yNj">
|
||||
<rect key="frame" x="15" y="133" width="252" height="18"/>
|
||||
<textField verticalHuggingPriority="750" id="e9H-pq-zb6">
|
||||
<rect key="frame" x="278" y="182" width="267" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" placeholderString="-" id="q83-P7-DNW">
|
||||
<font key="font" size="12" name="Monaco"/>
|
||||
<color key="textColor" white="0.2046370968" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button toolTip="Do not try to resolve IPv6 records" misplaced="YES" id="ESJ-Kf-yNj">
|
||||
<rect key="frame" x="15" y="155" width="252" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Disable IPv6 to reduce IPv4 latency" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="cCj-X4-U6n">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -180,23 +167,25 @@
|
||||
<action selector="disableIPv6ButtonPressed:" target="-2" id="s7R-gl-0Fy"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="e9H-pq-zb6">
|
||||
<rect key="frame" x="278" y="182" width="267" height="27"/>
|
||||
<textField verticalHuggingPriority="750" misplaced="YES" id="162">
|
||||
<rect key="frame" x="15" y="93" width="173" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="left" placeholderString="-" id="q83-P7-DNW">
|
||||
<font key="font" size="12" name="Monaco"/>
|
||||
<color key="textColor" white="0.2046370968" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Current DNS settings:" id="163">
|
||||
<font key="font" metaFont="system" size="16"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" misplaced="YES" id="9Hy-oV-v7u">
|
||||
<rect key="frame" x="77" y="31" width="81" height="32"/>
|
||||
<textField identifier="currentResolver" verticalHuggingPriority="750" misplaced="YES" id="Laq-Rf-7ph">
|
||||
<rect key="frame" x="7" y="17" width="261" height="68"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="bOq-DG-Q4a">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" placeholderString="" id="EEK-vb-MH8">
|
||||
<font key="font" size="14" name="Monaco"/>
|
||||
<color key="textColor" white="0.2046370968" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<accessibility description="Current resolver IP addresses"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
</view>
|
||||
</tabViewItem>
|
||||
@@ -410,6 +399,7 @@ ads.*
|
||||
</tabView>
|
||||
</subviews>
|
||||
</view>
|
||||
<point key="canvasLocation" x="138.5" y="161.5"/>
|
||||
</window>
|
||||
<customObject id="263"/>
|
||||
</objects>
|
||||
|
||||
Binary file not shown.
@@ -1,35 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
try_resolution() {
|
||||
exec alarmer 5 dig +tries=2 +time=3 +short google-public-dns-a.google.com \
|
||||
| egrep '^8[.]8[.]8[.]8' > /dev/null 2>&1
|
||||
}
|
||||
|
||||
try_http_query() {
|
||||
exec alarmer 5 curl -L --max-redirs 5 -4 -m 5 --connect-timeout 5 -s \
|
||||
http://www.apple.com 2>/dev/null | \
|
||||
fgrep -c Apple > /dev/null 2>&1
|
||||
}
|
||||
|
||||
try_everything() {
|
||||
try_resolution &
|
||||
resolution_pid=$!
|
||||
try_http_query &
|
||||
http_query_pid=$!
|
||||
wait $resolution_pid
|
||||
resolution_ret=$?
|
||||
if [ $resolution_ret != 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
wait $http_query_pid
|
||||
http_query_ret=$?
|
||||
[ $resolution_ret = 0 -a $http_query_ret = 0 ]
|
||||
}
|
||||
|
||||
try_everything_with_retries() {
|
||||
try_everything || try_everything
|
||||
}
|
||||
|
||||
try_everything_with_retries
|
||||
@@ -1,10 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
try_local_resolution() {
|
||||
exec dig +tries=2 +time=3 +short google-public-dns-a.google.com @$INTERFACE_PROXY \
|
||||
| egrep '^8[.]8[.]8[.]8' > /dev/null 2>&1
|
||||
}
|
||||
|
||||
try_local_resolution
|
||||
@@ -16,7 +16,6 @@ STATES_DIR="${DNSCRYPT_VAR_BASE_DIR}/states"
|
||||
|
||||
DNSCRYPT_RESOLVER_NAME_FILE="${CONTROL_DIR}/dnscrypt-resolver-name"
|
||||
DNSCRYPT_FILE="${CONTROL_DIR}/dnscrypt"
|
||||
FALLBACK_FILE="${CONTROL_DIR}/fallback"
|
||||
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"
|
||||
@@ -24,6 +23,7 @@ STATIC_RESOLVERS_FILE="${CONTROL_DIR}/static-resolvers"
|
||||
DEBUG_ENABLED_FILE="${CONTROL_DIR}/debug.enabled"
|
||||
|
||||
PLUGINS_ENABLED_FILE="${CONTROL_DIR}/plugins.enabled"
|
||||
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"
|
||||
@@ -49,12 +49,8 @@ RESOLVERS_LIST_BASE_DIR="${DNSCRYPT_USR_BASE_DIR}/share/dnscrypt-proxy"
|
||||
RESOLVERS_LIST_PUBLIC_KEY="RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3"
|
||||
RESOLVERS_LIST_STATE="${STATES_DIR}/resolvers-updated"
|
||||
|
||||
INTERFACE_UNBOUND="127.0.0.53"
|
||||
INTERFACE_UNBOUND_MASK="24"
|
||||
INTERFACE_PROXY="127.0.0.54"
|
||||
INTERFACE_PROXY_MASK="24"
|
||||
INTERFACE_PROBES="127.0.0.55"
|
||||
INTERFACE_PROBES_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
|
||||
@@ -63,9 +59,7 @@ belkin corp domain example home host invalid lan local localdomain test freebox.
|
||||
export PATH="${DNSCRYPT_USR_BASE_DIR}/sbin:${DNSCRYPT_USR_BASE_DIR}/bin:${DNSCRYPT_USR_BASE_DIR}/scripts:$PATH"
|
||||
|
||||
init_interfaces() {
|
||||
/sbin/ifconfig lo0 alias ${INTERFACE_UNBOUND}/${INTERFACE_UNBOUND_MASK}
|
||||
/sbin/ifconfig lo0 alias ${INTERFACE_PROXY}/${INTERFACE_PROXY_MASK}
|
||||
/sbin/ifconfig lo0 alias ${INTERFACE_PROBES}/${INTERFACE_PROBES_MASK}
|
||||
}
|
||||
|
||||
logger_debug() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. ./common.inc
|
||||
|
||||
ifs=$(ifconfig -a | \
|
||||
awk '/^[^ :]*:/ { sub(/:.*$/,empty); iface=$0 } /status: active/ { print iface }')
|
||||
awk '/^[^ :]*:/ { sub(/:.*$/,empty); iface=$0 } /status: active/ { print iface }')
|
||||
ifs=$(echo $ifs)
|
||||
|
||||
typeset -A found
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
if [ -e "$FALLBACK_FILE" ]; then
|
||||
echo 'yes'
|
||||
else
|
||||
echo 'no'
|
||||
fi
|
||||
@@ -19,7 +19,7 @@ done
|
||||
|
||||
if [ "$dnscrypt_proxy_used" = 'yes' \
|
||||
-a -r "${STATES_DIR}/dnscrypt-proxy-description" ]; then
|
||||
cat "${STATES_DIR}/dnscrypt-proxy-description" && exit 0
|
||||
cat "${STATES_DIR}/dnscrypt-proxy-description" && exit 0
|
||||
fi
|
||||
echo "$upstream_resolvers"
|
||||
exit 0
|
||||
|
||||
@@ -28,3 +28,5 @@ fi
|
||||
|
||||
[ x"$current_uid" != x"$wanted_uid" ] && \
|
||||
chown -R "${wanted_uid}:0" "$CONTROL_DIR"
|
||||
|
||||
exec sleep 1
|
||||
|
||||
@@ -6,13 +6,11 @@ tickets_count=$(./get-tickets-count.sh)
|
||||
[ "$tickets_count" != '0' ] && exit 0
|
||||
|
||||
if [ x"$1" != 'x--boot' ]; then
|
||||
[ ! -e "$FALLBACK_FILE" ] && exit 0
|
||||
./check-network-change.sh || exit 0
|
||||
fi
|
||||
|
||||
logger_debug "Network configuration changed"
|
||||
|
||||
|
||||
lockfile -1 -r 30 "$HANDLERS_LOCK_FILE" || exit 1
|
||||
./set-dns-to-dhcp.sh
|
||||
if [ ! -e "$DNSCRYPT_FILE" ]; then
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
. ./common.inc
|
||||
|
||||
CERTIFICATE_MIN_VALIDITY=60
|
||||
|
||||
DNSCRYPT_LIB_BASE_DIR="${DNSCRYPT_USR_BASE_DIR}/lib"
|
||||
export DYLD_LIBRARY_PATH="${DNSCRYPT_LIB_BASE_DIR}:${DYLD_LIBRARY_PATH}"
|
||||
|
||||
@@ -34,32 +36,15 @@ try_resolver() {
|
||||
|
||||
logger_debug "Running a test dnscrypt proxy for [$description]"
|
||||
rm -f "${RES_DIR}/${priority}"
|
||||
exec alarmer 3 dnscrypt-proxy --pid="$pid_file" \
|
||||
alarmer 3 dnscrypt-proxy --pid="$pid_file" \
|
||||
--resolver-name="$RESOLVER_NAME" \
|
||||
--local-address="${INTERFACE_PROBES}:${priority}" $args 2>&1 | \
|
||||
while read line; do
|
||||
case "$line" in
|
||||
*Proxying\ from\ *)
|
||||
logger_debug "Proxy for [$description] is up"
|
||||
|
||||
# This doesn't send anything to Apple, and any reliable domain name can be used --
|
||||
# The following line sends a common query to the chosen DNSCrypt resolver to
|
||||
# check that it responds and can be used instead of leaving the mac without
|
||||
# a working DNS configuration.
|
||||
answers=$(exec dig +time=1 +short +tries=2 -p $priority \
|
||||
@"$INTERFACE_PROBES" www.apple.com. 2> /dev/null | \
|
||||
egrep -ic '^[0-9.:]+$')
|
||||
|
||||
[ -r "$pid_file" ] && kill $(cat -- "$pid_file")
|
||||
if [ $answers -gt 0 ]; then
|
||||
logger_debug "Proxy for [$description] can be used"
|
||||
echo "$args" > "${RES_DIR}/${priority}"
|
||||
echo "$description" > "${DESCRIPTIONS_DIR}/${priority}"
|
||||
fi
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
--test="$CERTIFICATE_MIN_VALIDITY" $args
|
||||
if [ $? = 0 ]; then
|
||||
logger_debug "Certificate for [$description] received"
|
||||
echo "$args" > "${RES_DIR}/${priority}"
|
||||
echo "$description" > "${DESCRIPTIONS_DIR}/${priority}"
|
||||
fi
|
||||
rm -f "$pid_file"
|
||||
}
|
||||
|
||||
get_plugin_args() {
|
||||
@@ -82,11 +67,11 @@ logger_debug "dnscrypt-proxy should be (re)started, stopping previous instance i
|
||||
|
||||
wait_pids=""
|
||||
|
||||
try_resolver 5004 "${RESOLVER_NAME} using DNSCrypt over UDP" \
|
||||
try_resolver 1 "${RESOLVER_NAME} using DNSCrypt over UDP" \
|
||||
"--resolver-name=$RESOLVER_NAME" &
|
||||
wait_pids="$wait_pids $!"
|
||||
|
||||
try_resolver 5005 "${RESOLVER_NAME} using DNSCrypt over TCP" \
|
||||
try_resolver 2 "${RESOLVER_NAME} using DNSCrypt over TCP" \
|
||||
"--resolver-name=$RESOLVER_NAME --tcp-only" &
|
||||
wait_pids="$wait_pids $!"
|
||||
|
||||
@@ -105,6 +90,8 @@ if [ x"$best_file" = "x" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./switch-cache-on.sh
|
||||
|
||||
plugins_args=''
|
||||
if [ -r "${DNSCRYPT_PROXY_PLUGINS_BASE_FILE}s.enabled" ]; then
|
||||
plugin_args=$(get_plugin_args)
|
||||
@@ -133,23 +120,6 @@ if [ $? != 0 ]; then
|
||||
logger_debug "dnscrypt-proxy $best_args worked after a retry"
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
logger_debug "Checking if the current configuration hijacks all DNS queries"
|
||||
i=0
|
||||
while [ $i -lt 30 ]; do
|
||||
./check-local-dns.sh && break
|
||||
sleep 0.1
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
if [ $i -ge 30 ]; then
|
||||
logger_debug "Current configuration hijacks all DNS queries, disabling DNSCrypt"
|
||||
./switch-to-dhcp.sh
|
||||
exit 1
|
||||
fi
|
||||
|
||||
logger_debug "Current configuration doesn't seem to hijack all DNS queries"
|
||||
|
||||
mv "${DESCRIPTIONS_DIR}/${best_file}" \
|
||||
"${STATES_DIR}/dnscrypt-proxy-description" 2>/dev/null || exit 0
|
||||
|
||||
|
||||
@@ -14,4 +14,4 @@ plugin_args=''
|
||||
|
||||
echo "libdcplugin_example_ldns_blocking.la${plugin_args}" > \
|
||||
"$BLOCKING_FILE"
|
||||
touch "$PLUGINS_ENABLED_FILE"
|
||||
touch "$PLUGINS_ENABLED_FILE"
|
||||
|
||||
+2
-1
@@ -2,4 +2,5 @@
|
||||
|
||||
. ./common.inc
|
||||
|
||||
touch "$FALLBACK_FILE"
|
||||
rm -f "$CACHE_FILE"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
echo "libdcplugin_example_cache.la" > \
|
||||
"$CACHE_FILE"
|
||||
|
||||
touch "$PLUGINS_ENABLED_FILE"
|
||||
@@ -1,5 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
. ./common.inc
|
||||
|
||||
rm -f "$FALLBACK_FILE"
|
||||
+2
-19
@@ -10,8 +10,6 @@ PAUSE_INCREMENT=1
|
||||
|
||||
logger_debug "DNSCrypt has been requested"
|
||||
|
||||
./set-dns-to-dhcp.sh
|
||||
|
||||
pause=0
|
||||
while [ -e "$DNSCRYPT_FILE" ]; do
|
||||
logger_debug "Switching to dnscrypt if required (pause=$pause)"
|
||||
@@ -22,41 +20,26 @@ while [ -e "$DNSCRYPT_FILE" ]; do
|
||||
./switch-to-dhcp.sh
|
||||
fi
|
||||
fi
|
||||
[ $pause -lt $PAUSE_MAX ] && pause=$((pause + 1))
|
||||
pause_counter=0
|
||||
while [ -e "$DNSCRYPT_FILE" -a $pause_counter -lt $pause ]; do
|
||||
sleep $PAUSE_UNIT
|
||||
pause_counter=$((pause_counter + 1))
|
||||
done
|
||||
[ $pause -lt $PAUSE_MAX ] && pause=$((pause + 1))
|
||||
[ ! -e "$DNSCRYPT_FILE" ] && break
|
||||
if [ -e "$FALLBACK_FILE" ]; then
|
||||
logger_debug "Checking if the router hijacks HTTP queries"
|
||||
if ./check-hijacking.sh; then
|
||||
logger_debug "The router doesn't hijack HTTP queries"
|
||||
else
|
||||
logger_debug "The router hijacks HTTP queries - DNSCrypt is likely to be blocked"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
./start-dnscrypt-proxy.sh || continue
|
||||
./check-local-dns.sh || continue
|
||||
./set-dns.sh "$INTERFACE_PROXY"
|
||||
if [ $? != 0 ]; then
|
||||
logger_debug "Setting the DNS to [$INTERFACE_PROXY] didn't work"
|
||||
./set-dns-to-dhcp.sh
|
||||
continue
|
||||
fi
|
||||
./check-hijacking.sh
|
||||
if [ $? != 0 ]; then
|
||||
logger_debug "Current configuration seems to be hijacking HTTP queries. Reverting to default resolvers."
|
||||
./set-dns-to-dhcp.sh
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
if [ ! -e "$DNSCRYPT_FILE" ]; then
|
||||
touch "$CONTROL_DIR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec ./exceptions-add.sh
|
||||
|
||||
@@ -7,7 +7,7 @@ cp /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/bin/hostip
|
||||
mkdir -p extra/usr/sbin
|
||||
cp /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/sbin/dnscrypt-proxy \
|
||||
extra/usr/sbin/
|
||||
|
||||
|
||||
mkdir -p extra/usr/lib
|
||||
|
||||
cp /opt/ldns/lib/libldns.1.dylib \
|
||||
@@ -19,6 +19,7 @@ cp /opt/ldns/lib/libldns.1.dylib \
|
||||
if [ -f /usr/local/lib/libsodium.18.dylib ]; then
|
||||
echo '*** /usr/local/lib/libsodium.{dylib,la} found'
|
||||
echo '*** Compile dnscrypt-proxy without them to get a static build'
|
||||
echo '*** Then reinstall them'
|
||||
sleep 10
|
||||
fi
|
||||
|
||||
@@ -37,6 +38,6 @@ mkdir -p extra/usr/share/dnscrypt-proxy
|
||||
|
||||
cp /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv \
|
||||
extra/usr/share/dnscrypt-proxy/
|
||||
|
||||
|
||||
cp /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/share/dnscrypt-proxy/minisign.pub \
|
||||
extra/usr/share/dnscrypt-proxy/
|
||||
|
||||
Reference in New Issue
Block a user