From 1f53bb32dc5e962cf9c70fa5331d0a4f8a29ab5f Mon Sep 17 00:00:00 2001 From: peg Date: Wed, 25 Nov 2026 08:56:32 +0100 Subject: [PATCH] Remove support for Azure attestation --- .github/workflows/release.yaml | 29 +- .github/workflows/test.yml | 6 +- Cargo.lock | 505 ++---------------- Dockerfile | 24 +- Dockerfile.build-deb | 2 +- Makefile | 5 +- README.md | 59 +- crates/attested-tls-proxy/Cargo.toml | 8 +- crates/attested-tls-proxy/TCP_TUNNEL.md | 7 +- .../attested-tls-proxy/src/cli/attestation.rs | 35 +- crates/attested-tls-proxy/src/cli/mod.rs | 6 +- crates/attested-tls-proxy/src/measurements.rs | 10 - .../tests/tcp_tunnel/cli.rs | 1 - crates/attested-tls/Cargo.toml | 7 +- crates/attested-tls/README.md | 4 +- crates/attested-tls/src/lib.rs | 59 +- .../tests/attestation_provider.rs | 5 +- scripts/check-reproducibility.sh | 2 +- shell.nix | 1 - 19 files changed, 155 insertions(+), 620 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f55f715..6365444 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,14 +21,6 @@ on: description: "Build Binary" required: false type: boolean - features: - default: '' - description: "Additional binary compilation features (azure is always enabled)" - options: - - '' - - 'redact-sensitive' - required: false - type: choice jobs: extract-version: @@ -56,7 +48,6 @@ jobs: echo "| \`GITHUB_REF\` | \`${GITHUB_REF}\` |" >> $GITHUB_STEP_SUMMARY echo "| \`GITHUB_SHA\` | \`${GITHUB_SHA}\` |" >> $GITHUB_STEP_SUMMARY echo "| \`VERSION\` | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY - echo "| \`FEATURES\` | \`${{ format('azure{0}', github.event.inputs.features && format(' {0}', github.event.inputs.features) || '') }}\` |" >> $GITHUB_STEP_SUMMARY build-binary: name: Build binary @@ -72,8 +63,6 @@ jobs: - target: x86_64-unknown-linux-gnu runner: warp-ubuntu-latest-x64-32x profile: reproducible - features: - - ${{ format('azure{0}', github.event.inputs.features && format(' {0}', github.event.inputs.features) || '') }} steps: - uses: actions/checkout@v4 @@ -101,7 +90,6 @@ jobs: docker build \ --build-arg "RUST_TOOLCHAIN=${RUST_TOOLCHAIN}" \ --build-arg "RUST_IMAGE=${RUST_IMAGE}" \ - --build-arg "FEATURES=${{ matrix.features }}" \ --build-arg "VERSION=${{ needs.extract-version.outputs.VERSION }}" \ --build-arg "SOURCE_DATE=${SOURCE_DATE}" \ -f Dockerfile.build-deb -t atp:release \ @@ -110,27 +98,27 @@ jobs: - name: Upload attested-tls-proxy artifact uses: actions/upload-artifact@v4 with: - name: attested-tls-proxy-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} + name: attested-tls-proxy-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }} path: target/${{ matrix.configs.profile }}/attested-tls-proxy - name: Upload attestation-provider-server artifact uses: actions/upload-artifact@v4 with: - name: attestation-provider-server-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} + name: attestation-provider-server-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }} path: target/${{ matrix.configs.profile }}/attestation-provider-server if-no-files-found: error - name: Upload proxy Debian package uses: actions/upload-artifact@v4 with: - name: deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} + name: deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }} path: target/debian/attested-tls-proxy_*.deb if-no-files-found: error - name: Upload provider Debian package uses: actions/upload-artifact@v4 with: - name: attestation-provider-server-deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }} + name: attestation-provider-server-deb-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }} path: target/debian/attestation-provider-server_*.deb if-no-files-found: error @@ -142,7 +130,6 @@ jobs: runs-on: ubuntu-latest env: VERSION: ${{ needs.extract-version.outputs.VERSION }} - BUILD_FEATURES: ${{ format('azure{0}', github.event.inputs.features && format(' {0}', github.event.inputs.features) || '') }} permissions: contents: write steps: @@ -152,25 +139,25 @@ jobs: - name: Download attested-tls-proxy artifact uses: actions/download-artifact@v5 with: - name: attested-tls-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} + name: attested-tls-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu path: artifacts - name: Download proxy Debian package artifact uses: actions/download-artifact@v5 with: - name: deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} + name: deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu path: artifacts - name: Download attestation-provider-server artifact uses: actions/download-artifact@v5 with: - name: attestation-provider-server-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} + name: attestation-provider-server-${{ env.VERSION }}-x86_64-unknown-linux-gnu path: artifacts - name: Download provider Debian package artifact uses: actions/download-artifact@v5 with: - name: attestation-provider-server-deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu-${{ env.BUILD_FEATURES }} + name: attestation-provider-server-deb-${{ env.VERSION }}-x86_64-unknown-linux-gnu path: artifacts - name: Record artifacts checksums diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 669abe5..1a6bca1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y pkg-config libtss2-dev + sudo apt-get install -y pkg-config - name: Set up Rust uses: dtolnay/rust-toolchain@stable @@ -39,7 +39,7 @@ jobs: run: cargo check -p attested-tls --locked - name: Run cargo clippy - run: cargo clippy --workspace --features azure,attested-tls/ws,attested-tls/rpc -- -D warnings + run: cargo clippy --workspace --features attested-tls/ws,attested-tls/rpc --locked -- -D warnings - name: Run cargo test - run: cargo test --workspace --features azure,attested-tls/ws,attested-tls/rpc --all-targets -- --test-threads=1 + run: cargo test --workspace --features attested-tls/ws,attested-tls/rpc --all-targets --locked -- --test-threads=1 diff --git a/Cargo.lock b/Cargo.lock index bdba27f..7ecbe4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,7 @@ dependencies = [ "http", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror", "tracing", ] @@ -193,7 +193,7 @@ dependencies = [ "parking_lot", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror", "tokio", "tower", "tracing", @@ -519,7 +519,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 2.0.17", + "thiserror", "time", ] @@ -589,8 +589,8 @@ dependencies = [ "serde_with", "sha2 0.10.9", "tar", - "thiserror 2.0.17", - "ureq 3.5.0", + "thiserror", + "ureq", "x509-parser", ] @@ -608,37 +608,27 @@ dependencies = [ [[package]] name = "attestation" version = "0.0.1" -source = "git+https://github.com/flashbots/attested-tls?rev=3dd81227d592a316537de6db9afb5b0a050f8f94#3dd81227d592a316537de6db9afb5b0a050f8f94" +source = "git+https://github.com/flashbots/attested-tls?rev=851f5ccf0b5057eb2b947f25dc8a286599adca8b#851f5ccf0b5057eb2b947f25dc8a286599adca8b" dependencies = [ "anyhow", "attest-measure", "attest-types", - "az-cvm-vtpm", - "az-tdx-vtpm", - "base64 0.22.1", "dcap-qvl", "hex", "http", "mock-tdx", - "num-bigint", "once_cell", - "openssl", "parity-scale-codec", "pccs", - "pem-rfc7468 0.7.0", "reqwest 0.13.4", - "rustls-pki-types", - "rustls-webpki", "serde", "serde_json", "socket2 0.6.4", "tdx-attest", - "thiserror 2.0.17", + "thiserror", "tokio", "tracing", - "tss-esapi", - "ureq 3.5.0", - "x509-parser", + "ureq", ] [[package]] @@ -659,7 +649,7 @@ dependencies = [ "serde_json", "sha2 0.10.9", "tempfile", - "thiserror 2.0.17", + "thiserror", "tokio", "tokio-rustls", "tokio-tungstenite", @@ -696,7 +686,7 @@ dependencies = [ "serde_json", "tdx-quote", "tempfile", - "thiserror 2.0.17", + "thiserror", "tokio", "tokio-rustls", "tower-http", @@ -815,42 +805,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "az-cvm-vtpm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3d0900c6757c9674b05b0479236458297026e25fb505186dc8d7735091a21c" -dependencies = [ - "bincode 1.3.3", - "jsonwebkey", - "memoffset", - "openssl", - "serde", - "serde-big-array", - "serde_json", - "sev", - "sha2 0.10.9", - "thiserror 2.0.17", - "tss-esapi", - "zerocopy", -] - -[[package]] -name = "az-tdx-vtpm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04849677b3c0704d4593d89940cde0dc0caad2202bf9fb29352e153782b91ff8" -dependencies = [ - "az-cvm-vtpm", - "base64-url", - "bincode 1.3.3", - "serde", - "serde_json", - "thiserror 2.0.17", - "ureq 2.12.1", - "zerocopy", -] - [[package]] name = "base16ct" version = "0.2.0" @@ -869,12 +823,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -887,50 +835,12 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" -[[package]] -name = "base64-url" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5b428e9fb429c6fda7316e9b006f993e6b4c33005e4659339fb5214479dddec" -dependencies = [ - "base64 0.22.1", -] - [[package]] name = "base64ct" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bincode" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" -dependencies = [ - "bincode_derive", - "serde", - "unty", -] - -[[package]] -name = "bincode_derive" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" -dependencies = [ - "virtue", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -955,32 +865,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitfield" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" - -[[package]] -name = "bitfield" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ba6517c6b0f2bf08be60e187ab64b038438f22dd755614d8fe4d4098c46419" -dependencies = [ - "bitfield-macros", -] - -[[package]] -name = "bitfield-macros" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f48d6ace212fdf1b45fd6b566bb40808415344642b76c3224c07c8df9da81e97" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.108", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -1288,12 +1172,6 @@ dependencies = [ "x509-cert 0.2.5", ] -[[package]] -name = "codicon" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12170080f3533d6f09a19f81596f836854d0fa4867dc32c8172b8474b4e9de61" - [[package]] name = "colorchoice" version = "1.0.4" @@ -1801,27 +1679,6 @@ dependencies = [ "ctutils", ] -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.60.2", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -2010,26 +1867,6 @@ dependencies = [ "syn 2.0.108", ] -[[package]] -name = "enumflags2" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" -dependencies = [ - "enumflags2_derive", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.108", -] - [[package]] name = "equivalent" version = "1.0.2" @@ -2481,7 +2318,7 @@ dependencies = [ "ipnet", "jni", "rand 0.10.2", - "thiserror 2.0.17", + "thiserror", "tinyvec", "tokio", "tracing", @@ -2502,7 +2339,7 @@ dependencies = [ "prefix-trie", "rand 0.10.2", "ring", - "thiserror 2.0.17", + "thiserror", "tinyvec", "tracing", "url", @@ -2529,7 +2366,7 @@ dependencies = [ "resolv-conf", "smallvec", "system-configuration 0.7.0", - "thiserror 2.0.17", + "thiserror", "tokio", "tracing", ] @@ -2552,12 +2389,6 @@ dependencies = [ "digest 0.11.3", ] -[[package]] -name = "hostname-validator" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f558a64ac9af88b5ba400d99b579451af0d39c6d360980045b91aac966d705e2" - [[package]] name = "http" version = "1.3.1" @@ -2877,12 +2708,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "iocuddle" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8972d5be69940353d5347a1344cb375d9b457d6809b428b05bb1ca2fb9ce007" - [[package]] name = "ipconfig" version = "0.3.2" @@ -2965,7 +2790,7 @@ dependencies = [ "jni-sys", "log", "simd_cesu8", - "thiserror 2.0.17", + "thiserror", "walkdir", "windows-link 0.2.1", ] @@ -3054,7 +2879,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror", "tokio", "tower", "tracing", @@ -3079,7 +2904,7 @@ dependencies = [ "serde", "serde_json", "soketto", - "thiserror 2.0.17", + "thiserror", "tokio", "tokio-stream", "tokio-util", @@ -3096,24 +2921,7 @@ dependencies = [ "http", "serde", "serde_json", - "thiserror 2.0.17", -] - -[[package]] -name = "jsonwebkey" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c57c852b14147e2bd58c14fde40398864453403ef632b1101db130282ee6e2cc" -dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", - "generic-array", - "num-bigint", - "serde", - "serde_json", - "thiserror 1.0.69", - "yasna 0.4.0", - "zeroize", + "thiserror", ] [[package]] @@ -3169,16 +2977,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" -[[package]] -name = "libredox" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" -dependencies = [ - "bitflags 2.10.0", - "libc", -] - [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -3238,16 +3036,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" -[[package]] -name = "mbox" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d142aeadbc4e8c679fc6d93fbe7efe1c021fa7d80629e615915b519e3bc6de" -dependencies = [ - "libc", - "stable_deref_trait", -] - [[package]] name = "md-5" version = "0.10.6" @@ -3319,7 +3107,7 @@ dependencies = [ [[package]] name = "mock-tdx" version = "0.0.1" -source = "git+https://github.com/flashbots/attested-tls?rev=3dd81227d592a316537de6db9afb5b0a050f8f94#3dd81227d592a316537de6db9afb5b0a050f8f94" +source = "git+https://github.com/flashbots/attested-tls?rev=851f5ccf0b5057eb2b947f25dc8a286599adca8b#851f5ccf0b5057eb2b947f25dc8a286599adca8b" dependencies = [ "axum", "dcap-qvl", @@ -3449,17 +3237,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.108", -] - [[package]] name = "num-integer" version = "0.1.46" @@ -3499,15 +3276,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c19903c598813dba001b53beeae59bb77ad4892c5c1b9b3500ce4293a0d06c2" -dependencies = [ - "serde", -] - [[package]] name = "oid-registry" version = "0.8.1" @@ -3564,15 +3332,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" -[[package]] -name = "openssl-src" -version = "300.5.4+3.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507b3792995dae9b0df8a1c1e3771e8418b7c2d9f0baeba32e6fe8b06c7cb72" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.117" @@ -3581,7 +3340,6 @@ checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" dependencies = [ "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] @@ -3596,7 +3354,7 @@ dependencies = [ "futures-sink", "js-sys", "pin-project-lite", - "thiserror 2.0.17", + "thiserror", "tracing", ] @@ -3624,15 +3382,9 @@ dependencies = [ "opentelemetry", "percent-encoding", "rand 0.9.2", - "thiserror 2.0.17", + "thiserror", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "or-panic" version = "1.0.2" @@ -3763,7 +3515,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pccs" version = "0.0.1" -source = "git+https://github.com/flashbots/attested-tls?rev=3dd81227d592a316537de6db9afb5b0a050f8f94#3dd81227d592a316537de6db9afb5b0a050f8f94" +source = "git+https://github.com/flashbots/attested-tls?rev=851f5ccf0b5057eb2b947f25dc8a286599adca8b#851f5ccf0b5057eb2b947f25dc8a286599adca8b" dependencies = [ "anyhow", "dcap-qvl", @@ -3771,7 +3523,7 @@ dependencies = [ "rustls", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror", "time", "tokio", "tracing", @@ -3832,41 +3584,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "picky-asn1" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "295eea0f33c16be21e2a98b908fdd4d73c04dd48c8480991b76dbcf0cb58b212" -dependencies = [ - "oid", - "serde", - "serde_bytes", -] - -[[package]] -name = "picky-asn1-der" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df7873a9e36d42dadb393bea5e211fe83d793c172afad5fb4ec846ec582793f" -dependencies = [ - "picky-asn1", - "serde", - "serde_bytes", -] - -[[package]] -name = "picky-asn1-x509" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc9118855ef6387a31b86ceb6e7871cd0149309531df64efc41857b9915b3f5" -dependencies = [ - "base64 0.21.7", - "oid", - "picky-asn1", - "picky-asn1-der", - "serde", -] - [[package]] name = "pin-project" version = "1.1.10" @@ -4126,7 +3843,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2 0.6.4", - "thiserror 2.0.17", + "thiserror", "tokio", "tracing", "web-time", @@ -4148,7 +3865,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.17", + "thiserror", "tinyvec", "tracing", "web-time", @@ -4306,15 +4023,6 @@ dependencies = [ "yasna 0.6.0", ] -[[package]] -name = "rdrand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92195228612ac8eed47adbc2ed0f04e513a4ccb98175b6f2bd04d963b533655" -dependencies = [ - "rand_core 0.6.4", -] - [[package]] name = "redox_syscall" version = "0.5.18" @@ -4324,17 +4032,6 @@ dependencies = [ "bitflags 2.10.0", ] -[[package]] -name = "redox_users" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" -dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror 2.0.17", -] - [[package]] name = "ref-cast" version = "1.0.25" @@ -4754,7 +4451,7 @@ checksum = "6d643f5e972f17219245b82f038c22cd3c74320bb17c6e8f7e8537de268b1bc6" dependencies = [ "arraydeque", "smallvec", - "thiserror 2.0.17", + "thiserror", ] [[package]] @@ -4906,15 +4603,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-big-array" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" -dependencies = [ - "serde", -] - [[package]] name = "serde-human-bytes" version = "0.1.3" @@ -4946,16 +4634,6 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - [[package]] name = "serde_core" version = "1.0.228" @@ -5066,32 +4744,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sev" -version = "6.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420c6c161b5d6883d8195584a802b114af6c884ed56d937d994e30f7f81d54ec" -dependencies = [ - "base64 0.22.1", - "bincode 2.0.1", - "bitfield 0.19.4", - "bitflags 2.10.0", - "byteorder", - "codicon", - "dirs", - "hex", - "iocuddle", - "lazy_static", - "libc", - "openssl", - "rdrand", - "serde", - "serde-big-array", - "serde_bytes", - "static_assertions", - "uuid", -] - [[package]] name = "sha1" version = "0.10.6" @@ -5218,7 +4870,7 @@ source = "git+https://github.com/Dstack-TEE/dstack.git?rev=4699c48ea3a7e568dff4f dependencies = [ "anyhow", "serde", - "thiserror 2.0.17", + "thiserror", ] [[package]] @@ -5428,12 +5080,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "tdx-attest" version = "0.6.0" @@ -5449,7 +5095,7 @@ dependencies = [ "serde-human-bytes", "serde_json", "sha2 0.10.9", - "thiserror 2.0.17", + "thiserror", "vsock", ] @@ -5480,33 +5126,13 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - [[package]] name = "thiserror" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.17", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.108", + "thiserror-impl", ] [[package]] @@ -5812,7 +5438,7 @@ dependencies = [ "opentelemetry_sdk", "rustversion", "smallvec", - "thiserror 2.0.17", + "thiserror", "tracing", "tracing-core", "tracing-log", @@ -5857,39 +5483,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tss-esapi" -version = "7.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ea9ccde878b029392ac97b5be1f470173d06ea41d18ad0bb3c92794c16a0f2" -dependencies = [ - "bitfield 0.14.0", - "enumflags2", - "getrandom 0.2.16", - "hostname-validator", - "log", - "mbox", - "num-derive", - "num-traits", - "oid", - "picky-asn1", - "picky-asn1-x509", - "regex", - "serde", - "tss-esapi-sys", - "zeroize", -] - -[[package]] -name = "tss-esapi-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535cd192581c2ec4d5f82e670b1d3fbba6a23ccce8c85de387642051d7cad5b5" -dependencies = [ - "pkg-config", - "target-lexicon", -] - [[package]] name = "tungstenite" version = "0.28.0" @@ -5903,7 +5496,7 @@ dependencies = [ "log", "rand 0.9.2", "sha1", - "thiserror 2.0.17", + "thiserror", "utf-8", ] @@ -5979,26 +5572,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "unty" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" - -[[package]] -name = "ureq" -version = "2.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" -dependencies = [ - "base64 0.22.1", - "log", - "once_cell", - "serde", - "serde_json", - "url", -] - [[package]] name = "ureq" version = "3.5.0" @@ -6078,7 +5651,6 @@ checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ "getrandom 0.3.4", "js-sys", - "serde", "wasm-bindgen", ] @@ -6100,12 +5672,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "virtue" -version = "0.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" - [[package]] name = "vsock" version = "0.5.4" @@ -6698,7 +6264,7 @@ dependencies = [ "oid-registry", "ring", "rusticata-macros", - "thiserror 2.0.17", + "thiserror", "time", ] @@ -6733,15 +6299,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "yasna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e262a29d0e61ccf2b6190d7050d4b237535fc76ce4c1210d9caa316f71dffa75" -dependencies = [ - "num-bigint", -] - [[package]] name = "yasna" version = "0.5.2" diff --git a/Dockerfile b/Dockerfile index c30bcca..e534da7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ # Build stage FROM rust:1.88.0-slim-bookworm AS builder -# Space-delimited Cargo feature list. `auto` enables Azure support on amd64 and -# disables it on other architectures. -ARG FEATURES=auto +# Optional space-delimited Cargo feature list. +ARG FEATURES="" RUN apt-get update && apt-get install -y \ pkg-config clang libclang-dev \ - openssl libssl-dev libtss2-dev \ + openssl libssl-dev \ perl make \ && rm -rf /var/lib/apt/lists/* @@ -16,19 +15,8 @@ RUN cargo install cargo-auditable@0.7.7 --locked WORKDIR /app COPY . . -# Resolve the architecture-dependent default, then build with exactly the -# requested features. An explicitly empty FEATURES value enables no features. -RUN build_features="$FEATURES"; \ - if [ "$build_features" = "auto" ]; then \ - if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ - build_features="azure"; \ - else \ - build_features=""; \ - echo "WARNING: Building on ARM without Azure/TPM features (cross-compilation not supported)"; \ - fi; \ - fi; \ - if [ -n "$build_features" ]; then \ - cargo auditable build -p attested-tls-proxy --locked --release --no-default-features --features "$build_features"; \ +RUN if [ -n "$FEATURES" ]; then \ + cargo auditable build -p attested-tls-proxy --locked --release --no-default-features --features "$FEATURES"; \ else \ cargo auditable build -p attested-tls-proxy --locked --release --no-default-features; \ fi @@ -37,7 +25,7 @@ RUN build_features="$FEATURES"; \ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y \ - ca-certificates libssl3 libtss2-dev \ + ca-certificates libssl3 \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/attested-tls-proxy /usr/local/bin/ diff --git a/Dockerfile.build-deb b/Dockerfile.build-deb index b9a794d..1495c58 100644 --- a/Dockerfile.build-deb +++ b/Dockerfile.build-deb @@ -10,7 +10,7 @@ RUN sed -i '/^# http/{N;s|^# \(http[^ ]*\)\nURIs: .*|# \1\nURIs: \1|}' /etc/apt/ RUN apt-get -o Acquire::Check-Valid-Until=false update && \ apt-get install -y \ pkg-config clang libclang-dev \ - openssl libssl-dev libtss2-dev \ + openssl libssl-dev \ cmake python3 WORKDIR /build diff --git a/Makefile b/Makefile index 1eb306a..7f8e820 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,6 @@ GIT_TAG ?= $(shell git describe --tags --abbrev=0) FEATURES ?= FEATURE_ARGS = $(if $(strip $(FEATURES)),--features "$(FEATURES)") -COMMA := , -# The provider exposes Azure quote generation through its attestation dependency. -PROVIDER_FEATURE_ARGS = $(if $(filter azure attested-tls/azure,$(subst $(COMMA), ,$(FEATURES))),--features "attestation/azure-attester") ##@ Help @@ -89,7 +86,7 @@ build-attestation-provider: install-cargo-auditable ## Build the provider from t $(BUILD_ENV) cargo auditable build -p attestation-provider-server \ --manifest-path "$$provider_source/Cargo.toml" --target-dir "$(CURDIR)/target" \ --config "$(CURDIR)/target/attestation-provider-profile.toml" \ - $(PROVIDER_FEATURE_ARGS) $(CARGO_BUILD_ARGS) + $(CARGO_BUILD_ARGS) .PHONY: build-dev build-dev: ## Build (debug version) diff --git a/README.md b/README.md index 121883b..1d3c23f 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,9 @@ This aims to be compatible with the formatting used by `cvm-reverse-proxy`. Details and examples of the measurements file format are [in the `attestation` crate documentation](https://github.com/flashbots/attested-tls/tree/main/crates/attestation#measurements-file). -Exactly one verification policy must be provided: either `--measurements-file` or `--allowed-remote-attestation-type`. The latter may be `none` for cases where the remote party is not running in a CVM, but that must be explicitly specified. +Provide exactly one of `--measurements-file` and `--allowed-remote-attestation-type`. +The latter accepts `dcap-tdx` or `tdx` for both generic DCAP and GCP TDX, +`gcp-tdx` for GCP TDX only, or `none` to explicitly allow an unattested peer. As an alternative to specifying measurement values, OS image hashes can be specified. See [portable measurement policies](https://github.com/flashbots/attested-tls/tree/main/crates/attestation#portable-measurement-policies) for details. @@ -72,12 +74,12 @@ Header value: an attestation type given as a string as described below. ### Attestation Types -These are the attestation type names used in the HTTP headers, and the measurements file, and when specifying a local attestation type with the `--client-attestation-type` or `--server-attestation-type` command line options. +The HTTP headers and measurements file use the following attestation types. The +`--client-attestation-type` and `--server-attestation-type` options also accept +`auto` for local platform detection. -- `auto` - detect attestation type (used only when specifying the local attestation type as a command-line argument) - `none` - No attestation provided - `gcp-tdx` - DCAP TDX on Google Cloud Platform -- `azure-tdx` - TDX on Azure, with vTPM attestation - `dcap-tdx` - DCAP TDX (platform not specified) The HTTP and TCP tunnel client/server commands default to `auto` when the local @@ -88,6 +90,17 @@ the attestation and its type. To run without local attestation, explicitly pass corresponding `CLIENT_ATTESTATION_TYPE` / `SERVER_ATTESTATION_TYPE` environment variable to `none`). This is separate from the remote verification policy. +### Upgrading from Azure attestation + +Azure attestation generation and verification have been removed. Remove every +`azure-tdx` record from measurements files before upgrading, including files +that also contain DCAP or GCP records. A file with any Azure record will fail to +load. Update any `azure-tdx` CLI or environment settings to match the deployed +platform. Remove the `--override-azure-outdated-tcb` flag, +`OVERRIDE_AZURE_OUTDATED_TCB` environment variable, and `azure` Cargo feature +from deployment and build settings. For Docker builds that pass `FEATURES=auto`, +omit the argument to use the new default. + ### Attestation Provider `client`, `server`, `tcp-tunnel-client`, `tcp-tunnel-server`, and @@ -96,6 +109,7 @@ variable to `none`). This is separate from the remote verification policy. collection to the local attestation provider service. Use an absolute Unix socket path. When the local attestation type is omitted or set to `auto`, the proxy requests evidence from the provider and uses the type carried in that evidence. +The connection fails if the provider returns evidence for an unsupported platform. For example, with a provider running locally: @@ -128,12 +142,11 @@ GitHub releases include standalone binaries and Debian packages for both proxy binary and package; `attestation-provider-server-sha256sums.txt` covers the provider binary and package. The provider is built from the exact upstream revision pinned by the `attestation` dependency, using upstream's `Cargo.lock`. -It includes Azure quote generation in -the release build and reports its upstream Git revision with `--version`. +It reports its upstream Git revision with `--version`. Both binaries use the same Docker builder, Rust toolchain, reproducible profile, -build flags, and commit timestamp. To build the provider locally in an environment -with the required native libraries, run `make build-attestation-provider FEATURES=azure` +build flags, and commit timestamp. To build the provider locally, run +`make build-attestation-provider` (Python 3.11 or newer is required for checkout and profile preparation). Make invokes Cargo directly for both binaries. To rebuild twice and compare artifact hashes, run `scripts/check-reproducibility.sh`; pass `provider-artifacts` to check only @@ -144,7 +157,7 @@ rebuilding or stripping it. After building the provider locally, run `1~` package version as a release. The package installs the provider at `/usr/bin/attestation-provider-server` and declares its native library dependencies. It also includes the full license from the pinned upstream revision. -`RUST_TOOLCHAIN`, `RUST_IMAGE`, `FEATURES`, `SOURCE_DATE`, and `VERSION` +`RUST_TOOLCHAIN`, `RUST_IMAGE`, `SOURCE_DATE`, and `VERSION` can be set to reproduce a particular release's build inputs. The release workflow records the Rust version, immutable builder image digest, and timestamp in its job summary. @@ -191,23 +204,16 @@ artifacts remain in the root `target/` directory. ```sh cargo build -p attested-tls-proxy --locked -cargo test --workspace --features azure --all-targets --locked -cargo clippy --workspace --features azure --locked -- -D warnings +cargo test --workspace --features attested-tls/ws,attested-tls/rpc --all-targets --locked +cargo clippy --workspace --features attested-tls/ws,attested-tls/rpc --locked -- -D warnings cargo fmt --all -- --check ``` -Omit `--features azure` on systems without the TPM dependencies described below. To install from a local checkout, use `cargo install --path crates/attested-tls-proxy --locked`. Docker and Compose commands also run from the repository root. -The `attested-tls` library's `ws` and `rpc` features are opt-in. To include their -tests, add `attested-tls/ws,attested-tls/rpc` to the test command's feature list. - -## Dependencies and feature flags - -The `azure` feature, for Microsoft Azure attestation requires [tpm2](https://tpm2-software.github.io) to be installed. On Debian-based systems this is provided by [`libtss2-dev`](https://packages.debian.org/trixie/libtss2-dev), and on nix `tpm2-tss`. This dependency is currently not packaged for MacOS, meaning currently it is not possible to compile or run with the `azure` feature on MacOS. - -This feature is disabled by default. Note that without this feature, verification of azure attestations is not possible and azure attestations will be rejected with an error. +The `attested-tls` library's `ws` and `rpc` features are opt-in and included in +the test and lint commands above. ## Trying it out locally (without CVM attestation) @@ -293,19 +299,10 @@ This aims to have a similar command line interface to `cvm-reverse-proxy` but th ```bash docker build -t attested-tls-proxy . - -# Without the Azure feature: -docker build --build-arg FEATURES="" -t attested-tls-proxy . - -# With an explicit space-delimited feature list: -docker build --build-arg FEATURES="azure" -t attested-tls-proxy . ``` -`FEATURES` specifies the complete Cargo feature list; it does not add to a separate implicit list. -When omitted, it defaults to `auto`, which enables `azure` on amd64 and disables it on other -architectures. In particular, Docker builds on ARM Macs automatically compile without Azure/TPM -support because the TPM libraries cannot be cross-compiled. For production builds with full Azure -support, use an x86_64 system. +The optional `FEATURES` build argument takes a space-delimited list of Cargo +features and defaults to an empty list on every architecture. ### Running diff --git a/crates/attested-tls-proxy/Cargo.toml b/crates/attested-tls-proxy/Cargo.toml index c04cdc3..7d6bc6e 100644 --- a/crates/attested-tls-proxy/Cargo.toml +++ b/crates/attested-tls-proxy/Cargo.toml @@ -34,7 +34,7 @@ tracing-subscriber.workspace = true axum = "0.8.8" tower-http = { version = "0.6.7", features = ["fs"] } pin-project-lite = "0.2.16" -pccs = { git = "https://github.com/flashbots/attested-tls", rev = "3dd81227d592a316537de6db9afb5b0a050f8f94" } +pccs = { git = "https://github.com/flashbots/attested-tls", rev = "851f5ccf0b5057eb2b947f25dc8a286599adca8b" } [dev-dependencies] tokio = { workspace = true, features = ["test-util"] } @@ -44,12 +44,6 @@ tdx-quote = { version = "0.0.5", features = ["mock"] } attested-tls = { path = "../attested-tls", features = ["test-helpers", "mock"] } jsonrpsee = { version = "0.26.0", features = ["server"] } -[features] -default = [] - -# Adds support for Microsoft Azure attestation generation and verification -azure = ["attested-tls/azure"] - [package.metadata.deb] maintainer = "Flashbots Team " depends = "$auto" diff --git a/crates/attested-tls-proxy/TCP_TUNNEL.md b/crates/attested-tls-proxy/TCP_TUNNEL.md index 7b8f576..89076c9 100644 --- a/crates/attested-tls-proxy/TCP_TUNNEL.md +++ b/crates/attested-tls-proxy/TCP_TUNNEL.md @@ -88,15 +88,14 @@ settings follow the [HTTP proxy CLI](../../README.md#measurements-file). | `--attestation-provider-socket ` (`ATTESTATION_PROVIDER_SOCKET`) | Absolute Unix socket path for quote generation and platform metadata collection. The provider supplies the actual attestation type. See [provider configuration](../../README.md#attestation-provider). | | `--pccs-url` | Same meaning as in the HTTP proxy. | | `--log-debug`, `--log-json`, `--log-dcap-quote` | Debug logs, structured logs, or DCAP quote dumps in `quotes/`. Logs go to stderr; the default level is info. Payload bytes are never logged. | -| `--override-azure-outdated-tcb` | Same Azure verification override as in the HTTP proxy. | The existing environment names are supported: `MEASUREMENTS_FILE`, `TLS_PRIVATE_KEY_PATH`, `TLS_CERTIFICATE_PATH`, `CLIENT_ATTESTATION_TYPE`, `SERVER_ATTESTATION_TYPE`, `ATTESTATION_PROVIDER_SOCKET`, and -`OVERRIDE_AZURE_OUTDATED_TCB`. +`INTEL_PCS_SUBSCRIPTION_KEY`. -Enable Azure support with `--features azure`; this requires the same TPM system -dependencies as the HTTP proxy. There is no health-check listener in this version. +For existing deployments, see [Upgrading from Azure attestation](../../README.md#upgrading-from-azure-attestation). +There is no health-check listener in this version. ## Lifecycle and trust diff --git a/crates/attested-tls-proxy/src/cli/attestation.rs b/crates/attested-tls-proxy/src/cli/attestation.rs index 9f52c5c..38630b6 100644 --- a/crates/attested-tls-proxy/src/cli/attestation.rs +++ b/crates/attested-tls-proxy/src/cli/attestation.rs @@ -11,7 +11,6 @@ pub(super) async fn build_verifier( pccs_url: Option, intel_pcs_subscription_key: Option, log_dcap_quote: bool, - override_azure_outdated_tcb: bool, ) -> anyhow::Result { if log_dcap_quote { tokio::fs::create_dir_all("quotes").await?; @@ -42,8 +41,7 @@ pub(super) async fn build_verifier( let mut attestation_verifier_builder = AttestationVerifier::builder(measurement_policy) .with_cache_policy(CachePolicy::OnDemand) - .with_dump_dcap_quotes(log_dcap_quote) - .with_override_azure_outdated_tcb(override_azure_outdated_tcb); + .with_dump_dcap_quotes(log_dcap_quote); if let Some(pccs_url) = pccs_url { attestation_verifier_builder = attestation_verifier_builder.with_pccs_url(pccs_url); } @@ -63,7 +61,7 @@ pub(super) fn build_attestation_generator( if provider_socket.is_some() && matches!(requested_type.as_deref(), None | Some("auto")) { // The pinned provider API needs a non-None type to enable requests. // It only uses this value as an on/off switch: the returned evidence - // supplies the actual platform, including GCP and Azure. + // supplies the actual platform. return Ok(AttestationGenerator::new( AttestationType::DcapTdx, provider_socket, @@ -105,11 +103,7 @@ mod tests { .to_string(); assert!(error.contains("No supported attestation platform detected")); assert!(error.contains(&format!("{option} none"))); - for platform in [ - AttestationType::DcapTdx, - AttestationType::GcpTdx, - AttestationType::AzureTdx, - ] { + for platform in [AttestationType::DcapTdx, AttestationType::GcpTdx] { validate_platform(platform, requested, option).unwrap(); } } @@ -174,7 +168,7 @@ mod tests { let listener = UnixListener::bind(&path).unwrap(); let cases = [ (None, AttestationType::GcpTdx), - (Some("auto"), AttestationType::AzureTdx), + (Some("auto"), AttestationType::DcapTdx), ]; let provider = std::thread::spawn(move || { for (_, actual_type) in cases { @@ -211,7 +205,7 @@ mod tests { ) .unwrap(); let message = generator.generate_attestation([42; 64]).unwrap(); - assert_eq!(message.attestation_type(), actual_type); + assert_eq!(message.attestation_type().unwrap(), actual_type); assert_eq!(message.attestation_evidence.unwrap().quote, [42; 64]); } provider.join().unwrap(); @@ -239,4 +233,23 @@ mod tests { assert_eq!(actual.to_string(), expected.to_string()); } } + + #[tokio::test] + async fn verifier_rejects_measurements_file_with_azure_record() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("measurements.json"); + tokio::fs::write( + &path, + r#"[{"attestation_type":"dcap-tdx"},{"attestation_type":"azure-tdx"}]"#, + ) + .await + .unwrap(); + + let result = + build_verifier(Some(path.to_str().unwrap().into()), None, None, None, false).await; + let Err(error) = result else { + panic!("measurements file with an Azure record was accepted"); + }; + assert!(error.to_string().contains("unknown variant `azure-tdx`")); + } } diff --git a/crates/attested-tls-proxy/src/cli/mod.rs b/crates/attested-tls-proxy/src/cli/mod.rs index b044e2b..4915793 100644 --- a/crates/attested-tls-proxy/src/cli/mod.rs +++ b/crates/attested-tls-proxy/src/cli/mod.rs @@ -19,7 +19,7 @@ pub(crate) struct Cli { /// Path to file, or URL, containing JSON measurements to be enforced on the remote party #[arg(long, global = true, env = "MEASUREMENTS_FILE")] measurements_file: Option, - /// If no measurements file is specified, a single attestion type to allow + /// Allowed attestation type when no measurements file is specified, or tdx for DCAP and GCP #[arg(long, global = true)] allowed_remote_attestation_type: Option, /// The URL of a PCCS to use when verifying DCAP attestations. Defaults to Intel PCS. @@ -44,9 +44,6 @@ pub(crate) struct Cli { /// Log DCAP quotes to folder `quotes/` #[arg(long, global = true)] log_dcap_quote: bool, - /// Overrides Azure outdated TCB info - #[arg(long, global = true, env = "OVERRIDE_AZURE_OUTDATED_TCB")] - override_azure_outdated_tcb: bool, } #[derive(Subcommand, Debug, Clone)] @@ -85,7 +82,6 @@ impl Cli { self.pccs_url, self.intel_pcs_subscription_key, self.log_dcap_quote, - self.override_azure_outdated_tcb, ) .await?; match self.command { diff --git a/crates/attested-tls-proxy/src/measurements.rs b/crates/attested-tls-proxy/src/measurements.rs index 5c2dfdb..528bb35 100644 --- a/crates/attested-tls-proxy/src/measurements.rs +++ b/crates/attested-tls-proxy/src/measurements.rs @@ -22,10 +22,6 @@ impl MeasurementHeaders for MultiMeasurements { .enumerate() .map(|(index, value)| (index.to_string(), hex::encode(value))) .collect(), - Self::Azure(m) => m - .iter() - .map(|(index, value)| (index.to_string(), hex::encode(value))) - .collect(), Self::NoAttestation => HashMap::new(), }; Ok(HeaderValue::from_str(&serde_json::to_string(&values)?)?) @@ -49,12 +45,6 @@ impl MeasurementHeaders for MultiMeasurements { let values: HashMap = serde_json::from_str(input)?; Ok(match attestation_type { AttestationType::None => Self::NoAttestation, - AttestationType::AzureTdx => Self::Azure( - values - .into_iter() - .map(|(k, v)| Ok((u32::from(k), decode(&v)?))) - .collect::>()?, - ), AttestationType::DcapTdx | AttestationType::GcpTdx => { if values.len() != 5 || values.keys().any(|k| *k > 4) { return Err(MeasurementFormatError::BadRegisterIndex); diff --git a/crates/attested-tls-proxy/tests/tcp_tunnel/cli.rs b/crates/attested-tls-proxy/tests/tcp_tunnel/cli.rs index 7d0ea3b..d5f3a5e 100644 --- a/crates/attested-tls-proxy/tests/tcp_tunnel/cli.rs +++ b/crates/attested-tls-proxy/tests/tcp_tunnel/cli.rs @@ -22,7 +22,6 @@ fn clean_command(program: &str) -> Command { "TLS_CERTIFICATE_PATH", "CLIENT_ATTESTATION_TYPE", "SERVER_ATTESTATION_TYPE", - "OVERRIDE_AZURE_OUTDATED_TCB", ] { command.env_remove(variable); } diff --git a/crates/attested-tls/Cargo.toml b/crates/attested-tls/Cargo.toml index 9011d3c..c418359 100644 --- a/crates/attested-tls/Cargo.toml +++ b/crates/attested-tls/Cargo.toml @@ -18,7 +18,7 @@ http.workspace = true serde_json.workspace = true tracing.workspace = true parity-scale-codec = "3.7.5" -attestation = { git = "https://github.com/flashbots/attested-tls", rev = "3dd81227d592a316537de6db9afb5b0a050f8f94" } +attestation = { git = "https://github.com/flashbots/attested-tls", rev = "851f5ccf0b5057eb2b947f25dc8a286599adca8b" } # Used for websocket support tokio-tungstenite = { version = "0.28.0", optional = true } @@ -44,14 +44,11 @@ hyper = { workspace = true, features = ["client", "server", "http2"] } hyper-util = { workspace = true, features = ["tokio"] } tokio-rustls = { workspace = true, features = ["aws_lc_rs"] } tempfile.workspace = true -attestation = { git = "https://github.com/flashbots/attested-tls", rev = "3dd81227d592a316537de6db9afb5b0a050f8f94", features = ["mock"] } +attestation = { git = "https://github.com/flashbots/attested-tls", rev = "851f5ccf0b5057eb2b947f25dc8a286599adca8b", features = ["mock"] } [features] default = [] -# Adds support for Microsoft Azure attestation generation and verification -azure = ["attestation/azure"] - # Adds websocket support ws = ["tokio-tungstenite", "futures-util"] diff --git a/crates/attested-tls/README.md b/crates/attested-tls/README.md index 916d608..bda8b98 100644 --- a/crates/attested-tls/README.md +++ b/crates/attested-tls/README.md @@ -33,9 +33,7 @@ Immediately after the TLS handshake, an attestation exchange is made. The server Attestation exchange messages are formatted as follows: - A 4 byte length prefix - a big endian encoded unsigned 32 bit integer -- A SCALE (Simple Concatenated Aggregate Little-Endian) encoded [struct in the attestation crate](https://github.com/flashbots/attested-tls/blob/main/crates/attestation/src/lib.rs) with the following fields: - - `attestation_type` - a string with one of the attestation types (described above) including `none`. - - `attestation` - the actual attestation data. In the case of DCAP this is a binary quote report. In the case of `none` this is an empty byte array. +- A SCALE (Simple Concatenated Aggregate Little-Endian) encoded [`AttestationExchangeMessage`](https://github.com/flashbots/attested-tls/blob/851f5ccf0b5057eb2b947f25dc8a286599adca8b/crates/attestation/src/lib.rs#L59). Its optional `attestation_evidence` contains a DCAP quote and platform metadata for `dcap-tdx` or `gcp-tdx`. An absent value represents `none`. SCALE is used by parity/substrate and was chosen because it is simple and actually matches the formatting used in TDX quotes. So it was already used as a dependency (via the [`dcap-qvl`](https://docs.rs/dcap-qvl) crate). diff --git a/crates/attested-tls/src/lib.rs b/crates/attested-tls/src/lib.rs index 33d73cf..3f0d540 100644 --- a/crates/attested-tls/src/lib.rs +++ b/crates/attested-tls/src/lib.rs @@ -172,22 +172,16 @@ impl AttestedTlsServer { let attestation_generator = self.attestation_generator.clone(); self.quote_work .run(move || attestation_generator.generate_attestation(input_data)) - .await - .map_err(AttestedTlsError::from)?? - .encode() + .await?? }; - // Write our attestation to the channel, with length prefix - let attestation_length_prefix = checked_length_prefix(&attestation)?; - tls_stream.write_all(&attestation_length_prefix).await?; - tls_stream.write_all(&attestation).await?; + write_attestation(&mut tls_stream, attestation).await?; - // Now read a length-prefixed attestation from the remote peer - // In the case of no client attestation this will be zero bytes + // Read the remote peer's length-prefixed attestation message. let buf = read_length_prefixed_attestation(&mut tls_stream).await?; let remote_attestation_message = AttestationExchangeMessage::decode(&mut &buf[..])?; - let remote_attestation_type = remote_attestation_message.attestation_type(); + let remote_attestation_type = remote_attestation_message.attestation_type()?; // Validate every exchange, including policies that only accept no attestation, // before exposing the peer's attestation type to callers. @@ -348,7 +342,7 @@ impl AttestedTlsClient { let buf = read_length_prefixed_attestation(&mut tls_stream).await?; let remote_attestation_message = AttestationExchangeMessage::decode(&mut &buf[..])?; - let remote_attestation_type = remote_attestation_message.attestation_type(); + let remote_attestation_type = remote_attestation_message.attestation_type()?; // Verify the remote attestation against our accepted measurements let measurements = self @@ -363,17 +357,12 @@ impl AttestedTlsClient { let attestation_generator = self.attestation_generator.clone(); self.quote_work .run(move || attestation_generator.generate_attestation(local_input_data)) - .await - .map_err(AttestedTlsError::from)?? - .encode() + .await?? } else { - AttestationExchangeMessage::without_attestation().encode() + AttestationExchangeMessage::without_attestation() }; - // Send our attestation (or zero bytes) prefixed with length - let attestation_length_prefix = checked_length_prefix(&attestation)?; - tls_stream.write_all(&attestation_length_prefix).await?; - tls_stream.write_all(&attestation).await?; + write_attestation(&mut tls_stream, attestation).await?; Ok((tls_stream, measurements, remote_attestation_type)) } @@ -539,6 +528,18 @@ fn validate_attestation_length(length: usize) -> Result<(), AttestedTlsError> { Ok(()) } +async fn write_attestation( + io: &mut IO, + message: AttestationExchangeMessage, +) -> Result<(), AttestedTlsError> { + // A provider may still return evidence for an unsupported platform. + message.attestation_type()?; + let encoded = message.encode(); + io.write_all(&checked_length_prefix(&encoded)?).await?; + io.write_all(&encoded).await?; + Ok(()) +} + async fn read_length_prefixed_attestation(io: &mut IO) -> Result, AttestedTlsError> where IO: AsyncRead + Unpin, @@ -627,6 +628,26 @@ mod tests { use attestation::{CachePolicy, measurements::MeasurementPolicy}; use tokio::net::TcpListener; + #[tokio::test] + async fn rejects_azure_evidence_before_sending_it() { + let mut platform = attestation::mock_platform_metadata(AttestationType::DcapTdx).unwrap(); + platform.attestation_type = serde_json::from_str(r#""azure-tdx""#).unwrap(); + let message = attestation::AttestationEvidence { + quote: vec![0], + platform, + } + .into(); + + let mut output = Vec::new(); + assert!(matches!( + write_attestation(&mut output, message).await, + Err(AttestedTlsError::Attestation( + AttestationError::AttestationTypeNotSupported + )) + )); + assert!(output.is_empty()); + } + #[test] fn report_input_rejects_empty_and_malformed_certificate_chains() { assert!(matches!( diff --git a/crates/attested-tls/tests/attestation_provider.rs b/crates/attested-tls/tests/attestation_provider.rs index 22ac210..0dd1f2c 100644 --- a/crates/attested-tls/tests/attestation_provider.rs +++ b/crates/attested-tls/tests/attestation_provider.rs @@ -48,7 +48,10 @@ fn provider_receives_each_binding_and_returns_assembled_evidence() { for input in [[42; 64], [73; 64]] { let message = generator.generate_attestation(input).unwrap(); - assert_eq!(message.attestation_type(), AttestationType::DcapTdx); + assert_eq!( + message.attestation_type().unwrap(), + AttestationType::DcapTdx + ); let evidence = message.attestation_evidence.unwrap(); assert_eq!(evidence.quote, input); assert_eq!( diff --git a/scripts/check-reproducibility.sh b/scripts/check-reproducibility.sh index b843578..185c8e9 100755 --- a/scripts/check-reproducibility.sh +++ b/scripts/check-reproducibility.sh @@ -11,7 +11,7 @@ trap 'rm -rf "$repro_dir"' EXIT rust_toolchain=${RUST_TOOLCHAIN:-$(rustc --version | cut -d' ' -f2)} rust_image=${RUST_IMAGE:-$(docker buildx imagetools inspect "docker.io/rust:$rust_toolchain-trixie" --format '{{.Name}}@{{.Manifest.Digest}}')} -features=${FEATURES-azure} +features=${FEATURES:-} source_date=${SOURCE_DATE:-$(git log -1 --pretty=%ct)} for build in 1 2; do diff --git a/shell.nix b/shell.nix index a3fe682..8735c44 100644 --- a/shell.nix +++ b/shell.nix @@ -6,7 +6,6 @@ pkgs.mkShell { ]; buildInputs = with pkgs;[ - tpm2-tss openssl ]; }