-
Notifications
You must be signed in to change notification settings - Fork 141
283 lines (228 loc) · 10.2 KB
/
kra-clone-test.yml
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
name: KRA clone
on: workflow_call
env:
DS_IMAGE: ${{ vars.DS_IMAGE || 'quay.io/389ds/dirsrv' }}
jobs:
# docs/installation/kra/Installing_KRA_Clone.md
test:
name: Test
runs-on: ubuntu-latest
env:
SHARED: /tmp/workdir/pki
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Retrieve PKI images
uses: actions/cache@v4
with:
key: pki-images-${{ github.sha }}
path: pki-images.tar
- name: Load PKI images
run: docker load --input pki-images.tar
- name: Create network
run: docker network create example
- name: Set up primary DS container
run: |
tests/bin/ds-create.sh \
--image=${{ env.DS_IMAGE }} \
--hostname=primaryds.example.com \
--password=Secret.123 \
primaryds
- name: Connect primary DS container to network
run: docker network connect example primaryds --alias primaryds.example.com
- name: Set up primary PKI container
run: |
tests/bin/runner-init.sh primary
env:
HOSTNAME: primary.example.com
- name: Connect primary PKI container to network
run: docker network connect example primary --alias primary.example.com
- name: Install primary CA in primary PKI container
run: |
docker exec primary pkispawn \
-f /usr/share/pki/server/examples/installation/ca.cfg \
-s CA \
-D pki_ds_url=ldap://primaryds.example.com:3389 \
-v
docker exec primary pki-server cert-find
- name: Install primary KRA in primary PKI container
run: |
docker exec primary pkispawn \
-f /usr/share/pki/server/examples/installation/kra.cfg \
-s KRA \
-D pki_ds_url=ldap://primaryds.example.com:3389 \
-v
docker exec primary pki-server cert-find
- name: Set up secondary DS container
run: |
tests/bin/ds-create.sh \
--image=${{ env.DS_IMAGE }} \
--hostname=secondaryds.example.com \
--password=Secret.123 \
secondaryds
- name: Connect secondary DS container to network
run: docker network connect example secondaryds --alias secondaryds.example.com
- name: Set up secondary PKI container
run: |
tests/bin/runner-init.sh secondary
env:
HOSTNAME: secondary.example.com
- name: Connect secondary PKI container to network
run: docker network connect example secondary --alias secondary.example.com
- name: Install CA in secondary PKI container
run: |
docker exec primary pki-server cert-export ca_signing --cert-file ${SHARED}/ca_signing.crt
docker exec primary pki-server ca-clone-prepare --pkcs12-file ${SHARED}/ca-certs.p12 --pkcs12-password Secret.123
docker exec secondary pkispawn \
-f /usr/share/pki/server/examples/installation/ca-clone.cfg \
-s CA \
-D pki_cert_chain_path=${SHARED}/ca_signing.crt \
-D pki_clone_pkcs12_path=${SHARED}/ca-certs.p12 \
-D pki_clone_pkcs12_password=Secret.123 \
-D pki_ds_url=ldap://secondaryds.example.com:3389 \
-v
docker exec secondary pki-server cert-find
- name: Install KRA in secondary PKI container
run: |
docker exec primary pki-server kra-clone-prepare --pkcs12-file ${SHARED}/kra-certs.p12 --pkcs12-password Secret.123
docker exec secondary pkispawn \
-f /usr/share/pki/server/examples/installation/kra-clone.cfg \
-s KRA \
-D pki_cert_chain_path=${SHARED}/ca_signing.crt \
-D pki_clone_pkcs12_path=${SHARED}/kra-certs.p12 \
-D pki_clone_pkcs12_password=Secret.123 \
-D pki_ds_url=ldap://secondaryds.example.com:3389 \
-v
docker exec secondary pki-server cert-find
- name: Verify KRA admin in secondary PKI container
run: |
docker exec primary cp /root/.dogtag/pki-tomcat/ca_admin_cert.p12 ${SHARED}/ca_admin_cert.p12
docker exec secondary pki nss-cert-import \
--cert $SHARED/ca_signing.crt \
--trust CT,C,C \
ca_signing
docker exec secondary pki pkcs12-import \
--pkcs12 ${SHARED}/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec secondary pki -n caadmin kra-user-show kraadmin
- name: Set up tertiary DS container
run: |
tests/bin/ds-create.sh \
--image=${{ env.DS_IMAGE }} \
--hostname=tertiaryds.example.com \
--password=Secret.123 \
tertiaryds
- name: Connect tertiary DS container to network
run: docker network connect example tertiaryds --alias tertiaryds.example.com
- name: Set up tertiary PKI container
run: |
tests/bin/runner-init.sh tertiary
env:
HOSTNAME: tertiary.example.com
- name: Connect tertiary PKI container to network
run: docker network connect example tertiary --alias tertiary.example.com
- name: Install CA in tertiary PKI container
run: |
docker exec secondary pki-server cert-export ca_signing --cert-file ${SHARED}/ca_signing.crt
docker exec secondary pki-server ca-clone-prepare --pkcs12-file ${SHARED}/ca-certs.p12 --pkcs12-password Secret.123
docker exec tertiary pkispawn \
-f /usr/share/pki/server/examples/installation/ca-clone-of-clone.cfg \
-s CA \
-D pki_cert_chain_path=${SHARED}/ca_signing.crt \
-D pki_clone_pkcs12_path=${SHARED}/ca-certs.p12 \
-D pki_clone_pkcs12_password=Secret.123 \
-D pki_ds_url=ldap://tertiaryds.example.com:3389 \
-v
docker exec tertiary pki-server cert-find
- name: Install KRA in tertiary PKI container
run: |
docker exec secondary pki-server kra-clone-prepare --pkcs12-file ${SHARED}/kra-certs.p12 --pkcs12-password Secret.123
docker exec tertiary pkispawn \
-f /usr/share/pki/server/examples/installation/kra-clone-of-clone.cfg \
-s KRA \
-D pki_cert_chain_path=${SHARED}/ca_signing.crt \
-D pki_clone_pkcs12_path=${SHARED}/kra-certs.p12 \
-D pki_clone_pkcs12_password=Secret.123 \
-D pki_ds_url=ldap://tertiaryds.example.com:3389 \
-v
docker exec tertiary pki-server cert-find
- name: Verify KRA admin in tertiary PKI container
run: |
docker exec tertiary pki nss-cert-import \
--cert $SHARED/ca_signing.crt \
--trust CT,C,C \
ca_signing
docker exec tertiary pki pkcs12-import \
--pkcs12 ${SHARED}/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec tertiary pki -n caadmin kra-user-show kraadmin
- name: Run PKI healthcheck in primary container
run: docker exec primary pki-healthcheck --failures-only
- name: Run PKI healthcheck in secondary container
run: docker exec secondary pki-healthcheck --failures-only
- name: Run PKI healthcheck in tertiary container
run: docker exec tertiary pki-healthcheck --failures-only
- name: Remove KRA from tertiary PKI container
run: docker exec tertiary pkidestroy -s KRA -v
- name: Remove CA from tertiary PKI container
run: docker exec tertiary pkidestroy -s CA -v
- name: Remove KRA from secondary PKI container
run: docker exec secondary pkidestroy -s KRA -v
- name: Remove CA from secondary PKI container
run: docker exec secondary pkidestroy -s CA -v
- name: Remove KRA from primary PKI container
run: docker exec primary pkidestroy -s KRA -v
- name: Remove CA from primary PKI container
run: docker exec primary pkidestroy -s CA -v
- name: Check PKI server systemd journal in primary container
if: always()
run: |
docker exec primary journalctl -x --no-pager -u [email protected]
- name: Check primary CA debug log
if: always()
run: |
docker exec primary find /var/lib/pki/pki-tomcat/logs/ca -name "debug.*" -exec cat {} \;
- name: Check primary KRA debug log
if: always()
run: |
docker exec primary find /var/lib/pki/pki-tomcat/logs/kra -name "debug.*" -exec cat {} \;
- name: Check PKI server systemd journal in secondary container
if: always()
run: |
docker exec secondary journalctl -x --no-pager -u [email protected]
- name: Check secondary CA debug log
if: always()
run: |
docker exec secondary find /var/lib/pki/pki-tomcat/logs/ca -name "debug.*" -exec cat {} \;
- name: Check secondary KRA debug log
if: always()
run: |
docker exec secondary find /var/lib/pki/pki-tomcat/logs/kra -name "debug.*" -exec cat {} \;
- name: Check PKI server systemd journal in tertiary container
if: always()
run: |
docker exec tertiary journalctl -x --no-pager -u [email protected]
- name: Check tertiary CA debug log
if: always()
run: |
docker exec tertiary find /var/lib/pki/pki-tomcat/logs/ca -name "debug.*" -exec cat {} \;
- name: Check tertiary KRA debug log
if: always()
run: |
docker exec tertiary find /var/lib/pki/pki-tomcat/logs/kra -name "debug.*" -exec cat {} \;
- name: Gather artifacts
if: always()
run: |
tests/bin/ds-artifacts-save.sh primaryds
tests/bin/pki-artifacts-save.sh primary
tests/bin/ds-artifacts-save.sh secondaryds
tests/bin/pki-artifacts-save.sh secondary
tests/bin/ds-artifacts-save.sh tertiaryds
tests/bin/pki-artifacts-save.sh tertiary
continue-on-error: true
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: kra-clone
path: /tmp/artifacts