Commit Graph
33 Commits
Author SHA1 Message Date
Michał Kowalczyk ba5e2d2e03 Speed up all tests using sgx.zero_heap_on_demand 2020-07-17 15:10:30 +02:00
Dmitrii Kuvaiskii 1fdc863e2a [Examples,Pal/Linux-SGX] Replace LD_PRELOAD with dlopen in RA-TLS
Previously, RA-TLS was recommended to be used with LD_PRELOAD trick.
However, LD_PRELOAD is too hacky and shouldn't be used to preload
libraries to an executable (in contrast to its normal use of
replacing functions from one library with another). This commit
removes any mentions of LD_PRELOAD trick from RA-TLS, and
replaces LD_PRELOAD with `dlopen()` in ra-tls-mbedtls example.
2020-07-13 21:13:56 +00:00
Michał Kowalczyk 7b0c160296 [Pal] Protect env from untrusted world 2020-07-13 22:05:04 +02:00
Michał Kowalczyk 8bb2d7b54b [Examples] python-simple: Don't print literal -e to stdout 2020-07-11 02:13:03 +02:00
Dmitrii Kuvaiskii c52ae62526 [Pal/Linux-SGX] tools: add Secret Provisioning utility libraries
Secret Provisioning provides a simple interface for enclavized
applications to connect to a trusted secret-provisioning service and
securely pass the secrets inside the SGX enclave. The application acts
as a client and the secret-provisioning service as a server. They
establish a TLS session via mutual authentication, where the service
sends a classical X.509 certificate and the application sends an
RA-TLS X.509 certificate. After the service verifies the RA-TLS
certificate and its SGX-related information, it provisions secrets
to the application. The TLS session may continue to be used by the
application and the server after the initial provisioning. Secret
Provisioning feature relies heavily on RA-TLS.

Secret Provisioning is shipped as three libraries:

- secret_prov_attest.so: creates RA-TLS X.509 certificate with SGX
  quote embedded and sends it to the secret-provisioning service as
  part of mutual attestation of TLS session. Linked into enclavized
  applications. Not thread-safe.
- secret_prov_verify_epid.so: establishes a TLS session with mutual
  attestation, verifies received RA-TLS certificate, and sends secrets
  back to the enclavized application. Linked into secret-provisioning
  service. Verifies RA-TLS certificate using EPID-based flows.
  Multi-threaded and thread-safe (new thread for each client).
- secret_prov_verify_dcap.so: same as secret_prov_verify_epid.so but
  verifies RA-TLS certificate using ECDSA/DCAP-based flows.
  Multi-threaded and thread-safe (new thread for each client).

This commit also adds two Secret Provisioning examples, with a minimal
enclavized app, a more complicated enclavized app, and a single
secret-provisioning service. These examples are added to Jenkins.
2020-07-08 14:16:20 -07:00
Michał Kowalczyk 288f8f0a92 [Examples] Remove LMbench
LMbench was causing a lot of problems in the past and we just noticed
another one (the last one from the list below), which broke the
camel's back :)

Some of the issues:
- Original mirrors are unstable.
- Its source is terrible.
- It's not portable (e.g. needs custom patches to run on Fedora).
- Runs for quite long in CI (a few minutes).
- The last update to the project was 15 years ago (13 on dev branch).
- It uses some features not implemented in Graphene
  (getrusage(RUSAGE_SELF, ...)) without checking for errors, which leads
  to reporting bogus times.
- Actually, it silently skips failures, because the command is piped to
  `tee` and then `tee`'s exit code is checked instead of the original
  command's.
2020-06-18 19:12:13 +02:00
Michał Kowalczyk fcf0a01d7d Remove shebangs from autogenerated manifests
We don't use it in tests, plus it didn't work on SGX - there was a
warning about autogeneration inserted before the autogenerated shebang.

Also, test_106_manifest_with_shebang didn't actually test the shebang
but ran the binary through the loader, so it was meaningless. We'll need
to fix it and implement again after cleaning up Graphene invocation.
2020-06-18 00:44:30 +02:00
Michał Kowalczyk 2c351eeca4 [Examples] tensorflow: Fix default make target
Running `make` without arguments (as advertized in the README)
previously resulted in "make: *** No rule to make target 'all'", because
of ".DEFAULT_GOAL := all" in Scripts/Makefile.Host.
2020-06-18 00:44:30 +02:00
Michał Kowalczyk 324b248852 Rename loader.execname to loader.argv0_override in manifests 2020-06-18 00:44:30 +02:00
Michał Kowalczyk 7e3d9ac87e [Pal] Protect argv from untrusted world 2020-06-16 03:18:47 +02:00
Michał Kowalczyk c05de6874c Fix incorrect usages of 'loader.execname' in manifests 2020-06-16 02:04:41 +02:00
Dmitrii Kuvaiskii 91e882c130 [Pal/Linux-SGX] tools: add RA-TLS utility libraries
RA-TLS integrates Intel SGX remote attestation into the TLS connection
setup. Conceptually, it extends the standard X.509 certificate with
SGX-related information. The additional information allows the receiver
(verifier) of the certificate to verify that it is indeed communicating
with an SGX enclave (attester). RA-TLS is shipped as three libraries:

- ra_tls_attest.so: creates self-signed RA-TLS X.509 certificate with
  SGX quote embedded; typically linked into server apps.
- ra_tls_verify_epid.so: verifies RA-TLS certificate by sending SGX
  quote to IAS and verifying attestation report from IAS; typically
  linked into client apps.
- ra_tls_verify_dcap.so: verifies RA-TLS certificate by providing SGX
  quote v3 to the libsgx_dcap_quoteverify library and relying on its
  assessment of the quote; typically linked into client apps.

This commit also adds an RA-TLS example using simple mbedTLS server
and client. The server generates the RA-TLS certificate, and the client
connects to the server, verifies this certificate, and performs a
dummy HTTP request. This example is added to Jenkins.
2020-06-11 09:20:54 -07:00
Michał Kowalczyk 86686d61c3 [Examples] gcc: download tests instead of inlining in repo 2020-06-09 16:59:57 +00:00
Stefan Berger 162268ea41 [Examples] Patch lmbench for distros without rpc/rpc.h and llseek
Also, add library paths so that lmbench now also works on Fedora.

This should now work on both Fedora and Ubuntu 18.04 and also when
libtircp is not installed, so we can patch unconditionally.
2020-06-08 16:36:07 +02:00
Dayeol Lee e651c1d262 [Examples] Change PyTorch example to load model from a pickle file
- This example will be compared with another example for loading
encrypted models and inputs using PFS. Thus, load the model from a file.
- Updated Makefile and README.md
2020-06-03 12:11:27 -07:00
Stefan Berger 4cd5eba935 [Examples] python-scipy-insecure: Replace x86_64-linux-gnu with $(SYS) 2020-05-21 07:08:15 +00:00
Stefan Berger 9a9add06a2 [Examples] python-simple: Remove apt_pkg.cpython... library from PY_LIBS if SGX=0
It isn't needed and this allows it to run the test on Fedora as well.
2020-05-08 04:02:43 +02:00
borysp b8dc3c5a13 [Examples/lmbench] Add more lmbench download urls
The one lmbench download source we have is very unstable and downloading
often fails. This commit adds more urls that will be iteratively
fetched.
2020-05-07 21:24:55 +02:00
Emil Hemdal f25510a259 [Examples] Support SGX_SIGNER_KEY in all Makefiles
The documentation currently specifies SGX_SIGNER_KEY as the parameter to
enable Graphene to find your keys.

Some examples don't use an environment parameter at all for the key to
sign the enclave, this commit fixes that.
2020-05-07 12:33:10 +02:00
Emil Hemdal 22b35e0cb2 [Examples] Use SGX_SIGNER_KEY in Makefiles
The documentation currently specifies SGX_SIGNER_KEY as the parameter to
enable Graphene to find your keys.

Some examples don't use this environment parameter, this commit fixes
that.
2020-05-07 00:21:18 +02:00
Stefan Berger 244a559c48 [Examples] pytorch: Only fail the build if Ubuntu is not used for SGX
The pytorch example can also run on Fedora, so only fail the build
if Ubuntu is not used but the build is for SGX.
2020-05-06 01:19:35 +02:00
Stefan Berger dfb7743d41 [Examples] Bash: adjust mount path to directory where executable is found
On Ubuntu 'which' finds 'cp' in '/bin/cp' and on Fedora in
'/usr/bin/cp'. Rather than hard-coding the path '/bin', use
$(EXECDIR) and derive its value from the dirname of the path of the
executable, i.e., either '/bin' or '/usr/bin'.
2020-05-01 20:54:04 +00:00
Stefan Berger 17b1245270 [Examples] Python: adapt Python constants for Fedora
Adapt the python constants so that python-simple also works on
Fedora 31. python-scipy-insecure misses some shared libraries on
Fedora 31, so it does not work there yet.
2020-05-01 20:54:04 +00:00
Stefan Berger 741f5f7cd4 [Examples] Python: move Python constants to Scripts/Makefile.python 2020-05-01 20:54:04 +00:00
Stefan Berger f7f89c2ed2 [Makefiles] Make Graphene compileable and testable on Fedora
Adapt Scripts/Makefile.configs so that we can build and test on
Fedora. Most of the tests in Examples are now also runable on
Fedora. Also add a dependency installation target for Fedora to
TensorFlow example.
2020-05-01 20:54:04 +00:00
Stefan Berger 7f90b68566 [Examples] Nginx: unescape the \n when writing it in config file
Unescape the '\n' as a newline when writing it into the nginx config
file rather than writing it as '\n'. Use printf rather than
`/bin/echo -e` since this seems to work for all distros.
2020-05-01 20:54:04 +00:00
Stefan Berger 206eb81eec [Makefiles] Get arch and distro specific vars from Makefile.configs
Extend Makefile.configs and define several variables for make to use
derived from 'gcc -dumpmachine'. In particular:
- ARCH as the architecture, e.g., x86_64
- ARCH_LONG as the long version of the architecture, e.g., x86_64-linux-gnu
- ARCH_LIBDIR as the directory where libraries are located,
  e.g., /lib/x86_64-linux-gnu

In Makefiles and manifest templates, replace the hard-coded
x86_64-linux_gnu and /lib/x86_64-linux-gnu through these variables.
Extend the already existing sed scripts to replace the necessary
variables.
2020-05-01 20:54:04 +00:00
Michał Kowalczyk b8bfb52520 [Examples] TensorFlow: Fix Makefile and .gitignore 2020-05-01 18:03:28 +00:00
Michał Kowalczyk f07ff167fc [Docs] Clean up mentions of integration examples 2020-04-15 23:32:00 +02:00
Michał Kowalczyk 727c2ab049 Fix typos 2020-04-02 01:46:48 +02:00
Michał Kowalczyk 7a356b5a87 [Examples] Fix up TensorFlow
Now it's tested with multiple threads + cleans up properly.
2020-03-30 21:10:41 +02:00
Michał Kowalczyk 5cc0ae0c9e Clean up newly migrated apps and LTP 2020-03-30 21:10:41 +02:00
Michał Kowalczyk 6c7ff2d3a6 Migrate and remove test/apps submodule
We decided to merge the sample app integrations submodule back because
working with git submodules turned out to be really painful. The only
blocker for this was the fact, that previously it contained a lot of
binary blobs and copy-pasted sources, but this was cleaned up recently.

Credits: (authors of particular integration examples, extracted from
commits and PR history in https://github.com/oscarlab/graphene-tests)

apache:     Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
bash:       Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
blender:    borysp <borysp@invisiblethingslab.com>
busybox:    borysp <borysp@invisiblethingslab.com>
capnproto:  Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
curl:       Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
gcc:        Thomas Knauth <thomas.knauth@intel.com>
lighttpd:   Chia-Che Tsai <chiache@tamu.edu>, Thomas Knauth <thomas.knauth@intel.com>
lmbench:    Chia-Che Tsai <chiache@tamu.edu>
memcached:  Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
nginx:      Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
nodejs:     jack.wxz <jack.wxz@alibaba-inc.com>
nodejs-express-server: Eduardo Rodriguez <erodrig@us.ibm.com>
openvino:   Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
python-scipy-insecure: Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
python-simple:         Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
pytorch:    Thomas Knauth <thomas.knauth@intel.com>
r:          Chia-Che Tsai <chiache@tamu.edu>
redis:      Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
tensorflow: Thomas Knauth <thomas.knauth@intel.com>

LTP was moved to LibOS/shim/test/ltp. It was recently rewritten by
Wojtek Porczyk <woju@invisiblethingslab.com>.
2020-03-30 21:10:41 +02:00