-
Notifications
You must be signed in to change notification settings - Fork 139
241 lines (203 loc) · 8.78 KB
/
ca-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
name: CA clone
on:
workflow_call:
inputs:
os:
required: true
type: string
jobs:
# docs/installation/ca/Installing_CA.md
test:
name: Test
runs-on: ubuntu-latest
env:
SHARED: /tmp/workdir/pki
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Retrieve runner image
uses: actions/cache@v3
with:
key: pki-ca-runner-${{ inputs.os }}-${{ github.run_id }}
path: pki-runner.tar
- name: Load runner image
run: docker load --input pki-runner.tar
- name: Create network
run: docker network create example
- name: Set up primary DS container
run: |
tests/bin/ds-container-create.sh primaryds
env:
IMAGE: ${{ needs.init.outputs.db-image }}
HOSTNAME: primaryds.example.com
PASSWORD: Secret.123
- 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 CA in primary PKI container
run: |
docker exec primary pkispawn \
-f /usr/share/pki/server/examples/installation/ca.cfg \
-s CA \
-D pki_ds_hostname=primaryds.example.com \
-D pki_ds_ldap_port=3389 \
-D pki_cert_id_generator=random \
-D pki_request_id_generator=random \
-v
docker exec primary pki-server cert-find
- name: Verify users and SD hosts in primary PKI container
run: |
docker exec primary pki-server cert-export ca_signing --cert-file ${SHARED}/ca_signing.crt
docker exec primary pki client-cert-import ca_signing --ca-cert ${SHARED}/ca_signing.crt
docker exec primary pki client-cert-import \
--pkcs12 /root/.dogtag/pki-tomcat/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec primary pki -n caadmin ca-user-find
docker exec primary pki securitydomain-host-find
- name: Check cert requests in primary CA
run: |
docker exec primary pki -n caadmin ca-cert-request-find
- name: Set up secondary DS container
run: |
tests/bin/ds-container-create.sh secondaryds
env:
IMAGE: ${{ needs.init.outputs.db-image }}
HOSTNAME: secondaryds.example.com
PASSWORD: Secret.123
- 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 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_ds_hostname=secondaryds.example.com \
-D pki_ds_ldap_port=3389 \
-D pki_cert_id_generator=random \
-D pki_request_id_generator=random \
-v
docker exec secondary pki-server cert-find
- name: Verify users and SD hosts 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 client-cert-import ca_signing --ca-cert ${SHARED}/ca_signing.crt
docker exec secondary pki client-cert-import \
--pkcs12 ${SHARED}/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec secondary pki -n caadmin ca-user-find
docker exec secondary pki securitydomain-host-find
- name: Check cert requests in secondary CA
run: |
docker exec secondary pki -n caadmin ca-cert-request-find
- name: Set up tertiary DS container
run: |
tests/bin/ds-container-create.sh tertiaryds
env:
IMAGE: ${{ needs.init.outputs.db-image }}
HOSTNAME: tertiaryds.example.com
PASSWORD: Secret.123
- 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_ds_hostname=tertiaryds.example.com \
-D pki_ds_ldap_port=3389 \
-D pki_cert_id_generator=random \
-D pki_request_id_generator=random \
-v
docker exec tertiary pki-server cert-find
- name: Verify users and SD hosts in tertiary PKI container
run: |
docker exec tertiary pki client-cert-import ca_signing --ca-cert ${SHARED}/ca_signing.crt
docker exec tertiary pki client-cert-import \
--pkcs12 ${SHARED}/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec tertiary pki -n caadmin ca-user-find
docker exec tertiary pki securitydomain-host-find
- name: Check cert requests in tertiary CA
run: |
docker exec tertiary pki -n caadmin ca-cert-request-find
- name: Gather artifacts from primary containers
if: always()
run: |
tests/bin/ds-artifacts-save.sh --output=/tmp/artifacts/primary primaryds
tests/bin/pki-artifacts-save.sh primary
continue-on-error: true
- name: Gather artifacts from secondary containers
if: always()
run: |
tests/bin/ds-artifacts-save.sh --output=/tmp/artifacts/secondary secondaryds
tests/bin/pki-artifacts-save.sh secondary
continue-on-error: true
- name: Gather artifacts from tertiary containers
if: always()
run: |
tests/bin/ds-artifacts-save.sh --output=/tmp/artifacts/tertiary tertiaryds
tests/bin/pki-artifacts-save.sh tertiary
continue-on-error: true
- name: Remove CA from tertiary PKI container
run: |
docker exec tertiary pki -n caadmin ca-user-find
docker exec tertiary pki securitydomain-host-find
docker exec tertiary pkidestroy -i pki-tomcat -s CA -v
- name: Remove CA from secondary PKI container
run: |
docker exec secondary pki -n caadmin ca-user-find
docker exec secondary pki securitydomain-host-find
docker exec secondary pkidestroy -i pki-tomcat -s CA -v
- name: Remove CA from primary PKI container
run: |
docker exec primary pki -n caadmin ca-user-find
docker exec primary pki securitydomain-host-find
docker exec primary pkidestroy -i pki-tomcat -s CA -v
- name: Upload artifacts from primary containers
if: always()
uses: actions/upload-artifact@v2
with:
name: ca-clone-primary-${{ inputs.os }}
path: |
/tmp/artifacts/primary
- name: Upload artifacts from secondary containers
if: always()
uses: actions/upload-artifact@v2
with:
name: ca-clone-secondary-${{ inputs.os }}
path: |
/tmp/artifacts/secondary
- name: Upload artifacts from tertiary containers
if: always()
uses: actions/upload-artifact@v2
with:
name: ca-clone-tertiary-${{ inputs.os }}
path: |
/tmp/artifacts/tertiary