Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vsock-relay and fixed kernel to nitro-shim for star-randsrv #1899

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions nitro-shim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Build proxies that facilitate communication with the enclave.
FROM golang:1.20 as builder
FROM golang:1.20 as go-builder

WORKDIR /src
COPY tools/ ./
RUN make -C ./viproxy/ viproxy
RUN make -C ./gvproxy/ gvproxy

FROM rust:1.71-alpine as rust-builder

RUN apk add musl-dev

RUN cargo install vsock-relay

FROM amazonlinux:2.0.20230207.0

RUN echo "timeout=60.0" >> /etc/yum.conf
Expand All @@ -18,7 +24,8 @@ RUN amazon-linux-extras install aws-nitro-enclaves-cli -y && \

WORKDIR /enclave

COPY --from=builder /src/viproxy/viproxy /enclave/
COPY --from=builder /src/gvproxy/gvproxy /enclave/
COPY --from=go-builder /src/viproxy/viproxy /enclave/
COPY --from=go-builder /src/gvproxy/gvproxy /enclave/
COPY --from=rust-builder /usr/local/cargo/bin/vsock-relay /enclave/

COPY scripts/ /enclave/
8 changes: 6 additions & 2 deletions nitro-shim/scripts/start-proxies.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -eux

service="${1}"
CID="${2}"
PARENT_CID="3" # the CID of the EC2 instance
Expand All @@ -21,10 +23,12 @@ elif [ "${service}" = "/star-randsrv" ]; then
-listen "unix://${domain_socket}" &
# give gvproxy a second to start
sleep 1
# instruct gvproxy to forward port 443 to the enclave
# instruct gvproxy to forward port 9090 to the enclave
curl \
-X POST \
--unix-socket "$domain_socket" \
-d '{"local":":443","remote":"192.168.127.2:443"}' \
-d '{"local":":9090","remote":"192.168.127.2:9090"}' \
"http:/unix/services/forwarder/expose"
# run vsock relay to proxy incoming requests
/enclave/vsock-relay -s "0.0.0.0:443" -l "4:443" -c 1000 &
fi