-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tee): create SGX container with nix
Signed-off-by: Harald Hoyer <[email protected]>
- Loading branch information
Showing
13 changed files
with
493 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
description = "teepot"; | ||
|
||
inputs = { | ||
nixsgx-flake.url = "github:matter-labs/nixsgx"; | ||
nixpkgs.follows = "nixsgx-flake/nixpkgs"; | ||
|
||
nix-filter.url = "github:numtide/nix-filter"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, nix-filter, nixsgx-flake }: | ||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; overlays = [ nixsgx-flake.overlays.default ]; }; | ||
filter = nix-filter.lib; | ||
extra-inputs = pkgs // { nixpkgs = nixpkgs; pkgs = pkgs; lib = pkgs.lib; }; | ||
|
||
efw-pkgs = { era-fee-withdrawer = era-fee-withdrawer; }; | ||
|
||
era-fee-withdrawer = | ||
pkgs.callPackage | ||
./tee/nix/era-fee-withdrawer.nix | ||
{ | ||
pname = "era-fee-withdrawer"; | ||
version = "2.2.34-pre.0"; | ||
src = filter { | ||
root = ./.; | ||
include = [ | ||
"src" | ||
"tests" | ||
./package.json | ||
./tsconfig.json | ||
./yarn.lock | ||
]; | ||
}; | ||
}; | ||
|
||
docker-era-fee-withdrawer-azure = pkgs.callPackage ./tee/nix/docker-era-fee-withdrawer-azure.nix efw-pkgs; | ||
|
||
docker-era-fee-withdrawer-dcap = pkgs.callPackage ./tee/nix/docker-era-fee-withdrawer-dcap.nix efw-pkgs; | ||
in | ||
{ | ||
formatter = pkgs.nixpkgs-fmt; | ||
|
||
packages = { | ||
era-fee-withdrawer = era-fee-withdrawer; | ||
docker-era-fee-withdrawer-azure = docker-era-fee-withdrawer-azure; | ||
docker-era-fee-withdrawer-dcap = docker-era-fee-withdrawer-dcap; | ||
default = docker-era-fee-withdrawer-azure; | ||
}; | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
inputsFrom = [ era-fee-withdrawer ]; | ||
nativeBuildInputs = with pkgs; [ | ||
nixsgx.gramine | ||
]; | ||
}; | ||
}; | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM era-fee-withdrawer-azure:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY enclave-key.pem era-fee-withdrawer.manifest.toml ./ | ||
|
||
RUN printf "precedence ::ffff:0:0/96 100\n" > /etc/gai.conf | ||
|
||
# The final touch for a reproducible docker file | ||
RUN touch -r /nix/store * .?* /etc/gai.conf | ||
|
||
RUN set -eux; export HOME=/app; \ | ||
gramine-manifest -Darch_libdir=/lib -Dexecdir=/bin -Dlog_level=error era-fee-withdrawer.manifest.toml era-fee-withdrawer.manifest; \ | ||
gramine-sgx-sign --manifest era-fee-withdrawer.manifest --output era-fee-withdrawer.manifest.sgx --key enclave-key.pem; \ | ||
rm enclave-key.pem | ||
|
||
# Uncomment, if a signed sigstruct exists | ||
# COPY era-fee-withdrawer-azure.sig . | ||
# RUN mv era-fee-withdrawer-azure.sig era-fee-withdrawer | ||
RUN touch -r /nix/store era-fee-withdrawer.sig | ||
|
||
ENTRYPOINT ["/bin/sh", "-c"] | ||
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt | ||
ENV UV_USE_IO_URING=0 | ||
|
||
#CMD [ "echo tee-era-fee-withdrawer in simulation mode starting ; exec gramine-direct era-fee-withdrawer" ] | ||
CMD [ "echo tee-era-fee-withdrawer in SGX mode starting ; restart-aesmd ; exec gramine-sgx era-fee-withdrawer" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM era-fee-withdrawer-dcap:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY sgx_default_qcnl.json ./sgx_default_qcnl.conf | ||
RUN rm /etc/sgx_default_qcnl.conf && ln -s /app/sgx_default_qcnl.conf /etc/sgx_default_qcnl.conf | ||
|
||
COPY enclave-key.pem era-fee-withdrawer.manifest.toml ./ | ||
|
||
RUN printf "precedence ::ffff:0:0/96 100\n" > /etc/gai.conf | ||
|
||
# The final touch for a reproducible docker file | ||
RUN touch -r /nix/store * .?* /etc/gai.conf | ||
|
||
RUN set -eux; export HOME=/app; \ | ||
gramine-manifest -Darch_libdir=/lib -Dexecdir=/bin -Dlog_level=error era-fee-withdrawer.manifest.toml era-fee-withdrawer.manifest; \ | ||
gramine-sgx-sign --manifest era-fee-withdrawer.manifest --output era-fee-withdrawer.manifest.sgx --key enclave-key.pem; \ | ||
rm enclave-key.pem | ||
|
||
# Uncomment, if a signed sigstruct exists | ||
# COPY era-fee-withdrawer-dcap.sig . | ||
# RUN mv era-fee-withdrawer-dcap.sig era-fee-withdrawer.sig | ||
RUN touch -r /nix/store era-fee-withdrawer.sig | ||
|
||
ENTRYPOINT ["/bin/sh", "-c"] | ||
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt | ||
ENV UV_USE_IO_URING=0 | ||
|
||
#CMD [ "echo era-fee-withdrawer in simulation mode starting ; exec gramine-direct era-fee-withdrawer" ] | ||
CMD [ "echo era-fee-withdrawer in SGX mode starting ; restart-aesmd ; exec gramine-sgx era-fee-withdrawer" ] |
Oops, something went wrong.