coLinux /dev/random

| コメント(0)

[Fri Jan 27 17:19:02 2006] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 27 17:25:23 2006] [notice] Digest: done

mod_auth_digest 入りの apache2coLinux で動かそうとすると、起動がとてつもなく遅くなることが多くて 色々調べてみました。これは coLinux の /dev/random 問題として coLinux でsubversion を動かしている人の 間では結構有名な問題なんですね。

DevRandomProblem というページに以下のようにあります。たしかに手元のcoLinuxで strace dd if=/dev/random of=/tmp/hoge count=1 とかやると read() でブロックしている様子が見えます。

In colinux sometimes you may find some cryptographic applications freezing. This is due to the lack of randomness available to /dev/random.

Workaround 2:

  • Change the /dev/random to some pseudo-random source that automatically fills, such as /dev/urandom. For example:

# # /dev/random is  "c 1 8"
# # /dev/urandom is "c 1 9"
# rm /dev/random
# mknod /dev/random c 1 9
# # do your cryptographic thing

ま、手元の開発環境なので同じように /dev/random を /dev/urandom と同じものにしておきました。

追記coLinux ではなく、まともな /dev/random を持つ普通の Linux ならわざわざ/dev/random を変更する必要はありません。 問題は /dev/random を使って Digest 用の secret を生成している部分で apr_generate_random_bytes() を呼び出してとまることなので。

Comments

コメントする