昨日くらいからいくつかのサーバの/var/log/messagesが下記のようなログで埋め尽くされるようになってしまいました。
Jan 21 01:21:13 silesia named[23995]: client 66.230.160.1#24898: view global: query (cache) './NS/IN' deniedJan 21 01:21:13 silesia named[23995]: client 66.230.128.15#34443: view global: query (cache) './NS/IN' deniedJan 21 01:21:15 silesia named[23995]: client 66.230.160.1#14023: view global: query (cache) './NS/IN' deniedJan 21 01:21:15 silesia named[23995]: client 66.230.160.1#24622: view global: query (cache) './NS/IN' deniedJan 21 01:21:15 silesia named[23995]: client 66.230.128.15#59236: view global: query (cache) './NS/IN' denied
こういうのは何かの攻撃の前触れだろうということで調べてみると、SANSに以下のような記事が載っていました。なんらかのDoS攻撃のようです。
DNS queries for "."
Several folks are reporting odd queries hitting their DNS servers at a steady rate of about two per second. The queries invariably ask for the name server of the domain "." (NS query for a single dot). Since "." is a query for the root name servers, it has a very short query packet but a pretty long answer. Our current theory therefore is that this is a denial of service (DoS) attack in progress, where the DNS servers are used as "amplifiers" and unwittingly flood the (spoofed) source by providing a long answer to a system which never asked.
とりあえずサーバが再帰的問い合わせをしていなければ問題ないようです。僕の管理下のサーバは外部からの再帰問い合わせに答えないようには設定してあるのですが、念のためにSANSで公開されているDNS Testで"."というクエリにサーバが応答しないか調べてみました。
サーバに問題がなければ、下記のような結果が出力されます。
SANS Internet Storm Center; Cooperative Network Security Community - Internet SecurityDNS Test - isc
This page will test a DNS server to make sure that it does not respond to the standard NS requests for the root zone. It will run "dig . NS @yournameserver".To prevent abuse of this page. You are limited to 10 queries, after which you have to wait an hour for any additional queries. We also setup a very simple "math captcha".Good. your name server refused the queryTesting SILESIA.CLES.NET (210.188.204.98)/usr/bin/dig . NS @SILESIA.CLES.NET; <<>> DiG 9.2.4 <<>> . NS @SILESIA.CLES.NET; (1 server found);; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 50366;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0;; QUESTION SECTION:;.INNS;; Query time: 192 msec;; SERVER: 210.188.204.98#53(210.188.204.98);; WHEN: Tue Jan 20 16:20:27 2009;; MSG SIZE rcvd: 17
† 確認しているIPアドレスの一覧
DoSの対象となっていると思われるホストはこんな感じです。
# 左端の数字はサーバのログの記録数です。
Count IP Address 108 193.227.241.60 116 88.191.64.64 222 193.227.240.38 342 91.199.112.18 381 209.123.8.64 409 66.115.128.30 534 69.31.52.214 616 209.123.8.99 694 195.234.42.1 971 193.227.240.37 1080 216.240.131.173 1185 74.86.34.144 4553 216.201.83.2 5857 216.201.82.19 9414 63.217.28.226 15557 69.50.142.110 18646 69.50.137.171 22075 69.50.137.175 30809 66.230.128.15 41468 66.230.160.1 41845 69.50.129.81 53122 76.9.16.171 72870 76.9.31.42 114301 69.50.142.11
† iptablesでフィルタしてみる
bindでDNS応答を防ぐ方法としてはnamed.confのoptions中のblackholeに指定することもできますが、面倒なのでiptablesで防いでしまうことにします。
iptables -A INPUT -p udp --dport 53 -j DROP -s 193.227.241.60
という感じで、IPアドレスを列挙しておけばOKです。