我有一个 NeuG 硬件真随机数生成器(http://www.gniibe.org/memo/development/gnuk/rng/neug.html)并且它的页面说它在 GNU/Linux 系统上运行/dev/ttyACM0
我可以配置/dev/random
使用 NeuG 的随机性吗?如果是这样,怎么办?我如何检查是否/dev/random
确实使用 NeuG?
答案1
答案改编自超级用户:https://superuser.com/questions/309840/how-can-i-point-dev-random-to-dev-urandom
您需要做的就是创建类似/etc/udev/rules.d/70-harware-randomizer-enable.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= 'ttyACM0'
# disagree. You can ignore this warning.
# Use /dev/ttyACM0 instead of /dev/random for the entropy-estimating RNG.
KERNEL=="random", NAME="ttyACM0"
# Remove any existing /dev/random, then create symlink /dev/random pointing to
# /dev/urandom
KERNEL=="urandom", PROGRAM+="/bin/rm -f /dev/random", SYMLINK+="random"
答案2
我不记得我是否做了其他任何事情,但似乎我是用以下内容创建的:/etc/systemd/system/[email protected]
[Unit]
Description=rngd service on %I
[Service]
Type=simple
ExecStartPre=/bin/stty -F /dev/%I raw -echo -parenb
ExecStart=/usr/sbin/rngd -f --fill-watermark=4000 --rng-device=/dev/%I
然后,和sudo systemctl enable [email protected]
sudo systemctl start [email protected]