Installation

You can install MC2 Client from source or choose to build a Docker image from a provided Dockerfile with MC2 Client, Opaque SQL, and all dependencies pre-installed. Building the Docker image is much faster than building from source (takes about 7 min), but should be used for development/testing purposes only.

Building with Docker for a local deployment

To quickly play with MC2 Client and Opaque SQL locally, you can use the provided Dockerfile to build a container (takes ~7 min) with all MC2 Client and Opaque SQL dependencies. Alternatively, you can pull a pre-built Docker image instead of building one. To do either, you must have Docker installed.

The container will have the contents of this opaque-client directory at /mc2/client. Opaque SQL will be at /mc2/opaque-sql

Note

If you have installed Docker on Linux, you will either need to follow the post-installation instructions provided [here](https://docs.docker.com/engine/install/linux-postinstall/) or run all docker commands as sudo.

For ease of use, we recommend that you create a directory within your host opaque-client directory that will serve as your playground, and then mount your playground directory to the Docker container. Mounting will ensure that changes you make in your playground directory outside the container will be reflected inside the container, and vice versa. If you’re bringing your own data, you can either copy your data over to your playground directory, or separately mount your data directory to the container.

 # From the `mc2-project/mc2`, create a `playground/` directory
 mkdir playground

 # Clone the `mc2` repo
 git clone https://github.com/mc2-project/mc2

 # Build a Docker image called `mc2_img`
 docker build -t mc2_img .

 # Alternatively, pull a pre-built image (~3 GB)
 # docker pull mc2project/mc2_img:v0.1.3

 # Run the container, mounting your playground to the container, and open a shell into the container
 docker run -it -v $(pwd)/playground:/mc2/client/playground mc2_img /bin/bash

Building from Source

To install MC2 Client, you’ll need to be running Ubuntu 18.04. Ubuntu 16.04 should also work but is untested.

MC2 Client is written in both C++ and Python. As a result, we’ll have to first build the C++ source, and then build and install the Python package.

  1. Install dependencies.

# CMake
wget https://github.com/Kitware/CMake/releases/download/v3.15.6/cmake-3.15.6-Linux-x86_64.sh
sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local

# Open Enclave
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list && \
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - && \
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain-bionic-7.list && \
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" | sudo tee /etc/apt/sources.list.d/msprod.list && \
wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - && \
sudo apt update
sudo apt -y install clang-8 libssl-dev gdb libsgx-enclave-common libsgx-quote-ex libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave=0.17.1

# Azure CLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

# Mbed TLS and Pip
sudo apt-get install -y libmbedtls-dev python3-pip
pip3 install --upgrade pip

# MC2 Client Python package dependencies
git clone https://github.com/mc2-project/mc2.git
cd mc2
pip3 install -r requirements.txt
cd ..

# Opaque Systems `sequencefile` Python package
git clone https://github.com/opaque-systems/sequencefile.git
cd sequencefile
sudo python3 setup.py install
cd ..
  1. Clone the MC2 Client GitHub repo and install the Python package.

 cd mc2/python-package
 sudo python3 setup.py install

You’re done! Try importing the mc2client Python package to check that your installation was successful.

 $ python3
 Python 3.8.7 (default, Dec 30 2020, 10:13:08)
 [Clang 12.0.0 (clang-1200.0.32.28)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.

 >>> import mc2client as mc2

Azure Login

If you want to manage your Azure resources using MC2 Client, authenticate to Azure and set your subscription ID. Find your subscription ID by following these instructions.

az login
az account set -s <YOUR_SUBSCRIPTION_ID>