-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjustfile
More file actions
320 lines (256 loc) · 7.48 KB
/
justfile
File metadata and controls
320 lines (256 loc) · 7.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# This file is part of Astarte.
#
# Copyright 2025, 2026 SECO Mind Srl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Secure shell
set shell := ['bash', '-euo', 'pipefail', '-c']
# Allow `which`
set unstable
# Get the container runtime
export CONTAINER := if which("podman") != "" {
"podman"
} else if which("docker") != "" {
"docker"
} else if which("podman-remote") != "" {
"podman-remote"
} else {
error("no container runtime")
}
# FDO directory
export FDODIR := "./.tmp/fdo"
export FDO_DEVICE_GUID := "./.tmp/fdo/device_guid.txt"
export REPOS := "./.tmp/repos"
export CONTAINER_CACHE := "./.tmp/cache/containers"
export GO_SERVER_REF := "ade68cda47d4281b8bea8248f45c43cbe1f8bca7"
export ASTARTE_DIR := "./.tmp/astarte"
export ASTARTE_BASE_URL := "astarte.localhost"
export ASTARTE_API_URL := "http://api.astarte.localhost"
export REALM := "test"
export FDO_REALM := "test"
# Print this help message
help:
just --list
# Starts the server and run the full FDO
setup: go-server-setup
# Starts the server and run the full FDO
run: go-server-run client-run
# Build the tpm2-tss
build-tpm2-tss:
./scripts/tpm/build-tpm2-tss.sh
# Clean
clean: go-server-stop astarte-clean
-./scripts/vms/vish-destroy.sh
-rm -rvf "$FDODIR"
-rm -rvf "./.tmp/fdo-astarte"
###
# Rust client
#
# Runs the full fdo protocol
[group('client')]
client-run: client-di go-server-to0 client-to
# Runs the example di
[group('client')]
client-di:
cargo e2e-test plain-fs di --export-guid "$FDO_DEVICE_GUID"
# Runs the example Transfer Ownership
[group('client')]
client-to:
cargo e2e-test plain-fs to
# Shows the device credentials
[group('client')]
client-inspect:
cargo e2e-test plain-fs inspect
####
# Go server and client setup
#
# Setups the go-server
[group('server')]
go-server-setup: go-server-clone go-server-build go-server-keys
# Run all the go-server configuration
[group('server')]
go-server-run: go-server-start go-server-create-rv-info
# Initialize the fdo files and container
[group('server')]
go-server-clone:
./scripts/common/clone.sh \
https://github.com/fido-device-onboard/go-fdo-server.git \
go-fdo-server "$GO_SERVER_REF"
# Builds the go containers
[group('server')]
go-server-build:
./scripts/go-fdo/build.sh go-fdo-server "$GO_SERVER_REF"
# Creates the keys for the server
[group('server')]
go-server-keys:
./scripts/go-fdo/setup.sh
# Run the go servers
[group('server')]
go-server-serve:
./scripts/go-fdo/serve.sh
# Stop the servers
[group('server')]
go-server-stop:
-$CONTAINER stop fdo-rendezvous
-$CONTAINER stop fdo-manufacturer
-$CONTAINER stop fdo-owner
# Check health of servers
[group('server')]
go-server-health:
./scripts/common/try-curl.sh http://localhost:8041/health # Rendezvous
./scripts/common/try-curl.sh http://localhost:8038/health # Manufacturing
./scripts/common/try-curl.sh http://localhost:8043/health # Owner
# Run the go servers and checks the health
[group('server')]
go-server-start: go-server-serve go-server-health
# Create the rendezvous data data
[group('server')]
go-server-create-rv-info:
./scripts/go-fdo/create-rv-info.sh
# Check the rendezvous information
[group('server')]
go-server-get-rv-info:
./scripts/common/try-curl.sh 'http://localhost:8038/api/v1/rvinfo' | jq
./scripts/common/try-curl.sh 'http://localhost:8043/api/v1/owner/redirect' | jq
# Sends the Manufacturing voucher to the owner TO0
[group('server')]
go-server-to0:
./scripts/go-fdo/send-to0.sh
# Use the go client to do all the FDO
[group('server')]
go-client-basic-onboarding:
./scripts/common/clone.sh \
https://github.com/fido-device-onboard/go-fdo-client.git \
go-fdo-client \
21cb545547f06f77cba3aad2aa45fc1d1eeee781
./scripts/go-fdo/build.sh go-fdo-client 21cb545547f06f77cba3aad2aa45fc1d1eeee781
./scripts/go-fdo/basic-onboarding.sh
#
# VM with TPM support
#
# Launch the VM
[group('vm')]
vm-setup:
./scripts/vms/vm-setup.sh
# Launch the VM
[group('vm')]
vm-launch:
./scripts/vms/vish-launch.sh
# Runs FDO in a VM with a TPM
[group('vm')]
vm-run: go-server-run vm-client-run
# SSH into the VM and runs the client
[group('vm')]
vm-client-run: vm-client-di go-server-to0 vm-client-to
# SSH into the VM and runs the example
[group('vm')]
vm-client-di:
./scripts/vms/run-di.sh
# SSH into the VM and runs the example
[group('vm')]
vm-client-to:
./scripts/vms/run-to.sh
# Launch the VM
[group('vm')]
vm-clean:
./scripts/vms/vish-destroy.sh
####
# Astarte
#
# Setups astarte
[group('astarte')]
astarte-setup: astarte-clone astarte-genkeys go-server-setup astarte-build astarte-healty astarte-create-realm
# Builds and starts astarte
[group('astarte')]
astarte-run: go-server-start astarte-rv-info client-di astarte-send-to0 client-to
[group('astarte')]
astarte-clone:
./scripts/common/clone.sh \
https://github.com/astarte-platform/astarte.git \
astarte \
origin/feat/fido-device-onboard
[group('astarte')]
astarte-genkeys:
./scripts/astarte/gen-keys.sh
[group('astarte')]
astarte-build:
./scripts/astarte/build.sh
[group('astarte')]
astarte-create-realm:
./scripts/astarte/create-realm.sh
[group('astarte')]
astarte-rv-info:
./scripts/astarte/create-rv-info.sh
[group('astarte')]
astarte-send-to0:
./scripts/astarte/send-to0.sh
[group('astarte')]
astarte-healty:
./scripts/astarte/healthy.sh
[group('astarte')]
astarte-clean:
-./scripts/astarte/clean.sh
####
# Clea dev
#
#
export CLEA_DEV_RV_DOMAIN := x"fdo-rendezvous.${CLEA_DEV_BASE:-}"
export CLEA_DEV_RV := x"https://fdo-rendezvous.${CLEA_DEV_BASE:-}"
export CLEA_DEV_API := x"https://api.astarte.${CLEA_DEV_BASE:-}"
# Setups clea-dev
[group('clea-dev')]
clea-dev-setup: go-server-setup clea-dev-healty
# Run FDO against clea-dev
[group('clea-dev')]
clea-dev-run: go-server-start clea-dev-rv-info client-di clea-dev-send-to0 client-to
[group('clea-dev')]
clea-dev-rv-info:
./scripts/clea-dev/create-rv-info.sh
[group('clea-dev')]
clea-dev-send-to0:
./scripts/clea-dev/send-to0.sh
[group('clea-dev')]
clea-dev-healty:
./scripts/clea-dev/healthy.sh
####
# Board setup
#
#
export BOARD_RV_DOMAIN := x"fdo-rendezvous.${BOARD_BASE_URL:-}"
export BOARD_RV := x"https://fdo-rendezvous.${BOARD_BASE_URL:-}"
export BOARD_API := x"https://${BOARD_API_PART:-api.astarte}.${BOARD_BASE_URL:-}"
export BOARD_MAN := x"http://fdo-manufactoring.astarte.host:8038"
# Setups board
[group('board')]
board-setup: go-server-setup go-server-start board-healty board-rv-info
[group('board')]
board-rv-info:
./scripts/board/create-rv-info.sh
[group('board')]
board-list-vouchers:
./scripts/common/try-curl.sh "$BOARD_MAN/api/v1/vouchers" | jq
[group('board')]
board-send-to0 guid:
./scripts/board/send-to0.sh '{{ guid }}'
[group('board')]
board-view-ov guid:
./scripts/board/view-ov.sh '{{ guid }}'
[group('board')]
board-healty:
./scripts/board/healthy.sh
[group('board')]
board-clean: go-server-stop
-rm -rvf "$FDODIR"
-rm -rvf "./.tmp/fdo-astarte"