-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add docker support #74
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
Open
igladun
wants to merge
3
commits into
flashbots:main
Choose a base branch
from
igladun:feat/dockerfile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| target/ | ||
| .git/ | ||
| *.md | ||
| certs/ | ||
|
|
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,2 @@ | ||
| /target | ||
| remote-cert.crt | ||
| /quotes | ||
| ca.crt | ||
| /target/ | ||
| certs/ |
This file contains hidden or 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,37 @@ | ||
| # Build stage | ||
| FROM rust:1.88.0-slim-bookworm AS builder | ||
|
|
||
| # Build arguments for feature control | ||
| # On x86_64: use "default" for full features including Azure/TPM | ||
| # On ARM (cross-compile not supported for TPM): features will be ignored, uses --no-default-features | ||
| ARG FEATURES=default | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| pkg-config clang libclang-dev \ | ||
| openssl libssl-dev libtss2-dev \ | ||
| perl make \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
| COPY . . | ||
|
|
||
| # On x86_64: build with requested features | ||
| # On ARM: build without azure/TPM features (cross-compilation not supported for TPM libs) | ||
| RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ | ||
| cargo build --release --features "$FEATURES"; \ | ||
| else \ | ||
| echo "WARNING: Building on ARM without Azure/TPM features (cross-compilation not supported)" && \ | ||
| cargo build --release --no-default-features; \ | ||
| fi | ||
|
|
||
| # Runtime stage | ||
| FROM debian:bookworm-slim | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| ca-certificates libssl3 libtss2-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY --from=builder /app/target/release/attested-tls-proxy /usr/local/bin/ | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/attested-tls-proxy"] | ||
|
|
This file contains hidden or 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
This file contains hidden or 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,53 @@ | ||
| services: | ||
| # Simple HTTP backend | ||
| backend: | ||
| image: nginx:alpine | ||
| networks: | ||
| testnet: | ||
| ipv4_address: 172.28.0.10 | ||
|
|
||
| # Proxy server - connects to backend, accepts TLS from client | ||
| proxy-server: | ||
| build: . | ||
| command: | ||
| - server | ||
| - --listen-addr=0.0.0.0:8443 | ||
| - --tls-private-key-path=/certs/server.key | ||
| - --tls-certificate-path=/certs/server.crt | ||
| - --allowed-remote-attestation-type=none | ||
| - "172.28.0.10:80" | ||
| volumes: | ||
| - ./certs:/certs:ro | ||
| ports: | ||
| - "8443:8443" | ||
| depends_on: | ||
| - backend | ||
| networks: | ||
| testnet: | ||
| ipv4_address: 172.28.0.11 | ||
|
|
||
| # Proxy client - accepts HTTP, forwards to proxy-server over TLS | ||
| proxy-client: | ||
| build: . | ||
| command: | ||
| - client | ||
| - --listen-addr=0.0.0.0:8080 | ||
| - proxy-server:8443 | ||
| - --tls-ca-certificate=/certs/ca.crt | ||
| - --allowed-remote-attestation-type=none | ||
| volumes: | ||
| - ./certs:/certs:ro | ||
| ports: | ||
| - "8080:8080" | ||
| depends_on: | ||
| - proxy-server | ||
| networks: | ||
| testnet: | ||
|
|
||
| networks: | ||
| testnet: | ||
| driver: bridge | ||
| ipam: | ||
| config: | ||
| - subnet: 172.28.0.0/16 | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this step was not needed - the files produced by generate-cert.sh work as they are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got
proxy-server-1 | Error: No PKS8 Keyif I don't convert to PKS8By default the generated key is in PKCS#1 format
I debugged a little bit, and as I see here https://github.com/igladun/attested-tls-proxy/blob/310798e582092179e13686cd7fe2a06d68edd83d/src/main.rs#L394
The comment is misleading, the code only uses pkcs8_private_keys()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is a very good catch you are right. Rustls only accepts PKCS8 but openssl wont generate them by default - except with newer versions of openssl.
This explains why we are each seeing different behavior (i am using openssl 3.6.0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#75