Unverified Commit 51b5c04d authored by svetaro's avatar svetaro

Merge branch 'develop' into enhancement/SKALE-1990-Add-timestams-to-logging-in-SGXWallet

parents 9c05d9b8 43ed01d5
...@@ -10,5 +10,7 @@ jobs: ...@@ -10,5 +10,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: submodule update
run: git submodule update --init --recursive
- name: Build the Docker image - name: Build the Docker image
run: cd docker; docker build . --file Dockerfile --tag sgxcontainer:$(date +%s) run: docker build . --file Dockerfile --tag sgxcontainer:$(date +%s)
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
###RUN git clone --recurse-submodules https://76b7983ebf14269178b99eff5b2be4b4b56fe7a5:@github.com/skalenetwork/sgxwallet.git
#RUN git clone --recurse-submodules https://76b7983ebf14269178b99eff5b2be4b4b56fe7a5:@github.com/skalenetwork/sgxwallet.git
#WORKDIR sgxwallet
#RUN cd sgx-software-enable && make && ./sgx_enable
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
### 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 ./
...@@ -2,10 +2,42 @@ FROM ubuntu:bionic ...@@ -2,10 +2,42 @@ FROM ubuntu:bionic
WORKDIR /usr/src/sdk 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-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 RUN apt install -y libprotobuf10 yasm cmake flex bison libprocps-dev ccache autoconf texinfo libssl-dev libboost-all-dev libjsonrpccpp-dev libjsonrpccpp-tools
COPY install-psw.patch ./ COPY docker/install-psw.patch ./
RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \ RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \
cd linux-sgx && \ cd linux-sgx && \
...@@ -18,12 +50,10 @@ RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \ ...@@ -18,12 +50,10 @@ RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \
# For debug purposes # For debug purposes
# COPY jhi.conf /etc/jhi/jhi.conf # COPY docker/jhi.conf /etc/jhi/jhi.conf
###RUN git clone --recurse-submodules https://76b7983ebf14269178b99eff5b2be4b4b56fe7a5:@github.com/skalenetwork/sgxwallet.git COPY configure.gmp ./
RUN git clone --recurse-submodules https://76b7983ebf14269178b99eff5b2be4b4b56fe7a5:@github.com/skalenetwork/sgxwallet.git
WORKDIR sgxwallet
#RUN cd sgx-software-enable && make && ./sgx_enable
RUN cd scripts; ./build.py RUN cd scripts; ./build.py
### RUN autoreconf -vif ### RUN autoreconf -vif
### RUN automake ### RUN automake
...@@ -33,7 +63,7 @@ RUN aclocal ...@@ -33,7 +63,7 @@ RUN aclocal
RUN autoheader || true RUN autoheader || true
RUN automake --force-missing --add-missing RUN automake --force-missing --add-missing
RUN autoconf RUN autoconf
RUN ./configure RUN ./configure --enable-sgx-simulation
### RUN cd libBLS; cmake -H. -Bbuild; cmake --build build -- -j$(nproc); ### RUN cd libBLS; cmake -H. -Bbuild; cmake --build build -- -j$(nproc);
RUN make RUN make
RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-loader-host-interface/archive/072d233296c15d0dcd1fb4570694d0244729f87b.tar.gz | tar -xz && \ RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-loader-host-interface/archive/072d233296c15d0dcd1fb4570694d0244729f87b.tar.gz | tar -xz && \
...@@ -42,4 +72,4 @@ RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-l ...@@ -42,4 +72,4 @@ RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-l
make install && \ make install && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b
COPY start.sh ./ 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
...@@ -85,7 +84,12 @@ automake --force-missing --add-missing ...@@ -85,7 +84,12 @@ automake --force-missing --add-missing
autoconf autoconf
./configure ./configure
make make
```
Note: to run in simulation mode, add --enable-sgx-simulation flag when you run configure.
```
./configure --enable-sgx-simulation
``` ```
## Running sgxwallet ## Running sgxwallet
...@@ -93,17 +97,20 @@ make ...@@ -93,17 +97,20 @@ make
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 +121,6 @@ Then run ...@@ -114,7 +121,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 +132,15 @@ You can start and stop running sgxwallet container by doing ...@@ -126,9 +132,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 +164,6 @@ cat $KEY_FILE ...@@ -152,7 +164,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`.
......
#!/bin/bash #!/bin/bash
#sudo service docker start #sudo service docker start
#sudo docker build -t sgxcontainer . cd ..
sudo docker build --no-cache -t sgxcontainer . sudo docker build -t sgxcontainer .
#sudo docker build --no-cache -t sgxcontainer .
...@@ -8,5 +8,5 @@ jhid -d ...@@ -8,5 +8,5 @@ jhid -d
pid=$! pid=$!
sleep 2 sleep 2
/usr/src/sdk/sgxwallet/sgxwallet $1 /usr/src/sdk/sgxwallet $1
...@@ -83,6 +83,7 @@ subprocess.call(["rm", "-rf", GMP_BUILD_DIR]) ...@@ -83,6 +83,7 @@ subprocess.call(["rm", "-rf", GMP_BUILD_DIR])
subprocess.call(["rm", "-rf", TGMP_BUILD_DIR]) subprocess.call(["rm", "-rf", TGMP_BUILD_DIR])
subprocess.call(["rm", "-rf", SDK_DIR]) subprocess.call(["rm", "-rf", SDK_DIR])
assert subprocess.call(["cp", "configure.gmp", GMP_DIR + "/configure"]) == 0 assert subprocess.call(["cp", "configure.gmp", GMP_DIR + "/configure"]) == 0
os.chdir(LEVELDB_DIR) os.chdir(LEVELDB_DIR)
assert subprocess.call(["bash", "-c", "mkdir -p build"]) == 0 assert subprocess.call(["bash", "-c", "mkdir -p build"]) == 0
......
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