The Problem
When an application connects to a server on the Internet, it needs to resolve
hostnames (i.e., www.antagonism.org) to IP addresses. To do this, the
application sends the hostname to a DNS server for resolution. The DNS server
sends the IP address for the hostname back to the application. This is normal
business and is good for every day use. However, it is bad for business when
you wish to conduct anonymous connections.
Let's examine an example of why DNS leaks are bad for anonymous connections.
Let's say you exist in an oppressive regime and wish to browse a web site on
the rergime's forbidden list. Your computer needs to resolve the hostname for
forbidden web site, so it sends a request to its DNS resolver. The regime true
to its repressive nature is monitoring the DNS servers for requests for
forbidden sites. It correlates the request for the banned site with your IP
address and stops by to arrest you for violating the law even though you made
the connection using an anonymizing tool, such as
Tor
.
Solutions
There are a couple of solutions to the issue of DNS leaks. The most common
is the use of a SOCKS proxy. The second solution is to send your DNS requests
through the Tor network. Due the possiblity of applications either not
supporting SOCKS or implementing it poorly, I highly recommend you employ both
solutions.
SOCKS proxy
A SOCKS
proxy operates as
a transparent proxy to allow client-server applications to reach resources
which may not be accessible otherwise. The Tor application provides a SOCKS
proxy (listening by default on localhost:9050) to allow applications which
support SOCKS to access the Tor network.
When using SOCKS 4a, you are able to provide hostnames, which Tor will
resolve through the Tor network. Thus, your DNS requests are anonymized and
the problem mentioned above is avoided. To allow those applications which
support SOCKS to access TOR, one simply needs to configure the application to
use the SOCKS proxy which the Tor application runs or a HTTP proxy which
supports SOCKS (i.e. privoxy
or polipo
). The
following
page
covers how to configure many applications with Tor in order to prevent
DNS leaks.
Sending DNS requests through Tor
There are several problems which exist with the above solution. First, not
all applications support SOCKS. This means you can not anonymize their DNS
requests with the above method. Second, even though an application claims to
support SOCKS, it may implement it incorrectly and still leak DNS requests.
This
page
details how to determine if your application using SOCKS still leaks
DNS requests. Lastly, the above method requires you to hand configure each and
every application. While this may be a viable solution for a handful of
machines, as the number of machines grows larger, the solution becomes more
unwieldly.
Transparently proxying DNS requests will resolve the problems mentioned with
the previous solutions. It will handle DNS requests for applications which
either do not support SOCKS or implement it poorly and since it transparently
proxies the requests, you do not have to configure each individual machine.
There are two methods to do this. The first is to use your firewall software
(iptables, pf) to redirect DNS requests from your network to dns-proxy-tor
(note the previous link
is only accessible through Tor). The second method is to use the your firewall
software to redirect DNS requests from your network to the DNSPort of a server
running Tor version 0.2.0.1-alpha or later. Since the 0.2.x series is still
not considered stable, this example will cover the former.
Assumptions
For purposes of this example, the following assumptions are in effect:
- The router's internal IP address is 192.168.1.1.
- The internal network is 192.168.1.0/24.
- Tor runs on the router.
- The router's internal interface is eth0.
- TOr's data directory is /var/lib/tor and owned by tor.tor.
- The UID of the Tor user is 100.
Installing dns-proxy-tor
In the Tor 0.1.x series, we need a proxy server to handle DNS requests which
we wish to remain anonymous. dns-proxy-tor
is just such a proxy
server. With Tor 0.2.x, such a proxy server is not needed. This
page
covers how to make DNS requests anonymous with Tor 0.2.x. Below are
instructions on how to install dns-proxy-tor
.
% wget -c http://p56soo2ibjkx23xo.onion/trans-proxy-tor-0.1.0.tar.gz
% tar zxvf trans-proxy-tor-0.1.0.tar.gz
% cd trans-proxy-tor-0.1.0
% sudo cp dns-proxy-tor /usr/local/bin/dns-proxy-tor
% sudo chmod 755 /usr/local/bin/dns-proxy-tor
% sudo chown root.root /usr/local/bin/dns-proxy-tor
Router Configuration
The router will need the changes below added to its torrc
file.
With these changes made, the router will be able to capture DNS traffic sent
through it, redirect it to dns-proxy-tor
and from there send the DNS
request through the Tor network.
VirtualAddrNetwork 10.192.0.0/10
ControlPort 9051
CookieAuthentication 1
TransPort 9040
TransListenAddress 127.0.0.1
TransListenAddress 192.168.1.1
Before you make these changes to torrc, be sure you understand what the
options do. The torrc options configured above do the following:
- "VirtualAddrNetwork 10.192.0.0/10" sets the virtual (unused) address space
to 10.192.0.0/10. This means when the controller asks for a virtual address
with the MAPADDRESS command, Tor will provide an address from this range. When
using dns-proxy-tor
to provide a proxy service for the network, this
needs to be set to either the above or "172.16.0.0/12".
- "ControlPort 9051" set the control port to 9051 on the localhost. This port
allows process to control Tor using the Tor Control Protocol.
- "CookieAuthentication 1" prevents any connections to the control port which
do not know the contents of the "control_auth_cookie" file located in Tor's data
directory.
- "TransPort 9040" sets the transparent proxy port to 9040.
- "TransListenAddress 127.0.0.1" and "TransListenAddress 192.168.1.1" has the
transparent proxy listen at the following addresses on the port specified by
"TransPort".
The Tor manual
covers these options and many more. On making these additions to torrc, you
need to restart Tor. The below example demonstrates how to restart Tor for
RedHat systems.
% sudo /sbin/service tor restart
Once you have Tor configured, you need to start dns-proxy-tor
. The
example below demonstrates how to start dns-proxy-tor
.
# dns-proxy-tor -b 192.1681.1.1:53 -t 127.0.0.1:9051 -s 127.0.0.1:9050 \
-c /var/lib/tor -k /var/lib/tor -u tor:tor -p /var/run/dns-proxy-tor.pid
Before starting dns-proxy-tor
, make sure you understand what the
command does. The dns-proxy-tor
options configured above do the
following:
- "-b 192.168.1.1:53" binds dns-proxy-tor to 192.168.1.1 on port 53. If the
port is less than 1024, the command must be run as root.
- "-t 127.0.0.1:9051" has dns-proxy-tor send "MAPADDRESS" Tor controller
commands to Tor on localhost, port 9051. This address/port combination should
match the address/port combination specified by the "ControlPort" option in the
torrc.
- "-s 127.0.0.1:9050" has dns-proxy-tor send SOCKS resolve requests to Tor on
localhost, port 9050. This address/port combination should match the
address/port combination specified by the "SocksPort" or "SocksListenAddress"
options.
- "-c /var/lib/tor" changes the root directory to "/var/lib/tor". This option
is only available when run as the root user.
- "-k /var/lib/tor" tells dns-proxy-tor to authenticate to the Tor control
port with the "control_auth_cookie" file located in Tor's data directory,
"/var/lib/tor". In order to use this option, the "CookieAuthentication" option
must be set in torrc.
- "-u tor:tor" tells dns-proxy-tor to drop privileges to the user, "tor" and
group, "tor". This option is only available when run as the root user. The
user/group should be the same as the user/group which runs Tor. This will
allow dns-proxy-tor access to the directories specified by the "-c" and "-k"
options.
- "-p /var/run/dns-proxy-tor.pid" writes the PID to the file,
"/var/run/dns-proxy-tor.pid".
These options and more may be accessed by reading the Perl documentation
associated with dns-proxy-tor
. This documentation may be read by
running the following commands.
% perldoc /usr/local/bin/dns-proxy-tor
Below is an example of an iptables script which would handle the redirection
of DNS packets sent to external networks to dns-proxy-tor
. Note
Do not implement this directly on your router unless you understand completely
what the commands do. I am not responsible for mistakes which you make on your
system by blinding implementing this script.
<!-- end /tail.shtml -->
分享到:
相关推荐
这篇PPT课件是针对八年级英语教学的内容,主题为“应对困难”(Dealing with trouble)。通过一系列的填空练习和情景模拟,旨在帮助学生掌握如何在不同情况下正确处理问题,尤其是面对紧急情况时的应对策略。以下是...
在进行数据包络分析(Data Envelopment Analysis, DEA)研究时,经常需要面对的问题之一是如何处理非期望产出(undesirable outputs)。传统DEA模型在处理生产效率分析时通常假设决策单元(Decision Making Units, ...
《图像处理:处理纹理》是图像处理领域内一部权威性的著作,由Maria Petrou和Pedro Garcia Sevilla两位学者共同编写,他们分别来自英国伦敦帝国理工学院和西班牙卡斯特利翁的Jaume I大学。该书由全球知名的学术出版...
R scripts for dealing with mturk
"Dealing With Stress" 这个主题的工作坊就是为此而设,旨在帮助参与者理解和管理他们面临的压力。 首先,我们要理解压力的来源。在大学生活中,学生面临的主要压力源包括: 1. **学术压力**:大学课程繁重,报告...
Chapter 3 Dealing with trouble测试题2.doc
"Dealing with Hard People"这一主题,虽然看似不直接涉及技术,但它实际上对提升工作效率和团队协作至关重要。在这个知识领域,我们将深入探讨如何在复杂的职场环境中处理人际关系,特别是那些难缠的人物。 首先,...
- - 与人交往中注意的一些容易被跳过的细节.以及基础理论分析与人交往出现的情况.
音频地环回问题详解 音频地环回是音频系统中常见的问题,主要由于不同设备通过不同的路径连接到共同的地线而产生。这种多路径接地方式实际上就像一个天线,会拾取并引入干扰。当地环回发生时,地线(通常是屏蔽层)...
这篇PPT学习教案是针对八年级英语的一课,主题为"Dealing with trouble",旨在帮助学生学习如何处理各种突发状况。以下是对其中涉及的知识点的详细解释: 1. **词汇与短语**: - **hurry**:匆忙,表示动作迅速。 ...
处理不均衡数据_(深度学习)!_Dealing_with_imbalanced_data_(deep_learning)
标题中的"ASTM E178 - 21"指的是美国材料与...通过阅读提供的"ASTM E178 - 21 Standard Practice for Dealing With Outlying Observations - 完整英文版(11页).pdf"文件,可以深入学习这一标准的细节和具体实施步骤。
在Microsoft Foundation Class (MFC)库中,"MFC dealing with window size_IntheFrame_MFC实例_" 主题涉及如何在框架窗口(Frame Window)中管理子窗口(Subwindow)的大小。MFC是C++的一个类库,它为Windows应用...
A chapter on several sorting algorithmsFunctions (planar and solid) with many interesting examplesOrdinary differential equationsAdvantages of Mathematica® dealing with the Pi numberThe power of ...
### 多标签分类:通过合并标签处理不平衡问题 #### 摘要与介绍 本文讨论了一个在多标签分类(Multi-Label Classification, MLC)领域中的常见问题——数据不平衡,并提出了一种新颖的方法来解决这一难题。...
There are chapters dealing with all the important aspects of the Android platform, including GUI design, file- and data-handling, coping with phone calls, multimedia apps, interaction with location ...
# 处理视觉里程计(VO)中的结构化场景:不完整SURF方法 ## 摘要 本文探讨了在结构化环境中处理视觉里程计(VO)的问题。当前常用的特征提取方法,如Harris角点检测、SURF、ORB等,在大多数情况下表现良好,但在...
标题中的"071431_VB_picture_dealing_with.rar_vb matlab"指的是一个关于VB(Visual Basic)和MATLAB结合使用的图像处理压缩包。这个压缩包可能包含了一系列的VB代码和MATLAB脚本,用于图像的导入、处理和分析。 在...
Chapter 7 Dealing With Huge Data Files Chapter 8 Working With A Mountain Of Data Chapter 9 Practical Data Analysis Chapter 10 Browser-Based Visualization Chapter 11 Server-Side Visualization Chapter ...
标题与描述中提到的知识点主要围绕在iOS应用开发中如何处理数据、用户默认设置(User Defaults)、SQLite数据库以及网络服务(Web Services)。以下是对这些关键概念的深入解析: ### 处理iOS应用中的数据 ...