VirtualBox

Changeset 79186 in vbox


Ignore:
Timestamp:
Jun 17, 2019 3:00:03 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131358
Message:

Installers/Linux: support Ubuntu-s DKMS secure boot tools.
bugref:9199: Linux host kernel modules and UEFI secure boot.
Ubuntu (and soon Debian) provides infrastructure for signing kernel modules
for use with secure boot for use with DKMS. This change makes our Linux host
installer use this infrastructure if it is found, and warn about modules to
be signed if not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/vboxdrv.sh

    r78047 r79186  
    8787fi
    8888
     89KERN_VER=`uname -r`
     90MODULE_LIST="vboxdrv vboxnetflt vboxnetadp vboxpci"
     91# Secure boot state.
     92case "`mokutil --sb-state 2>/dev/null`" in
     93    *"disabled in shim"*) unset HAVE_SEC_BOOT;;
     94    *"SecureBoot enabled"*) HAVE_SEC_BOOT=true;;
     95    *) unset HAVE_SEC_BOOT;;
     96esac
     97# So far we can only sign modules on Ubuntu and on Debian 10 and later.
     98DEB_PUB_KEY=/var/lib/shim-signed/mok/MOK.der
     99DEB_PRIV_KEY=/var/lib/shim-signed/mok/MOK.priv
     100unset HAVE_DEB_KEY
     101case "`mokutil --test-key "$DEB_PUB_KEY" 2>/dev/null`" in
     102    *"is already"*) DEB_KEY_ENROLLED=true;;
     103    *) unset DEB_KEY_ENROLLED;;
     104esac
     105
    89106[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
    90107
     
    252269    if [ -d /proc/xen ]; then
    253270        failure "Running VirtualBox in a Xen environment is not supported"
     271    fi
     272    if test -n "$HAVE_SEC_BOOT" && test -z "$DEB_KEY_ENROLLED"; then
     273        if test -n "$HAVE_DEB_KEY"; then
     274            begin_msg "You must re-start your system to finish Debian secure boot set-up." console
     275        else
     276            begin_msg "You must sign these kernel modules before using VirtualBox:
     277  $MODULE_LIST
     278See the documenatation for your Linux distribution." console
     279        fi
     280        return 0
    254281    fi
    255282    if ! running vboxdrv; then
     
    464491    sync
    465492    succ_msg "VirtualBox kernel modules built"
     493    # Secure boot on Ubuntu and Debian.
     494    if test -n "$HAVE_SEC_BOOT" &&
     495        type update-secureboot-policy >/dev/null 2>&1; then
     496        SHIM_NOTRIGGER=y update-secureboot-policy --new-key
     497    fi
     498    if test -f "$DEB_PUB_KEY" && test -f "$DEB_PRIV_KEY"; then
     499        HAVE_DEB_KEY=true
     500        for i in $MODULE_LIST; do
     501            kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv \
     502                /var/lib/shim-signed/mok/MOK.der \
     503                /lib/modules/"$KERN_VER"/misc/"$i".ko
     504        done
     505        # update-secureboot-policy "expects" DKMS modules.
     506        # Work around this and talk to the authors as soon
     507        # as possible to fix it.
     508        mkdir -p /var/lib/dkms/vbox-temp
     509        update-secureboot-policy --enroll-key 2>/dev/null ||
     510            begin_msg "Failed to enroll secure boot key." console
     511        rmdir -p /var/lib/dkms/vbox-temp 2>/dev/null
     512    fi
    466513}
    467514
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette