Skip to content

Commit fbcd74a

Browse files
authored
[launcher][KeyManager] Integrate KeyManager into the Confidential Spa… (google#678)
This commit integrates the KeyManager Workload Service into the Confidential Space launcher and ensures it is properly built and included in the resulting images. Key changes: - Corrected the argument order in `NewServer` calls within `keymanager/workload_service/server_test.go` and `integration_test.go` to match the expected interface definitions. - Updated `launcher/cloudbuild.yaml` to install Rust, CMake, and the C++ toolchain in the `golang:1.24` build environment, enabling the `CGO_ENABLED=1` build of the launcher to successfully link the KeyManager Rust libraries via FFI. - Hooked the KeyManager Server into `launcher/container_runner.go`, configured to start listening on `kmaserver.sock` when the `EnableKeyManager` experiment is active. - Added the `EnableKeyManager` flag to the `Experiments` struct and updated relevant tests and configurations to support the new feature toggle.
1 parent 97295ba commit fbcd74a

File tree

22 files changed

+870
-85
lines changed

22 files changed

+870
-85
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
runs-on: ${{ matrix.os }}
4444
steps:
4545
- uses: actions/checkout@v3
46+
with:
47+
submodules: recursive
4648
- uses: actions/setup-go@v6
4749
with:
4850
go-version: ${{ matrix.go-version }}
@@ -54,6 +56,19 @@ jobs:
5456
version: "3.20.1"
5557
- name: Install protoc-gen-go
5658
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0
59+
- name: Setup Rust
60+
uses: dtolnay/rust-toolchain@stable
61+
- name: Install Build Dependencies (Linux)
62+
run: sudo apt-get update && sudo apt-get install -y cmake clang pkg-config libssl-dev
63+
if: runner.os == 'Linux' && matrix.architecture == 'x64'
64+
- name: Install bindgen-cli
65+
run: cargo install bindgen-cli
66+
if: runner.os == 'Linux' && matrix.architecture == 'x64'
67+
- name: Build KeyManager Rust library
68+
run: |
69+
cd keymanager
70+
cargo build --release
71+
if: runner.os == 'Linux' && matrix.architecture == 'x64'
5772
- name: Check Protobuf Generation
5873
run: |
5974
go generate ./... ./cmd/... ./launcher/... ./verifier/...
@@ -71,8 +86,11 @@ jobs:
7186
- name: Install Windows packages
7287
run: choco install openssl
7388
if: runner.os == 'Windows'
74-
- name: Build all modules except launcher
89+
- name: Build all modules except launcher and keymanager
7590
run: go build -v ./... ./cmd/... ./verifier/...
91+
- name: Build keymanager module
92+
run: go build -v ./keymanager/...
93+
if: runner.os == 'Linux' && matrix.architecture == 'x64'
7694
- name: Build launcher module
7795
run: go build -v ./launcher/...
7896
if: runner.os == 'Linux'
@@ -84,22 +102,37 @@ jobs:
84102
- name: Run all tests in launcher to capture potential data race
85103
run: go test -v -race ./launcher/...
86104
if: (runner.os == 'Linux') && matrix.architecture == 'x64'
87-
- name: Test all modules except launcher
105+
- name: Test all modules except launcher and keymanager
88106
run: go test -v ./... ./cmd/... ./verifier/... -skip='TestCacheConcurrentSetGet|TestHwAttestationPass|TestHardwareAttestationPass'
107+
- name: Test keymanager module
108+
run: go test -v ./keymanager/...
109+
if: runner.os == 'Linux' && matrix.architecture == 'x64'
89110

90111
lint:
91112
strategy:
92113
matrix:
93114
go-version: [1.24.x]
94115
os: [ubuntu-latest]
95-
dir: ["./", "./cmd", "./launcher"]
116+
dir: ["./", "./cmd", "./launcher", "./keymanager"]
96117
name: Lint ${{ matrix.dir }} (${{ matrix.os }}, Go ${{ matrix.go-version }})
97118
runs-on: ${{ matrix.os }}
98119
steps:
99120
- uses: actions/checkout@v3
121+
with:
122+
submodules: recursive
100123
- uses: actions/setup-go@v2
101124
with:
102125
go-version: ${{ matrix.go-version }}
126+
- name: Setup Rust
127+
uses: dtolnay/rust-toolchain@stable
128+
- name: Install Build Dependencies (Linux)
129+
run: sudo apt-get update && sudo apt-get install -y cmake clang pkg-config libssl-dev
130+
- name: Install bindgen-cli
131+
run: cargo install bindgen-cli
132+
- name: Build KeyManager Rust library
133+
run: |
134+
cd keymanager
135+
cargo build --release
103136
- name: Run golangci-lint
104137
uses: golangci/golangci-lint-action@v3.2.0
105138
with:
@@ -127,11 +160,21 @@ jobs:
127160
runs-on: ${{ matrix.os }}
128161
steps:
129162
- uses: actions/checkout@v3
163+
with:
164+
submodules: recursive
130165
- uses: actions/setup-go@v2
131166
with:
132167
go-version: ${{ matrix.go-version }}
133-
- name: Install Linux packages
134-
run: sudo apt-get -y install libssl-dev
168+
- name: Setup Rust
169+
uses: dtolnay/rust-toolchain@stable
170+
- name: Install Build Dependencies (Linux)
171+
run: sudo apt-get update && sudo apt-get install -y cmake clang pkg-config libssl-dev
172+
- name: Install bindgen-cli
173+
run: cargo install bindgen-cli
174+
- name: Build KeyManager Rust library
175+
run: |
176+
cd keymanager
177+
cargo build --release
135178
- name: Check for CGO Warnings (gcc)
136179
run: CGO_CFLAGS=-Werror CC=gcc go build ./...
137180
- name: Check for CGO Warnings (clang)

.github/workflows/releaser.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,17 @@ jobs:
4242
path: dist/${{ matrix.os }}
4343
key: ${{ matrix.go }}-${{ env.sha_short }}
4444
- name: Install Linux packages
45-
run: sudo apt-get -y install libssl-dev
45+
run: sudo apt-get update && sudo apt-get -y install libssl-dev cmake clang pkg-config
46+
if: runner.os == 'Linux'
47+
- name: Setup Rust
48+
uses: dtolnay/rust-toolchain@stable
49+
- name: Install bindgen-cli
50+
run: cargo install bindgen-cli
51+
if: runner.os == 'Linux'
52+
- name: Build KeyManager Rust library
53+
run: |
54+
cd keymanager
55+
cargo build --release
4656
if: runner.os == 'Linux'
4757
- name: Build all modules
4858
run: go build -v ./... ./cmd/... ./launcher/... ./verifier/...

0 commit comments

Comments
 (0)