Improving Security when Booting from Read-Only Media
There are many situations where you might want to boot a computer from read-only media such as “Live CD” or memory stick or whatever. You ought to be concerned about security, especially if the computer is connected to a network.
Most modern security algorithms rely on a source of random numbers. It is recommended that these come from a HRNG (hardware random number generator) ... but in this document we focus on the less-than-ideal case where you do not have confidence in the computer’s ability to generate adequate amounts of real entropy.
The solution given here is significantly better than the prior art, although we again emphasize that it is less than ideal, and again recommend using a good HRNG whenever possible.
Here’s the idea: Seed /dev/random with two contributions: (a) the time-of-day, and (b) a random-seed file that is unique to this boot image.
These to contributions together are far more powerful than either one separately. That is:
Note that the Linux kernel makes some effort to collect entropy from various sources. However, there is no guarantee as to how effective these efforts are going to be. For an unattended machine booting from read-only media, the effectiveness is particularly open to question.
So, the goal is to make each Live CD (or memory stick etc.) have its very own private random.seed file, and to make it initialize /dev/random using that file and the time of day.
I have created some software to help with this. The top-level program is a shell script, and it is supported by two Perl programs.
If you want to make N disks:
For additional details, download the aforementioned programs and read their usage messages.
Note that if the Ubuntu folks made a modest change to their downloadable image, the process for the first disk would be two orders of magnitude quicker.
Reat the init script at the top of the intramfs image for details on where the breaks occur.
Could stick some code in the local_bottom() function within the initrd//scripts/local file.
apt-file search /systemd-random-seed.service systemd: /lib/systemd/system/sysinit.target.wants/systemd-random-seed.service systemd: /lib/systemd/system/systemd-random-seed.service systemd: /usr/share/man/man8/systemd-random-seed.service.8.gz
Also note that it is mentioned in /mnt/squash/var/lib/dpkg/info/initscripts.list
Also it’s odd that the Live system ships init.d/urandom, since AFAICT it doesn’t get run ... and running it has no discernible effect.