Procházet zdrojové kódy

Check the hardware random number generator exists

Bob Mottram před 10 roky
rodič
revize
933b4d354c
1 změnil soubory, kde provedl 15 přidání a 0 odebrání
  1. 15
    0
      install-freedombone.sh

+ 15
- 0
install-freedombone.sh Zobrazit soubor

@@ -265,6 +265,20 @@ function argument_checks {
265 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 282
 function remove_default_user {
269 283
   # make sure you don't use the default user account
270 284
   if [[ $MY_USERNAME == "debian" ]]; then
@@ -3447,6 +3461,7 @@ create_restore_script
3447 3461
 time_synchronisation
3448 3462
 configure_internet_protocol
3449 3463
 configure_ssh
3464
+check_hwrng
3450 3465
 search_for_attached_usb_drive
3451 3466
 regenerate_ssh_keys
3452 3467
 script_to_make_self_signed_certificates