Compare commits

...
11 Commits
20 changed files with 153 additions and 26 deletions
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<string>1.0.1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
@@ -1436,7 +1436,7 @@
<key>USE_HFS+_COMPRESSION</key>
<true/>
<key>VERSION</key>
<string>1.0.0</string>
<string>1.0.1</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
@@ -1929,7 +1929,7 @@
<key>USE_HFS+_COMPRESSION</key>
<true/>
<key>VERSION</key>
<string>1.0.0</string>
<string>1.0.1</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
VERSION='1.0.0'
VERSION='1.0.1'
cd build || exit 1
[ -d DNSCrypt.mpkg ] || exit 1
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<string>1.0.1</string>
<key>NSHumanReadableCopyright</key>
<string>BSD</string>
<key>NSMainNibFile</key>
+1 -1
View File
@@ -3,7 +3,7 @@
#import <WebKit/WebKit.h>
#import "CHCSVParser/CHCSVParser.h"
#define kDNSCRYPT_PACKAGE_VERSION @"1.0.0"
#define kDNSCRYPT_PACKAGE_VERSION @"1.0.1"
#define kDNSCRYPT_PREFPANE_APP_PATH @"/Library/PreferencePanes/DNSCrypt.prefPane"
#define kDNSCRYPT_USR_BASE_DIR kDNSCRYPT_PREFPANE_APP_PATH @"/Contents/Resources/usr"
@@ -22,7 +22,27 @@
%h1 Release Notes for DNSCrypt-OSXclient by AlterStep
%article
%h2 Version 1.0 by AlterStep
%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
@@ -26,7 +26,31 @@
<body>
<h1>Release Notes for DNSCrypt-OSXclient by AlterStep</h1>
<article>
<h2>Version 1.0 by AlterStep</h2>
<h2>Version 1.0.1 by AlterStep</h2>
<time>Mon, 28 Apr 2014</time>
<p>
Include the release version of dnscrypt-proxy 1.4, with a new
OpenNIC resolver.
</p>
<p>
Wait after dnscrypt-proxy has been turned on before sending a
query. This actually makes state changes faster.
</p>
<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</code>
in
<code>/Library/Application Support/DNSCrypt/control</code>
and the debug log file itself is
<code>/var/log/dnscrypt-osxclient-debug.log</code>
</p>
<p>
Thanks a lot for your feedback on the first version!
</p>
</article>
<article>
<h2>Version 1.0.0 by AlterStep</h2>
<time>Thu, 21 Apr 2014</time>
<p>
This is my first release, based on the source code of the beta
@@ -3,6 +3,7 @@
. ./common.inc
rm -f "$QUERY_LOG_FILE"
rm -f "$DEBUG_LOG_FILE"
./clear-fw.sh
@@ -3,8 +3,8 @@
. ./common.inc
try_resolution() {
exec alarmer 5 dig +tries=2 +time=3 +short resolver1.opendns.com \
| egrep '^208[.]67[.]' > /dev/null 2>&1
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() {
@@ -3,8 +3,8 @@
. ./common.inc
try_local_resolution() {
exec dig +tries=2 +time=3 +short resolver1.opendns.com @$INTERFACE_PROXY \
| egrep '^208[.]67[.]' > /dev/null 2>&1
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
@@ -1,27 +1,33 @@
DNSCRYPT_USR_BASE_DIR='/Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr'
DNSCRYPT_VAR_BASE_DIR='/Library/Application Support/DNSCrypt'
DNSCRYPT_LOG_BASE_DIR='/var/log'
DNSCRYPT_VAR_RUN_BASE_DIR='/var/run'
cd -- "${DNSCRYPT_USR_BASE_DIR}/scripts" || exit 1
CONTROL_DIR="${DNSCRYPT_VAR_BASE_DIR}/control"
TICKETS_DIR="${DNSCRYPT_VAR_BASE_DIR}/tickets"
DNSCRYPT_PROXY_BASE_DIR="${DNSCRYPT_VAR_BASE_DIR}/dnscrypt-proxy"
PROXY_PID_FILE="/var/run/dnscrypt-proxy.pid"
PROXY_PID_FILE="${DNSCRYPT_VAR_RUN_BASE_DIR}/dnscrypt-proxy.pid"
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="/var/run/dnscrypt-handlers.lock"
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"
DEBUG_ENABLED_FILE="${CONTROL_DIR}/debug.enabled"
PLUGINS_ENABLED_FILE="${CONTROL_DIR}/plugins.enabled"
QUERY_LOGGING_FILE="${CONTROL_DIR}/plugin-query-logging.enabled"
BLOCKING_FILE="${CONTROL_DIR}/plugin-blocking.enabled"
QUERY_LOG_FILE="/var/log/dnscrypt-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"
BLACKLIST_IPS_FILE="${CONTROL_DIR}/blacklist-ips"
BLACKLIST_IPS_TMP_FILE="${BLACKLIST_IPS_FILE}.tmp"
BLACKLIST_DOMAINS_FILE="${CONTROL_DIR}/blacklist-domains"
@@ -47,7 +53,14 @@ DISABLE_IPV6='no'
export PATH="${DNSCRYPT_USR_BASE_DIR}/bin:${DNSCRYPT_USR_BASE_DIR}/scripts:$PATH"
init_interfaces() {
sudo ifconfig lo0 alias ${INTERFACE_UNBOUND}/${INTERFACE_UNBOUND_MASK}
sudo ifconfig lo0 alias ${INTERFACE_PROXY}/${INTERFACE_PROXY_MASK}
sudo ifconfig lo0 alias ${INTERFACE_PROBES}/${INTERFACE_PROBES_MASK}
/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() {
[ -f "$DEBUG_ENABLED_FILE" ] || return
lockfile -1 -r 1 "$DEBUG_LOG_FILE_LOCK" > /dev/null 2>&1
echo "$(date) - $1" >> "$DEBUG_LOG_FILE"
rm -f "$DEBUG_LOG_FILE_LOCK" 2> /dev/null
}
@@ -3,6 +3,9 @@
. ./common.inc
eval $(stat -s '/dev/console') || exit 1
logger_debug "OSX console ownership changed"
wanted_uid="$st_uid"
if [ ! -d "$DNSCRYPT_VAR_BASE_DIR" ]; then
mkdir -p "$DNSCRYPT_VAR_BASE_DIR" || exit 1
@@ -5,7 +5,7 @@
PROCESSED_TICKETS_FILE="${STATES_DIR}/processed-tickets"
update() {
lockfile -1 -r 30 -l 60 "$HANDLERS_LOCK_FILE" || exit 1
lockfile -1 -r 30 "$HANDLERS_LOCK_FILE" || exit 1
if [ -e "$DNSCRYPT_FILE" ]; then
./switch-to-dnscrypt-if-required.sh
@@ -19,6 +19,8 @@ update() {
touch "${STATES_DIR}/updating"
logger_debug "DNSCrypt-OSXClient configuration changed"
updated='no'
while :; do
find "$TICKETS_DIR" -type f -name 'ticket-*' > "$PROCESSED_TICKETS_FILE"
@@ -10,7 +10,10 @@ if [ x"$1" != 'x--boot' ]; then
./check-network-change.sh || exit 0
fi
lockfile -1 -r 30 -l 60 "$HANDLERS_LOCK_FILE" || exit 1
logger_debug "Network configuration changed"
lockfile -1 -r 30 "$HANDLERS_LOCK_FILE" || exit 1
./set-dns-to-dhcp.sh
if [ ! -e "$DNSCRYPT_FILE" ]; then
rm -f "$HANDLERS_LOCK_FILE"
@@ -4,6 +4,8 @@
servers='empty'
logger_debug "Changing the DNS configuration to use the default DNS resolvers"
if [ -r "$STATIC_RESOLVERS_FILE" ]; then
servers=''
while read server; do
@@ -12,12 +14,16 @@ if [ -r "$STATIC_RESOLVERS_FILE" ]; then
esac
done < "$STATIC_RESOLVERS_FILE"
[ -z "$servers" ] && servers='empty'
logger_debug "Static list of DNS resolvers: [$servers]"
fi
exec networksetup -listallnetworkservices 2>/dev/null | \
fgrep -v '*' | while read x ; do
networksetup -setdnsservers "$x" $servers
done
logger_debug "Flushing the local DNS cache"
dscacheutil -flushcache 2> /dev/null
killall -HUP mDNSResponder 2> /dev/null
exit 0
@@ -5,10 +5,16 @@
servers="$*"
[ $# -lt 1 ] && exit 1
logger_debug "Setting DNS resolvers to [$servers]"
exec networksetup -listallnetworkservices 2>/dev/null | \
fgrep -v '*' | while read x ; do
networksetup -setdnsservers "$x" $servers
done
logger_debug "Flushing local DNS cache"
dscacheutil -flushcache 2> /dev/null
killall -HUP mDNSResponder 2> /dev/null
exit 0
@@ -32,6 +32,7 @@ try_resolver() {
local args="$*"
local pid_file="${PID_DIR}/${priority}.pid"
logger_debug "Running a test dnscrypt proxy for [$description]"
rm -f "${RES_DIR}/${priority}"
exec alarmer 3 dnscrypt-proxy --pid="$pid_file" \
--resolver-name="$RESOLVER_NAME" \
@@ -39,11 +40,13 @@ try_resolver() {
while read line; do
case "$line" in
*Proxying\ from\ *)
logger_debug "Proxy for [$description] is up"
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
@@ -63,6 +66,7 @@ get_plugin_args() {
libdcplugin_*) plugin_args="${plugin_args} --plugin=${line}" ;;
esac
done
logger_debug "Plugins to be used: [$plugin_args]"
echo "$plugin_args"
}
}
@@ -71,8 +75,14 @@ get_plugin_args() {
ipv6_supported="no"
if [ x"$DISABLE_IPV6" = "xno" ]; then
logger_debug "Testing IPv6 connectivity"
ping6 -c 1 2620:0:ccc::2 > /dev/null 2>&1
[ $? = 0 ] && ipv6_supported="yes"
if [ $? = 0 ]; then
ipv6_supported="yes"
logger_debug "IPv6 connectivity detected"
else
logger_debug "IPv6 connectivity is not available"
fi
fi
wait_pids=""
@@ -91,7 +101,10 @@ for pid in $wait_pids; do
[ x"$best_file" != "x" ] && break
done
[ x"$best_file" = "x" ] && exit 1
if [ x"$best_file" = "x" ]; then
logger_debug "No usable proxy configuration has been found"
exit 1
fi
plugins_args=''
if [ -r "${DNSCRYPT_PROXY_PLUGINS_BASE_FILE}s.enabled" ]; then
@@ -102,12 +115,14 @@ fi
best_args=$(cat "${RES_DIR}/${best_file}")
logger_debug "Starting dnscrypt-proxy $best_args"
eval dnscrypt-proxy $best_args --local-address="$INTERFACE_PROXY" \
--resolver-name="$RESOLVER_NAME" \
--pidfile="$PROXY_PID_FILE" --user=daemon --daemonize $plugin_args
if [ $? != 0 ]; then
[ -r "$PROXY_PID_FILE" ] && kill $(cat -- "$PROXY_PID_FILE")
logger_debug "dnscrypt-proxy $best_args command failed, retrying"
sleep 1
killall dnscrypt-proxy
sleep 1
@@ -118,8 +133,11 @@ if [ $? != 0 ]; then
--resolver-name="$RESOLVER_NAME" \
--pidfile="$PROXY_PID_FILE" --user=daemon --daemonize $plugin_args || \
exit 1
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
@@ -128,8 +146,12 @@ while [ $i -lt 30 ]; do
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
@@ -2,12 +2,17 @@
. ./common.inc
logger_debug "Stopping dnscrypt-proxy"
if [ -x /usr/bin/pgrep ]; then
pgrep -x dnscrypt-proxy | egrep '[0-9]+' > /dev/null || exit 0
fi
[ ! -r "$PROXY_PID_FILE" ] && exit 0
pid=$(cat "$PROXY_PID_FILE")
[ $pid -lt 2 ] && exit 0
logger_debug "Trying to stop dnscrypt-proxy by killing pid [$pid]"
kill $pid
i=0
@@ -19,3 +24,5 @@ done
rm -f "$PROXY_PID_FILE"
kill -9 $pid
logger_debug "Killed dnscrypt-proxy with kill -9 pid [$pid]"
@@ -7,6 +7,8 @@ PAUSE_INCREMENT=0.1
[ ! -e "$DNSCRYPT_FILE" ] && exit 0
logger_debug "DNSCrypt has been requested"
./set-dns-to-dhcp.sh
pause=0
@@ -21,7 +23,13 @@ while [ -e "$DNSCRYPT_FILE" ]; do
pause=$((pause + $PAUSE_INCREMENT))
fi
sleep $pause
./check-hijacking.sh || continue
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
./start-dnscrypt-proxy.sh || continue
./check-local-dns.sh || continue
./set-dns.sh "$INTERFACE_PROXY"
+12
View File
@@ -3,3 +3,15 @@ OSX client for managing the DNSCrypt Proxy
The purpose of this application is to allow the user to have a better
experience controlling the DNSCrypt Proxy on OSX.
[Download dnscrypt-osxclient-1.0.0.dmg](https://github.com/alterstep/dnscrypt-osxclient/releases/download/1.0.0/dnscrypt-osxclient-1.0.0.dmg)
for OSX 10.9 (Mavericks).
Compatible with:
* CloudNS
* d0wn
* DNSCrypt.eu
* okTurtles
* OpenDNS
* OpenNIC
* Soltysiak