From 79dcd6ac15b383dbd335f6602dff8ea17bc1176f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 10 Jul 2017 10:08:56 +0100 Subject: [PATCH] Don't install havege on VMs --- src/freedombone-image-customise | 6 +++++- src/freedombone-utils-rng | 6 +++++- src/freedombone-utils-setup | 11 ++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 590c4c77..ab60fb7f 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -1410,7 +1410,11 @@ rm $rootdir/usr/sbin/policy-rc.d # Set up HRNG for systems known to have one # Otherwise install haveged if [[ "$MACHINE" != "beaglebone"* ]]; then - chroot $rootdir apt-get -yq install haveged + # With some VMs, the hardware cycles counter is emulated and deterministic, + # and thus predictible, so havege should not be used + if [[ "$MACHINE" != "qemu"* ]]; then + chroot $rootdir apt-get -yq install haveged + fi else chroot $rootdir apt-get -yq install rng-tools sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools diff --git a/src/freedombone-utils-rng b/src/freedombone-utils-rng index 906f62cd..0c8b43c0 100755 --- a/src/freedombone-utils-rng +++ b/src/freedombone-utils-rng @@ -157,7 +157,11 @@ function random_number_generator { install_onerng ;; *) - apt-get -yq install haveged + # With some VMs, the hardware cycles counter is emulated and deterministic, + # and thus predictible, so havege should not be used + if [[ "$ARCHITECTURE" != "qemu"* ]]; then + apt-get -yq install haveged + fi ;; esac diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup index 9e2977ab..c01fd727 100755 --- a/src/freedombone-utils-setup +++ b/src/freedombone-utils-setup @@ -230,9 +230,14 @@ function initial_setup { apt-get -yq install avahi-discover avahi-autoipd iptables dnsutils net-tools apt-get -yq install network-manager iputils-ping libnss-mdns libnss-myhostname apt-get -yq install libnss-gw-name nano man ntp locales locales-all debconf - apt-get -yq install wireless-tools wpasupplicant usbutils zsh - apt-get -yq install pinentry-curses eatmydata iotop bc hostapd haveged - apt-get -yq install cpulimit screen + apt-get -yq install wireless-tools wpasupplicant usbutils zsh cpulimit screen + apt-get -yq install pinentry-curses eatmydata iotop bc hostapd + + # With some VMs, the hardware cycles counter is emulated and deterministic, + # and thus predictible, so havege should not be used + if [[ $ARCHITECTURE != 'qemu'* ]]; then + apt-get -yq install haveged + fi if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then apt-get -yq install grub2 lvm2 initramfs-tools