Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
228 lines (189 loc) · 7.73 KB
/
Copy pathMakefile
File metadata and controls
228 lines (189 loc) · 7.73 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
.PHONY: init build certs client-ca up down logs wait clean \
restart-vouch vouch-logs \
test-oidc-basic test-oidc-config test-oidc-dynamic test-oidc-formpost \
test-oidc-rp-logout \
test-fapi2 test-fapi2-sp-mtls-mtls test-fapi2-sp-mtls-dpop \
test-fapi2-sp-pk-mtls \
test-fapi2-ms test-fapi2-ms-jarm \
test-fapi2-ms-mtls test-fapi2-ms-mtls-jarm \
test-fapi2-all-sp test-fapi2-all-ms test-fapi2-all \
test-all rerun-failures
CONFORMANCE_SERVER ?= https://localhost.emobix.co.uk:8443
VOUCH_URL ?= https://localhost:9443
SCRIPTS := scripts
CONFIG := config
PYTHON := .venv/bin/python
$(PYTHON):
uv sync
# -- Setup --------------------------------------------------------------------
init:
git submodule update --init --recursive
certs: client-ca
@mkdir -p certs
@test -f certs/vouch.crt || \
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout certs/vouch.key \
-out certs/vouch.crt \
-subj "/CN=vouch" \
-addext "subjectAltName=DNS:vouch,DNS:localhost" \
2>/dev/null && \
echo "Generated certs/vouch.crt"
@test -f certs/vouch-tls.env || { \
echo "VOUCH_TLS_CERT=$$(base64 < certs/vouch.crt | tr -d '\n')" > certs/vouch-tls.env && \
echo "VOUCH_TLS_KEY=$$(base64 < certs/vouch.key | tr -d '\n')" >> certs/vouch-tls.env && \
echo "Generated certs/vouch-tls.env"; \
}
@test -f certs/nginx.crt || \
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
-keyout certs/nginx.key \
-out certs/nginx.crt \
-subj "/CN=localhost" \
-addext "basicConstraints=critical,CA:FALSE" \
-addext "subjectAltName=DNS:localhost,DNS:nginx,DNS:localhost.emobix.co.uk" \
2>/dev/null && \
echo "Generated certs/nginx.crt"
# CA that issues tls_client_auth client certificates (RFC 8705 section 2.1);
# Vouch trusts it through VOUCH_MTLS_CLIENT_CA_CERTS and reads it at startup,
# so it must exist before Vouch starts. The key is generated separately with a
# named-curve encoding: LibreSSL's `req -newkey ec` writes explicit curve
# parameters, which certificate verifiers reject.
client-ca:
@mkdir -p certs
@test -f certs/client-ca.crt || { \
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 \
-pkeyopt ec_param_enc:named_curve -out certs/client-ca.key && \
chmod 600 certs/client-ca.key && \
openssl req -x509 -new -key certs/client-ca.key -days 3650 \
-out certs/client-ca.crt \
-subj "/CN=Vouch Conformance Client CA" \
-addext "basicConstraints=critical,CA:TRUE,pathlen:0" \
-addext "keyUsage=critical,keyCertSign,cRLSign" \
2>/dev/null && \
echo "Generated certs/client-ca.crt"; \
}
build: init certs
cd conformance-suite && \
MAVEN_CACHE=../m2 docker compose -f builder-compose.yml run --rm \
builder mvn -B clean package -DskipTests=true -Dmaven.gitcommitid.skip=true
# -- Docker Compose -----------------------------------------------------------
up: certs
docker compose up -d --build
down:
docker compose down
logs:
docker compose logs -f
wait:
@echo "Waiting for conformance suite..."
@until curl -ksfm 5 $(CONFORMANCE_SERVER)/ >/dev/null 2>&1; do \
sleep 5; \
done
@echo "Conformance suite is ready"
@echo "Waiting for vouch server..."
@until curl -ksfm 5 $(VOUCH_URL)/health >/dev/null 2>&1; do \
sleep 5; \
done
@echo "Vouch server is ready"
clean:
docker compose down -v --rmi local
rm -rf certs m2 conformance-suite/target conformance-suite/mongo
# -- OIDC test plans ----------------------------------------------------------
test-oidc-basic:
$(PYTHON) $(SCRIPTS)/run.py \
--plan oidcc-basic-certification-test-plan \
--config $(CONFIG)/oidcc-basic.json
test-oidc-config:
$(PYTHON) $(SCRIPTS)/run.py \
--plan oidcc-config-certification-test-plan \
--config $(CONFIG)/oidcc-config.json
test-oidc-dynamic:
$(PYTHON) $(SCRIPTS)/run.py \
--plan oidcc-dynamic-certification-test-plan \
--config $(CONFIG)/oidcc-dynamic.json
test-oidc-formpost:
$(PYTHON) $(SCRIPTS)/run.py \
--plan oidcc-formpost-basic-certification-test-plan \
--config $(CONFIG)/oidcc-formpost.json
test-oidc-rp-logout:
$(PYTHON) $(SCRIPTS)/run.py \
--plan oidcc-rp-initiated-logout-certification-test-plan \
--config $(CONFIG)/oidcc-rp-logout.json
# -- FAPI 2.0 Security Profile (columns 1-5) ----------------------------------
test-fapi2-sp-mtls-mtls:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-mtls-mtls.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-mtls-mtls.json
test-fapi2-sp-mtls-dpop:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-mtls-dpop.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-mtls-dpop.json
test-fapi2-sp-pk-mtls:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-pk-mtls.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-sp-pk-mtls.json
test-fapi2:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-security-profile.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-security-profile-final-test-plan \
--config $(CONFIG)/fapi2-security-profile.json
# -- FAPI 2.0 Message Signing (columns 6-7) -----------------------------------
test-fapi2-ms:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-message-signing.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-message-signing.json
test-fapi2-ms-jarm:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-jarm.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-jarm.json
test-fapi2-ms-mtls:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-mtls.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-mtls.json
test-fapi2-ms-mtls-jarm:
@eval "$$($(PYTHON) $(SCRIPTS)/register_client.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-mtls-jarm.json)" && \
$(PYTHON) $(SCRIPTS)/run.py \
--plan fapi2-message-signing-final-test-plan \
--config $(CONFIG)/fapi2-ms-mtls-jarm.json
# -- FAPI 2.0 grouping targets ------------------------------------------------
test-fapi2-all-sp: test-fapi2-sp-mtls-mtls test-fapi2-sp-mtls-dpop \
test-fapi2-sp-pk-mtls test-fapi2
test-fapi2-all-ms: test-fapi2-ms test-fapi2-ms-jarm \
test-fapi2-ms-mtls test-fapi2-ms-mtls-jarm
test-fapi2-all: test-fapi2-all-sp test-fapi2-all-ms
# -- Iteration helpers ---------------------------------------------------------
restart-vouch:
docker compose up -d --build --no-deps vouch
@echo "Waiting for vouch..."
@until curl -ksfm 5 $(VOUCH_URL)/health >/dev/null 2>&1; do \
sleep 2; \
done
@echo "Vouch restarted"
vouch-logs:
docker compose logs -f vouch
rerun-failures:
$(PYTHON) $(SCRIPTS)/run.py --rerun-failures \
--plan $$(python3 -c "import json; print(json.load(open('.last-run.json'))['plan_name'])") \
--config $$(python3 -c "import json; s=json.load(open('.last-run.json')); print(s.get('config',''))")
# -- Run all -------------------------------------------------------------------
test-all: test-oidc-basic test-oidc-config test-oidc-dynamic test-oidc-formpost test-oidc-rp-logout test-fapi2-all