| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 | ******************************************Graphene Library OS with Intel SGX Support******************************************.. image:: https://readthedocs.org/projects/graphene/badge/?version=latest   :target: http://graphene.readthedocs.io/en/latest/?badge=latest   :alt: Documentation Status*A Linux-compatible Library OS for Multi-Process Applications*.. This is not |nbsp|, because that is in rst_prolog in conf.py, which GitHub   cannot parse. GitHub doesn't appear to use it correctly anyway..... |_| unicode:: 0xa0   :trim:What is Graphene?=================Graphene Library OS is a |_| project which provides lightweight guest OSeswith support for Linux multi-process applications. Graphene can run applicationsin an isolated environment with virtualization benefits such as guestcustomization, platform independence, and migration, which is comparable toother virtual machines.Graphene Library OS supports native, unmodified Linux applications onany platform. Currently, Graphene Library OS is successfully ported toLinux, FreeBSD and Intel SGX enclaves upon Linux platforms.With the Intel SGX support, Graphene Library OS can secure a |_| criticalapplication in a |_| hardware encrypted memory region. Graphene Library OS canprotect applications against a |_| malicious system stack with minimal portingeffort.Graphene Library OS is a |_| work published in Eurosys 2014. For moreinformation. see the paper: Tsai, et al, "Cooperation and Security Isolationof Library OSes for Multi-Process Applications", Eurosys 2014.How to build Graphene?======================Graphene Library OS is consist of five parts:- Instrumented GNU C Library- LibOS (a shared library named ``libsysdb.so``)- PAL, a.k.a Platform Adaption Layer (a shared library named ``libpal.so``)Graphene Library OS currently only works on x86_64 architecture.Graphene Library OS is tested to be compiling and running on Ubuntu 14.04/16.04(both server and desktop version), along with Linux kernel 3.5/3.14/4.4.We recommend to build and install Graphene with the same host platform.Other distributions of 64-bit Linux can potentially, but the result is notguaranteed. If you find Graphene not working on other distributions, pleasecontact us with a detailed bug report.Run the following command on Ubuntu to install dependencies for Graphene::    sudo apt-get install -y build-essential autoconf gawk bisonFor building Graphene for SGX, run the following command in addition::    sudo apt-get install -y python-protobufTo run unit tests locally, you also need the python3-pytest package::    sudo apt-get install -y python3-pytestTo build the system, simply run the following commands in the root of thesource tree::    git submodule update --init -- Pal/src/host/Linux-SGX/sgx-driver/    makeEach part of Graphene can be built separately in the subdirectories.To build Graphene library OS with debug symbols, run ``make DEBUG=1``instead of ``make``. To specify custom mirrors for downloading the GLIBCsource, use ``make GLIBC_MIRRORS=...``.To build with ``-Werror``, run ``make WERROR=1``.Build with kernel-level sandboxing (optional)---------------------------------------------This feature is marked as EXPERIMENTAL and no longer exists in the mainstream code.Build with Intel SGX Support----------------------------Prerequisites^^^^^^^^^^^^^1. Generating signing keys   A 3072-bit RSA private key (PEM format) is required for signing the enclaves.   If you don't have a private key, create it with the following command::      openssl genrsa -3 -out enclave-key.pem 3072   You could either put the generated enclave key to the default path,   ``host/Linux-SGX/signer/enclave-key.pem``, or specify the key through   environment variable ``SGX_SIGNER_KEY`` when building Graphene with SGX   support.   After signing the enclaves, users may ship the application files with the   built Graphene Library OS, along with a SGX-specific manifest (.manifest.sgx   files) and the signatures, to the SGX-enabled hosts.2. Installing Intel SGX SDK and driver   The Intel SGX Linux SDK is required for running Graphene Library OS. Download   and install from the official Intel github repositories:   - <https://github.com/01org/linux-sgx>   - <https://github.com/01org/linux-sgx-driver>   A Linux driver must be installed before running Graphene Library OS in   enclaves. Simply run the following command to build the driver::      cd Pal/src/host/Linux-SGX/sgx-driver      make      (The console will be prompted to ask for the path of Intel SGX driver code)      sudo ./load.shBuilding Graphene-SGX^^^^^^^^^^^^^^^^^^^^^To build Graphene Library OS with Intel SGX support, in the root directory ofGraphene repo, run following command::   make SGX=1To build with debug symbols, run the command::   make SGX=1 DEBUG=1Using ``make SGX=1`` in the test or regression directory will automaticallygenerate the enclave signatures (.sig files).Run Built-in Examples in Graphene-SGX^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^There are a few built-in examples under ``LibOS/shim/test/``. The "native"folder includes a |_| rich set of C |_| programs and "apps" folder includesa |_| few tested applications, such as GCC, Python, and Apache.1. Build and run a |_| Hello World program with Graphene on SGX   - go to LibOS/shim/test/native, build the enclaves via command::      make SGX=1     The command will build enclaves for all the programs in the folder   - Generate the token from aesmd service, via command::      make SGX_RUN=1   - Run Hello World program with Graphene on SGX::      SGX=1 ./pal_loader helloworld     or::           ./pal_loader SGX helloworld2. Build and run python helloworld script in Graphene on SGX   - go to LibOS/shim/test/apps/python, build the enclave::      make SGX=1   - Generate token::      make SGX_RUN=1   - Run python helloworld with Graphene-SGX via::      SGX=1 ./python.manifest.sgx scripts/helloworld.pyIncluding Application Test Cases^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^To add the application test cases, issue the following command from the rootof the source tree::   git submodule update --init -- LibOS/shim/test/apps/How to run an application in Graphene?======================================Graphene library OS uses PAL (``libpal.so``) as a loader to bootstrap anapplication in the library OS. To start Graphene, PAL (``libpal.so``) will haveto be run as an executable, with the name of the program, and a |_| "manifestfile" given from the command line. Graphene provides three options forspecifying the programs and manifest files:- option 1 (automatic manifest)::   [PATH TO Runtime]/pal_loader [PROGRAM] [ARGUMENTS]...   (Manifest file: "[PROGRAM].manifest" or "manifest")- option 2 (given manifest)::   [PATH TO Runtime]/pal_loader [MANIFEST] [ARGUMENTS]...- option 3 (manifest as a script)::   [PATH TO MANIFEST]/[MANIFEST] [ARGUMENTS]...   (Manifest must have "#![PATH_TO_PAL]/libpal.so" as the first line)Although manifest files are optional for Graphene, running an applicationusually requires some minimal configuration in its manifest file. A |_| sensiblemanifest file will include paths to the library OS and GNU library C,environment variables such as LD_LIBRARY_PATH and file systems tobe mounted.Here is an example of manifest files::    loader.preload = file:LibOS/shim/src/libsysdb.so    loader.env.LDL_LIBRAY_PATH = /lib    fs.mount.glibc.type = chroot    fs.mount.glibc.path = /lib    fs.mount.glibc.uri = file:LibOS/buildMore examples can be found in the test directories (``LibOS/shim/test``). Wehave also tested several commercial applications such as GCC, Bash and Apache,and the manifest files that bootstrap them in Graphene are provided in theindividual directories.For more information and the detail of the manifest syntax, see the `Graphenedocumentation <https://graphene.rtfd.io/>`_.Contact=======For any questions or bug reports, please send an email to<support@graphene-project.io> or post an issue on our GitHub repository:<https://github.com/oscarlab/graphene/issues>.Our mailing list is publicly archived `here<https://groups.google.com/forum/#!forum/graphene-support>`_.
 |