Skip to content
Barry Rountree edited this page Apr 21, 2020 · 18 revisions

Welcome to the msr-safe wiki!

Continuous Integration for Linux Kernel Modules in a Secure Environment Using VirtualBox

Here's what we want to accomplish:

  • Set up the virtual machine based on this release of this distro using the Oracle VM VirtualBox Manager GUI.
  • Get both NAT and host-only networking. The former allows easier setup on my less-secure workstation. The latter allows a fixed IP address to be used on a machine behind a bastion host where we do our continuous integration builds.
  • Install the minimum number of package needed for an msr-safe build and test cycle.
  • Demonstrate how to move the vm behind the bastion host and then use the VirtualBox command line interface to set up execution there.
  • Show how to set up ssh keys to allow automated github updates and build scripts.

Assumptions:

  • VirtualBox is already installed on the workstation and bastion host.
  • A modest amount of familiarity with the Linux environment.

Setting up VirtualBox on the workstation (Solvent)

VirtualBox allows several different kinds of networking. NAT is the default, which allows the VM to reach the internet but does not allow the host to ssh into the vm without using port forwarding. To give our VMs a static IP address, we add on Host-Only networking. The first step in doing so is setting up a loopback device on the host machine. Using the GUI, that procedure looks like this.

Here is what the VirtualBox Manager looks like when started for the first time.

Screenshots/VirtualBoxManager_Initial.png

Use CTRL+H (or File->Host Network Manager) to bring up this window. (Note the VirtualBox documentation describes an older interface that no longer exists.)

Screenshots/HostNetworkManager_Initial.png

Click on Create. That gives us a host-side network device with the name vboxnet0.

Screenshots/HostNetworkManager_PostCreate.png

Click on Properties. The DHCP Server should NOT be enabled. Note that the field "IPv4 Address" (192.168.56.1) describes the address of the host machine as seen from the VM. This address will be shared across all VMs.

Screenshots/HostNetworkManager_Properties.png

Click on Apply (if needed) and then Close. Running ip address on the command line at this point on the host should give something like:

rountree@Solvent:/$ ip address
...
9: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
rountree@Solvent:/$

Note that the link is currently down.

Ubuntu 20.04 Focal Fossa (beta) Server Version

iso available here http://releases.ubuntu.com/20.04/ubuntu-20.04-beta-live-server-amd64.iso

Note this is a beta release. Once the official release happens this link will no longer work. Also note this is the server version.

Starting from the VirtualBox Manager:

Screenshots/VirtualBoxManager_Initial.png

Click on New.

Screenshots/CreateVM_Initial.png

Fill in the blanks to suit.

Screenshots/CreateVM_Completed.png

Click on Create. The next screen concerns creating the hard disk.

Screenshots/CreateVirtualHD.png

The default values are fine. Click on Create.

At this point we have a working virtual machine that, were we to fire it up, would discover that no bootable media was available. So let's attach some. We start off on this screen:

Screenshots/VirtualBoxManager_PostCreate.png

Click on Settings.

Screenshots/SettingsGeneral_Initial.png

Click on Storage.

Screenshots/SettingsStorage_Initial.png

Under "Controller:IDE" there should be a CD-ROM icon labelled "Empty". Click on that. Its attributes appear on the right. Click on the CDROM icon in Attributes and choose the appropriate ISO file. That information will replace the "Empty" in the Storage Device column. Next, check the "Live CD/DVD" box in the Attributes column. Then click Ok. The screen should look like this just prior to clicking on Ok.

Screenshots/SettingsStorage_Final.png

Click on Settings again (as clicking on OK above closes the window) and then click on Network.

Screenshots/SettingsNetwork_Initial.png

Adapter 1 defaults to NAT and being enabled. That's what we want. Click on the Adapter 2 tab and then click on the "Enable Network Adapter" checkbox. Select "Host-only Adapter" from the "Attached to:" drop-down menu. The "Name" field will be populated with the named Host Adapter we set up earlier.

Screenshots/SettingsNetwork_Final.png

Click ok. At this point we're ready to boot the machine from our virtual CD-ROM. Click on Start.

Screenshots/netplan.png