如何将 /dev/random 指向 /dev/urandom

Bri*_*enk 6 linux

我的服务器无法生成足够的熵来支持/dev/random. 有问题的特定软件无法配置为使用/dev/urandom.

我尝试移动/dev/random/dev/realrandom并符号链接/dev/random/dev/urandom,但lsof /dev/realrandom仍然显示使用它的过程。

'urandom' 是否共享相同的 'random' 熵?,建议使用mknod /dev/random 1 9. 这会持续重启吗?我应该以某种方式使用 udev 吗?

小智 19

您需要做的就是/etc/udev/rules.d/70-disable-random-entropy-estimation.rules使用以下内容创建类似的内容:

# /etc/udev/rules.d/70-disable-random-entropy-estimation.rules
# Disables /dev/random entropy estimation (it's mostly snake oil anyway).
#
# udevd will warn that the kernel-provided name 'random' and NAME= 'eerandom'
# disagree.  You can ignore this warning.

# Use /dev/eerandom instead of /dev/random for the entropy-estimating RNG.
KERNEL=="random", NAME="eerandom"

# Remove any existing /dev/random, then create symlink /dev/random pointing to
# /dev/urandom
KERNEL=="urandom", PROGRAM+="/bin/rm -f /dev/random", SYMLINK+="random"
Run Code Online (Sandbox Code Playgroud)

  • +1 用于实际回答翻转问题。 (2认同)

Ign*_*ams 7

您应该考虑增加更多的熵而不是损害您的系统。

  • 使用 /dev/urandom 非常好。阻止 /dev/random 是个坏主意。这里有一个详细的解释:http://www.2uo.de/myths-about-urandom/ - 另外,向熵池添加时间可能比 urandom 使用的航向算法更糟糕 (3认同)
  • 这些熵守护进程都不是内核补丁。 (2认同)