コンテンツにスキップ

「Dnscrypt-proxy」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
ページの作成:「Category:Domain Name System Category:セキュリティ en:DNSCrypt es:DNSCrypt pt:DNSCrypt [http://dnscrypt.org/ DNSCrypt] はユーザーと DNS リ...」
 
編集の要約なし
8行目: 8行目:
== インストール ==
== インストール ==


[[公式リポジトリ]]から {{Pkg|dnscrypt-proxy}} をインストールしてください。
[[公式リポジトリ]]から {{Pkg|dnscrypt-proxy}} を[[インストール]]してください。


== 設定 ==
== 設定 ==


{{Tip|To automatically configure DNSCrypt and choose a resolver, use {{AUR|dnscrypt-autoinstall}} from the [[AUR]].}}
{{Tip|DNSCrypt が自動的にリゾルバを選ぶようにしたい場合、[[AUR]] {{AUR|dnscrypt-autoinstall}} を使って下さい。}}


By default ''dnscrypt-proxy'' is pre-configured in {{ic|/etc/conf.d/dnscrypt-proxy}} (read by {{ic|dnscrypt-proxy.service}}) to accept incoming requests on {{ic|127.0.0.1}} to an [https://opendns.com OpenDNS] resolver. See the [https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv list of public resolvers] for alternatives.
デフォルトで ({{ic|dnscrypt-proxy.service}} から読み込まれる) {{ic|/etc/conf.d/dnscrypt-proxy}} ''dnscrypt-proxy'' が設定されており、{{ic|127.0.0.1}} から [https://opendns.com OpenDNS] リゾルバへのリクエストを承諾するようになっています。他に使えるリゾルバは [https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv パブリックリゾルバのリスト] を見て下さい。できるかぎり遅延を抑えるために、地理的に近いリゾルバを選択してください。


デフォルトの設定では、[[resolv.conf]] ファイルを変更してリゾルバのアドレスをローカルホストに置き換える必要があります:
With this setup, it will be necessary to alter your [[resolv.conf]] file and replace your current set of resolver addresses with localhost:
nameserver 127.0.0.1
nameserver 127.0.0.1


他のプログラムによって [[resolv.conf]] が置き換えられないようにしてください。詳しくは [[resolv.conf#DNS 設定の保護]] を参照。
You might need to prevent other programs from overwriting it, see [[resolv.conf#Preserve DNS settings]] for details.


== 起動 ==
== 起動 ==


Available as a [[systemd]] service: {{ic|dnscrypt-proxy.service}}
[[systemd]] サービスを使って起動できます: {{ic|dnscrypt-proxy.service}}


== Tips and tricks ==
== Tips and tricks ==
29行目: 29行目:
=== DNSCrypt で DNS ローカルキャッシュを転送 ===
=== DNSCrypt で DNS ローカルキャッシュを転送 ===


DNSCrypt をローカル DNS キャッシュのフォワーダとして実行することが推奨されています。そうしないと全てのクエリーが上流のリゾルバを往復することになります。ローカル DNS キャッシュプログラムならどれでも動作します。以下では [[Unbound]], [[dnsmasq]], [[pdnsd]] の設定例を紹介します。
It is recommended to run DNSCrypt as a forwarder for a local DNS cache, otherwise every single query will make a round-trip to the upstream resolver. Any local DNS caching program should work, examples below show configuration for [[Unbound]], [[dnsmasq]], and [[pdnsd]].


==== 例: Unbound の設定 ====
==== 例: Unbound の設定 ====


Configure [[Unbound]] to your liking (remember to [[Unbound#Set /etc/resolv.conf to use the local DNS server|set /etc/resolv.conf to use the local DNS server]]) and add the following lines to the end of the {{ic|server}} section in {{ic|/etc/unbound/unbound.conf}}:
自由に [[Unbound]] を設定 ([[Unbound#Set /etc/resolv.conf to use the local DNS server|ローカル DNS サーバーを使うように /etc/resolv.conf を設定]]するのを忘れずに]) してから以下の行を {{ic|/etc/unbound/unbound.conf}} の {{ic|server}} セクションの最後に追加してください:
do-not-query-localhost: no
do-not-query-localhost: no
forward-zone:
forward-zone:
41行目: 41行目:
{{Note|Port 40 is given as an example as Unbound by default listens to 53, these must be different.}}
{{Note|Port 40 is given as an example as Unbound by default listens to 53, these must be different.}}


{{Tip|If you are setting up a server add {{ic|interface: 0.0.0.0@53}} and {{ic|access-control: ''your-network''/''subnet-mask'' allow}} inside the {{ic|server:}} section so that the other computers of your LAN can connect to the server. A client must be configured with {{ic|nameserver ''address-of-your-server''}} in {{ic|/etc/resolv.conf}}.}}
Start the [[systemd]] service {{ic|unbound.service}}. Then configure DNScrypt to match Unbound's new {{ic|forward-zone}} IP and port in {{ic|/etc/conf.d/dnscrypt-proxy}}:

[[systemd]] サービス {{ic|unbound.service}} を起動してください。そして Unbound {{ic|forward-zone}} IP とポートを DNSCrypt {{ic|/etc/conf.d/dnscrypt-proxy}} に設定します:
DNSCRYPT_LOCALIP=127.0.0.1
DNSCRYPT_LOCALIP=127.0.0.1
DNSCRYPT_LOCALPORT=40
DNSCRYPT_LOCALPORT=40
47行目: 49行目:
{{Note|DNSCrypt needs to start before Unbound, so include {{ic|unbound.service}} on a {{ic|1=Before=}} line in the {{ic|[Unit]}} section of {{ic|dnscrypt-proxy.service}}.}}
{{Note|DNSCrypt needs to start before Unbound, so include {{ic|unbound.service}} on a {{ic|1=Before=}} line in the {{ic|[Unit]}} section of {{ic|dnscrypt-proxy.service}}.}}


Restart {{ic|dnscrypt-proxy.service}} and {{ic|unbound.service}} to apply the changes.
{{ic|dnscrypt-proxy.service}} {{ic|unbound.service}} を再起動すると変更が適用されます。


==== 例: dnsmasq の設定 ====
==== 例: dnsmasq の設定 ====


dnsmasq を[[dnsmasq#DNS キャッシュの設定|ローカル DNS キャッシュ]]として設定してください。DNSCrypt を使用する場合の基本設定:
Configure dnsmasq as a [[dnsmasq#DNS Cache Setup|local DNS cache]]. The basic configuration to work with DNSCrypt:


{{hc|/etc/dnsmasq.conf|2=
{{hc|/etc/dnsmasq.conf|2=
59行目: 61行目:
}}
}}


DNSSEC が有効になっているリゾルバを使うように DNSCrypt を設定した場合、dnsmasq でも DNSSEC を有効にするようにしてください:
If you configured DNSCrypt to use a resolver with enabled DNSSEC validation, make sure to enable it also in dnsmasq:


{{hc|/etc/dnsmasq.conf|2=
{{hc|/etc/dnsmasq.conf|2=
65行目: 67行目:
}}
}}


Configure DNSCrypt to listen on {{ic|127.0.0.2}}, where dnsmasq will be querying:
dnsmasq がクエリーを飛ばす {{ic|127.0.0.2}} で待機するように DNSCrypt を設定:


{{hc|/etc/conf.d/dnscrypt-proxy|2=
{{hc|/etc/conf.d/dnscrypt-proxy|2=
72行目: 74行目:
}}
}}


Restart {{ic|dnscrypt-proxy.service}} and {{ic|dnsmasq.service}} to apply the changes.
{{ic|dnscrypt-proxy.service}} {{ic|dnsmasq.service}} を再起動すれば変更が適用されます。


==== 例: pdnsd の設定 ====
==== 例: pdnsd の設定 ====


[[pdnsd]] をインストールしてください。DNSCrypt を使用する基本設定:
Install [[pdnsd]]. A basic configuration to work with DNSCrypt is:


{{hc|/etc/pdnsd.conf|2=
{{hc|/etc/pdnsd.conf|2=
130行目: 132行目:
}}
}}


Be sure you have [https://wiki.archlinux.org/index.php/DNSCrypt#Configuration configured resolv.conf properly] for {{ic|127.0.0.1}}.
Be sure you have [[#設定|configured resolv.conf properly]] for {{ic|127.0.0.1}}.

Uncomment the following line in {{ic|pdnsd.service}}:

Before=pdnsd.service


{{ic|dnscrypt-proxy.service}} を[[systemd#ユニットファイルの編集|編集]]して {{ic|1=Before=pdnsd.service}} をアンコメントしてください。そして {{ic|pdnsd}} と {{ic|dnscrypt-proxy}} サービスを[[有効化]]します。
Now [https://wiki.archlinux.org/index.php/Systemd#Using_units enable] both the {{ic|pdnsd}} and {{ic|dnscrypt-proxy}} services.


=== EDNS0 の有効化 ===
=== EDNS0 の有効化 ===
142行目: 140行目:
[[wikipedia:Extension_mechanisms_for_DNS|Extension Mechanisms for DNS]] that, among other things, allows a client to specify how large a reply over UDP can be.
[[wikipedia:Extension_mechanisms_for_DNS|Extension Mechanisms for DNS]] that, among other things, allows a client to specify how large a reply over UDP can be.


Add the following line to your {{ic|/etc/resolv.conf}}:
以下の行を {{ic|/etc/resolv.conf}} に追加してください:
options edns0
options edns0


152行目: 150行目:
==== EDNS0 のテスト ====
==== EDNS0 のテスト ====


Make use of the [https://www.dns-oarc.net/oarc/services/replysizetest DNS Reply Size Test Server], use the ''dig'' command line tool available with {{Pkg|dnsutils}} from the [[official repositories]] to issue a TXT query for the name ''rs.dns-oarc.net'':
Make use of the [https://www.dns-oarc.net/oarc/services/replysizetest DNS Reply Size Test Server], use the ''dig'' command line tool from the {{Pkg|bind-tools}} package to issue a TXT query for the name ''rs.dns-oarc.net'':
$ dig +short rs.dns-oarc.net txt
$ dig +short rs.dns-oarc.net txt


'''EDNS0''' がサポートされていれば、以下のような出力がされます:
With '''EDNS0''' supported, the output should look similar to this:
rst.x3827.rs.dns-oarc.net.
rst.x3827.rs.dns-oarc.net.
rst.x4049.x3827.rs.dns-oarc.net.
rst.x4049.x3827.rs.dns-oarc.net.

2015年7月4日 (土) 18:56時点における版

DNSCrypt はユーザーと DNS リゾルバの間の DNS トラフィックを暗号化するソフトウェアです。盗聴や改竄、中間者攻撃を防ぎます。

インストール

公式リポジトリから dnscrypt-proxyインストールしてください。

設定

ヒント DNSCrypt が自動的にリゾルバを選ぶようにしたい場合、AURdnscrypt-autoinstallAUR を使って下さい。

デフォルトで (dnscrypt-proxy.service から読み込まれる) /etc/conf.d/dnscrypt-proxydnscrypt-proxy が設定されており、127.0.0.1 から OpenDNS リゾルバへのリクエストを承諾するようになっています。他に使えるリゾルバは パブリックリゾルバのリスト を見て下さい。できるかぎり遅延を抑えるために、地理的に近いリゾルバを選択してください。

デフォルトの設定では、resolv.conf ファイルを変更してリゾルバのアドレスをローカルホストに置き換える必要があります:

nameserver 127.0.0.1

他のプログラムによって resolv.conf が置き換えられないようにしてください。詳しくは resolv.conf#DNS 設定の保護 を参照。

起動

systemd サービスを使って起動できます: dnscrypt-proxy.service

Tips and tricks

DNSCrypt で DNS ローカルキャッシュを転送

DNSCrypt をローカル DNS キャッシュのフォワーダとして実行することが推奨されています。そうしないと全てのクエリーが上流のリゾルバを往復することになります。ローカル DNS キャッシュプログラムならどれでも動作します。以下では Unbound, dnsmasq, pdnsd の設定例を紹介します。

例: Unbound の設定

自由に Unbound を設定 (ローカル DNS サーバーを使うように /etc/resolv.conf を設定するのを忘れずに]) してから以下の行を /etc/unbound/unbound.confserver セクションの最後に追加してください:

do-not-query-localhost: no
forward-zone:
  name: "."
  forward-addr: 127.0.0.1@40
ノート Port 40 is given as an example as Unbound by default listens to 53, these must be different.
ヒント If you are setting up a server add interface: 0.0.0.0@53 and access-control: your-network/subnet-mask allow inside the server: section so that the other computers of your LAN can connect to the server. A client must be configured with nameserver address-of-your-server in /etc/resolv.conf.

systemd サービス unbound.service を起動してください。そして Unbound の forward-zone IP とポートを DNSCrypt の /etc/conf.d/dnscrypt-proxy に設定します:

DNSCRYPT_LOCALIP=127.0.0.1
DNSCRYPT_LOCALPORT=40
ノート DNSCrypt needs to start before Unbound, so include unbound.service on a Before= line in the [Unit] section of dnscrypt-proxy.service.

dnscrypt-proxy.serviceunbound.service を再起動すると変更が適用されます。

例: dnsmasq の設定

dnsmasq をローカル DNS キャッシュとして設定してください。DNSCrypt を使用する場合の基本設定:

/etc/dnsmasq.conf
no-resolv
server=127.0.0.2#2053
listen-address=127.0.0.1

DNSSEC が有効になっているリゾルバを使うように DNSCrypt を設定した場合、dnsmasq でも DNSSEC を有効にするようにしてください:

/etc/dnsmasq.conf
proxy-dnssec

dnsmasq がクエリーを飛ばす 127.0.0.2 で待機するように DNSCrypt を設定:

/etc/conf.d/dnscrypt-proxy
DNSCRYPT_LOCALIP=127.0.0.2
DNSCRYPT_LOCALPORT=2053

dnscrypt-proxy.servicednsmasq.service を再起動すれば変更が適用されます。

例: pdnsd の設定

pdnsd をインストールしてください。DNSCrypt を使用する基本設定:

/etc/pdnsd.conf
global {
	perm_cache=16384;
	cache_dir="/var/cache/pdnsd";
	run_as="pdnsd";
 	server_ip = 127.0.0.1;
	status_ctl = on;
	query_method=udp_tcp;
	min_ttl=15m;       # Retain cached entries at least 15 minutes.
	max_ttl=1w;        # One week.
	timeout=10;        # Global timeout option (10 seconds).
	neg_domain_pol=on;
	udpbufsize=1024;   # Upper limit on the size of UDP messages.
}

server {
	label = "dnscrypt-proxy";
	ip = 127.0.0.2;
	port = 53;
	timeout = 4;
	uptest = query;
	interval = 15m;
	proxy_only=on;
}

source {
	owner=localhost;
	file="/etc/hosts";
}


rr {
	name=localhost;
	reverse=on;
	a=127.0.0.1;
	owner=localhost;
	soa=localhost,root.localhost,42,86400,900,86400,86400;
}

Configure DNSCrypt to listen on 127.0.0.2:53 where pdnsd will be querying. The following has an example provider already in place. Be sure to use the provider you have chosen.

/etc/conf.d/dnscrypt-proxy
DNSCRYPT_LOCALIP=127.0.0.2
DNSCRYPT_LOCALPORT=53
DNSCRYPT_USER=nobody
DNSCRYPT_PROVIDER_NAME=2.dnscrypt-cert.opendns.com
DNSCRYPT_PROVIDER_KEY=B735:1140:206F:225D:3E2B:D822:D7FD:691E:A1C3:3CC8:D666:8D0C:BE04:BFAB:CA43:FB79
DNSCRYPT_RESOLVERIP=208.67.220.220
DNSCRYPT_RESOLVERPORT=443

Be sure you have configured resolv.conf properly for 127.0.0.1.

dnscrypt-proxy.service編集して Before=pdnsd.service をアンコメントしてください。そして pdnsddnscrypt-proxy サービスを有効化します。

EDNS0 の有効化

Extension Mechanisms for DNS that, among other things, allows a client to specify how large a reply over UDP can be.

以下の行を /etc/resolv.conf に追加してください:

options edns0

You may also wish to add the following argument to dnscrypt-proxy:

--edns-payload-size=<bytes>

The default size being 1252 bytes, with values up to 4096 bytes being purportedly safe. A value below or equal to 512 bytes will disable this mechanism, unless a client sends a packet with an OPT section providing a payload size.

EDNS0 のテスト

Make use of the DNS Reply Size Test Server, use the dig command line tool from the bind-tools package to issue a TXT query for the name rs.dns-oarc.net:

$ dig +short rs.dns-oarc.net txt

EDNS0 がサポートされていれば、以下のような出力がされます:

rst.x3827.rs.dns-oarc.net.
rst.x4049.x3827.rs.dns-oarc.net.
rst.x4055.x4049.x3827.rs.dns-oarc.net.
"2a00:d880:3:1::a6c1:2e89 DNS reply size limit is at least 4055 bytes"
"2a00:d880:3:1::a6c1:2e89 sent EDNS buffer size 4096"