Browse Source

Check the hardware random number generator exists

Bob Mottram 10 years ago
parent
commit
933b4d354c
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      install-freedombone.sh

+ 15
- 0
install-freedombone.sh View File

265
   fi
265
   fi
266
 }
266
 }
267
 
267
 
268
+function check_hwrng {
269
+    # If hardware random number generation was enabled then make sure that the device exists.
270
+    # if /dev/hwrng is not found than any subsequent cryptographic key generation would
271
+    # suffer from low entropy and might be insecure
272
+    if [ ! -f /etc/default/rng-tools ]; then
273
+        return
274
+    fi
275
+    if [ ! -b /dev/hwrng ]; then
276
+        ls /dev/hw*
277
+        echo 'The hardware random number generator is anabled but could not be detected on /dev/hwrng.  There may be a problem with the installation or the Beaglebone hardware.'
278
+        exit 75
279
+    fi
280
+}
281
+
268
 function remove_default_user {
282
 function remove_default_user {
269
   # make sure you don't use the default user account
283
   # make sure you don't use the default user account
270
   if [[ $MY_USERNAME == "debian" ]]; then
284
   if [[ $MY_USERNAME == "debian" ]]; then
3447
 time_synchronisation
3461
 time_synchronisation
3448
 configure_internet_protocol
3462
 configure_internet_protocol
3449
 configure_ssh
3463
 configure_ssh
3464
+check_hwrng
3450
 search_for_attached_usb_drive
3465
 search_for_attached_usb_drive
3451
 regenerate_ssh_keys
3466
 regenerate_ssh_keys
3452
 script_to_make_self_signed_certificates
3467
 script_to_make_self_signed_certificates