Skip to content

Instantly share code, notes, and snippets.

@yomimono
Last active May 16, 2017 07:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yomimono/00c87b32565cd3f9c23e85b14073ff17 to your computer and use it in GitHub Desktop.
Save yomimono/00c87b32565cd3f9c23e85b14073ff17 to your computer and use it in GitHub Desktop.
mirageos/unikernels update from docker internal systems summit, 20 april 2017

MirageOS/Unikernels (but secretly something else)

  • speaking now: @mindypreston (@yomimono on github)

Very Quick MirageOS Update

Coming Soon

  • solo5 is improving to target more things: bhyve, Hypervisor.Framework

(but really MirageSDK for LinuxKit)

Known Components -> Better Components

LinuxKit: assemble a particular set of components in order to make a platform.

With known components, a question arises:

could you be using better components?

Use Better Components (or make your own!)

Our goal: allow operators to choose (and invent!) more secure, more specialized implementations of the components they need.

What Kind of Components?

  • run in a container as a single static binary.
  • follow a common configuration convention based on bind mounts from the host.
  • NOT intended to be portable to other Linux or OS distributions
  • (We will support and encourage portable patchsets to be maintained by the community for other operating systems)

"Better" -> "More Secure"

Within the context of LinuxKit, what conventions can we demand or enforce to try to hit "more secure"?

  • the container has the minimal capabilities required to execute.
  • after configuration is read, the service privilege separates itself to drop as much as possible.
  • processes use KVM to supply extra hardware protection if available, via the Solo5 project.
  • if KVM is not available, use seccomp-bpf to restrict the set of syscalls used.
  • all untrusted network traffic must be handled in memory-safe languages.
  • support automated fuzz testing so that tools like AFL can run regularly to detect bugs proactively.

Environment of the SDK

  • The SDK will initially support OCaml (via MirageOS)
  • Next up: Rust
  • Later: other languages via server-side WebAssembly
  • Never: C or other memory-unsafe languages without sandboxing

What does it look like?

  • Very, very embryonic ;)
  • Currently, we're working on proofs-of-concept to nail down the interface
    • first: DHCP client
    • next: ntpd, https?

Why DHCP

  • important
    • if you need DHCP, you won't be able to network without it
  • trusted
    • needs to be able to set host configuration information
  • complicated
    • particularly risky because it often implements its own parsers

Architecture so far

               |=================|                      |================|
               |       priv      |                      |       calf     |
               |=================|                      |================|
               |                 |                      |                |
<--  eth0 ---> |    BPF rules    | <--- network IO ---> |   type-safe    |
               |                 |      (data path)     | network stack  |
               |                 |                      |                |
               |-----------------|                      |----------------|
               |                 |                      |                |
<-- logs ----- |                 | <------- logs ------ |   type-safe    |
               |                 |                      | protocol logic |
<-- metrics -- |                 | <----- metrics ----- |                |
               |                 |                      |                |
               |-----------------|                      |----------------|
               |                 |                      |                |
<-- audit ---  |  config store   | <----- KV store ---> |  config store  |
   diagnostic  |     daemon      |     (control path)   |     client     |
               |                 |                      |                |
               |_________________|                      |________________|
               |                 |
<-- syscalls - |                 |
               |                 |
               | system handlers |
<-- config --- |                 |
    files      |                 |
               |_________________|

Let's have a look

  • linuxkit/projects/miragesdk/examples/mirage-dhcp.yml
  • dhcp container config in /containers/services
  • config exposed in /var/run/dhcp-client
  • logs in /var/log/dhcp-client.log
  • calf drops off information, priv acts on it

Goals

  • make it easy for developers to write new services
  • make it easy for operators to introspect running services (and their interactions)

MirageSDK/Unikernels

  • small, constrained, specified services might sound familiar to you
  • and there's a reason we wanted to start with OCaml
  • well-architected libraries let us write small shims for the custom LinuxKit interaction
  • benefit from the community and momentum of the existing MirageOS project

Questions?

  • we'll talk more later :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment