Christian Weisgerber wrote, On 08/15/14 18:36:
On 2014-08-15, Paul de Weerd <we...@weirdnet.nl> wrote:
What you could do is use the -r option to tftpd(8) to hand out a new
file to each client that connects. Or just periodically (like, every
hour or every minute, depending on the load of your tftp server)
replace it with a new random file.
How about making etc/random.seed a named pipe and feeding chunks
of /dev/random to it? Something like
# cd /tftpboot
# mkfifo etc/random.seed
# while true; do dd if=/dev/random count=1 >etc/random.seed 2>/dev/null; done &
seems to work at first blush.
I liked de Weerd's idea using the -r option with tftpd. I was thinking I
could use a socket to signal a small script containing nc(1) for the
domain socket communication. The script would detect if the requested
file was "etc/random.seed", and if so, refresh the randomness, otherwise
just pass the original request file back (essentially a NOP). Then tftpd
would serve up this freshly generated randomness on a per request basis.
But shit, Christian's one-liner above works like a charm!
I was skeptical at first, but after some testing I'm convinced that it
works great with tftpd(8).
# cd /tftpboot
# mkfifo test.seed
# while :; do dd if=/tmp/counter of=test.seed 2>/dev/null; done &
# cnt=0
# cd /tmp
# echo $((cnt++)) > counter
# echo "get test.seed\nquit" | tftp localhost
# cat test.seed
0
# echo $((cnt++)) > counter
# echo "get test.seed\nquit" | tftp localhost
# cat test.seed
1
# echo $((cnt++)) > counter
# echo "get test.seed\nquit" | tftp localhost
# cat test.seed
2
# ###DON'T UPDATE COUNTER### echo $((cnt++)) > counter
# echo "get test.seed\nquit" | tftp localhost
# cat test.seed
2
and you get the picture ...