Unverified Commit 68533b09 authored by Stan Kladko's avatar Stan Kladko Committed by GitHub

Merge pull request #28 from skalenetwork/SKALE-2012-sgx-simulation

Skale 2012 sgx simulation
parents 9270b3cb e3c4a605
name: Docker Image CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: submodule update
run: git submodule update --init --recursive
- name: Build the Docker image
run: docker build . --file DockerfileSimulation --tag sgxcontainer:$(date +%s)
FROM ubuntu:bionic
WORKDIR /usr/src/sdk
COPY *.cpp ./
COPY *.h ./
COPY *.txt ./
COPY *.c ./
COPY *.am ./
COPY *.hpp ./
COPY *.sh ./
COPY *.m4 ./
COPY *.gmp ./
COPY *.ac ./
COPY *.json ./
COPY docker ./docker
COPY build-aux ./build-aux
COPY cert ./cert
COPY intel-sgx-ssl ./intel-sgx-ssl
COPY jsonrpc ./jsonrpc
COPY leveldb ./leveldb
COPY libBLS ./libBLS
COPY m4 ./m4
COPY scripts ./scripts
COPY secure_enclave ./secure_enclave
COPY sgx-gmp ./sgx-gmp
COPY sgx-software-enable ./sgx-software-enable
COPY trusted_libff ./trusted_libff
RUN rm -rf /usr/src/sdk/leveldb/build/
RUN apt-get update && apt-get install -yq --no-install-recommends python-yaml vim telnet git ca-certificates build-essential ocaml ocamlbuild automake autoconf libtool wget python libssl-dev libssl-dev libcurl4-openssl-dev protobuf-compiler git libprotobuf-dev alien cmake debhelper uuid-dev libxml2-dev
RUN apt install -y libprotobuf10 yasm cmake flex bison libprocps-dev ccache autoconf texinfo libssl-dev libboost-all-dev libjsonrpccpp-dev libjsonrpccpp-tools
COPY docker/install-psw.patch ./
RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \
cd linux-sgx && \
patch -p1 -i ../install-psw.patch && \
./download_prebuilt.sh 2> /dev/null && \
make -s -j$(nproc) sdk_install_pkg psw_install_pkg && \
./linux/installer/bin/sgx_linux_x64_sdk_2.5.100.49891.bin --prefix=/opt/intel && \
./linux/installer/bin/sgx_linux_x64_psw_2.5.100.49891.bin && \
cd .. && rm -rf linux-sgx/
# For debug purposes
# COPY docker/jhi.conf /etc/jhi/jhi.conf
COPY configure.gmp ./
RUN cd scripts; ./build.py
### RUN autoreconf -vif
### RUN automake
RUN autoreconf -vif
RUN libtoolize --force
RUN aclocal
RUN autoheader || true
RUN automake --force-missing --add-missing
RUN autoconf
RUN ./configure --enable-sgx-simulation
### RUN cd libBLS; cmake -H. -Bbuild; cmake --build build -- -j$(nproc);
RUN make
RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-loader-host-interface/archive/072d233296c15d0dcd1fb4570694d0244729f87b.tar.gz | tar -xz && \
cd dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cmake . -DCMAKE_BUILD_TYPE=Release -DINIT_SYSTEM=SysVinit && \
make install && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b
COPY docker/start.sh ./
...@@ -8,7 +8,7 @@ include $(top_srcdir)/build-aux/sgx_app.am ...@@ -8,7 +8,7 @@ include $(top_srcdir)/build-aux/sgx_app.am
## AM_CPPFLAGS = -I$(SGXSDK_INCDIR) ## AM_CPPFLAGS = -I$(SGXSDK_INCDIR)
## AM_LDFLAGS = -L$(SGXSDK_LIBDIR) ## AM_LDFLAGS = -L$(SGXSDK_LIBDIR)
## ##
## And a pattern rule for building proxy functions from EDL files: ## And a pattern rule for building prexoxy functions from EDL files:
## ##
## %_u.h %_u.c: %.edl ## %_u.h %_u.c: %.edl
## ##
......
...@@ -16,7 +16,6 @@ This sgxwallet library is still in active development and therefore should be re ...@@ -16,7 +16,6 @@ This sgxwallet library is still in active development and therefore should be re
```bash ```bash
sudo apt-get install build-essential make cmake gcc g++ yasm python libprotobuf10 flex bison automake libtool texinfo libgcrypt20-dev libgnutls28-dev sudo apt-get install build-essential make cmake gcc g++ yasm python libprotobuf10 flex bison automake libtool texinfo libgcrypt20-dev libgnutls28-dev
``` ```
## Clone this repository and its submodules ## Clone this repository and its submodules
...@@ -88,22 +87,31 @@ make ...@@ -88,22 +87,31 @@ make
``` ```
Note: to run in simulation mode, add --enable-sgx-simulation flag when you run configure.
```
./configure --enable-sgx-simulation
```
## Running sgxwallet ## Running sgxwallet
Type: Type:
```bash ```bash
`./sgxwallet` ./sgxwallet
``` ```
## Build Docker container ## Build Docker container
```bash ```bash
sudo apt-get install -y docker.io; sudo apt-get install -y docker.io;
cd docker;
sudo docker build -t sgxcontainer . sudo docker build -t sgxcontainer .
```
## Build Docker container in simulation mode
````bash
sudo docker build -t sgxcontainersim -f ./DockerfileSimulation .
``` ```
## Run Docker container ## Run Docker container
...@@ -114,7 +122,6 @@ Then run ...@@ -114,7 +122,6 @@ Then run
```bash ```bash
sudo docker run -di --network host --device /dev/isgx --device /dev/mei0 --name sgxwallet sgxcontainer ./start.sh sudo docker run -di --network host --device /dev/isgx --device /dev/mei0 --name sgxwallet sgxcontainer ./start.sh
``` ```
This will run the server in a Docker container named sgxwallet This will run the server in a Docker container named sgxwallet
...@@ -126,9 +133,15 @@ You can start and stop running sgxwallet container by doing ...@@ -126,9 +133,15 @@ You can start and stop running sgxwallet container by doing
```bash ```bash
docker stop sgxwallet docker stop sgxwallet
docker start sgxwallet docker start sgxwallet
```
## Run Docker container in simulation mode
```bash
sudo docker run -di --network host --name sgxwalletsim sgxcontainersim ./start.sh
``` ```
## Development ## Development
Note that `configure, Makefile` and `Makefile.in` files are created by `automake` tools on the fly. Note that `configure, Makefile` and `Makefile.in` files are created by `automake` tools on the fly.
...@@ -152,7 +165,6 @@ cat $KEY_FILE ...@@ -152,7 +165,6 @@ cat $KEY_FILE
export KEY_PEM_FILE=k.pem export KEY_PEM_FILE=k.pem
openssl rsa -in $KEY_FILE -text > $KEY_PEM_FILE openssl rsa -in $KEY_FILE -text > $KEY_PEM_FILE
cat $KEY_PEM_FILE cat $KEY_PEM_FILE
``` ```
Next, send content of `a.csr` as single line (by replacing real end of lines with `\n`) to port `1027`. Next, send content of `a.csr` as single line (by replacing real end of lines with `\n`) to port `1027`.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment