-
Notifications
You must be signed in to change notification settings - Fork 141
216 lines (176 loc) · 7.57 KB
/
subca-basic-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
name: Basic Sub-CA
on: workflow_call
env:
DB_IMAGE: ${{ vars.DB_IMAGE || 'quay.io/389ds/dirsrv' }}
jobs:
# docs/installation/ca/Installing_Subordinate_CA.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 root DS container
run: |
tests/bin/ds-container-create.sh rootds
env:
IMAGE: ${{ env.DB_IMAGE }}
HOSTNAME: rootds.example.com
PASSWORD: Secret.123
- name: Connect root DS container to network
run: docker network connect example rootds --alias rootds.example.com
- name: Set up root PKI container
run: |
tests/bin/runner-init.sh root
env:
HOSTNAME: root.example.com
- name: Connect root PKI container to network
run: docker network connect example root --alias root.example.com
- name: Install root CA in root container
run: |
docker exec root pkispawn \
-f /usr/share/pki/server/examples/installation/ca.cfg \
-s CA \
-D pki_ds_url=ldap://rootds.example.com:3389 \
-v
- name: Check root CA server status
run: |
docker exec root pki-server status | tee output
# root CA should be a domain manager
echo "True" > expected
sed -n 's/^ *SD Manager: *\(.*\)$/\1/p' output > actual
diff expected actual
- name: Check root CA system certs
run: |
docker exec root pki-server cert-find
- name: Install banner in root container
run: docker exec root cp /usr/share/pki/server/examples/banner/banner.txt /etc/pki/pki-tomcat
- name: Set up subordinate DS container
run: |
tests/bin/ds-container-create.sh subds
env:
IMAGE: ${{ env.DB_IMAGE }}
HOSTNAME: subds.example.com
PASSWORD: Secret.123
- name: Connect subordinate DS container to network
run: docker network connect example subds --alias subds.example.com
- name: Set up subordinate PKI container
run: |
tests/bin/runner-init.sh subordinate
env:
HOSTNAME: sub.example.com
- name: Connect subordinate PKI container to network
run: docker network connect example subordinate --alias sub.example.com
- name: Install subordinate CA in subordinate container
run: |
docker exec root pki-server cert-export ca_signing --cert-file ${SHARED}/root-ca_signing.crt
docker exec subordinate pkispawn \
-f /usr/share/pki/server/examples/installation/subca.cfg \
-s CA \
-D pki_cert_chain_path=${SHARED}/root-ca_signing.crt \
-D pki_ds_url=ldap://subds.example.com:3389 \
-v
- name: Check sub CA server status
run: |
docker exec subordinate pki-server status | tee output
# sub CA should not be a domain manager
echo "False" > expected
sed -n 's/^ *SD Manager: *\(.*\)$/\1/p' output > actual
diff expected actual
- name: Check sub CA system certs
run: |
docker exec subordinate pki-server cert-find
- name: Install banner in subordinate container
run: docker exec subordinate cp /usr/share/pki/server/examples/banner/banner.txt /etc/pki/pki-tomcat
- name: Check CA signing cert
run: |
docker exec subordinate pki-server cert-export ca_signing \
--cert-file ca_signing.crt
docker exec subordinate openssl req -text -noout \
-in /etc/pki/pki-tomcat/certs/ca_signing.csr
# check sub CA signing cert extensions
docker exec subordinate /usr/share/pki/tests/ca/bin/test-subca-signing-cert-ext.sh ca_signing.crt
- name: Check CA OCSP signing cert
run: |
docker exec subordinate pki-server cert-export ca_ocsp_signing \
--cert-file ca_ocsp_signing.crt
docker exec subordinate openssl req -text -noout \
-in /etc/pki/pki-tomcat/certs/ca_ocsp_signing.csr
docker exec subordinate openssl x509 -text -noout -in ca_ocsp_signing.crt
- name: Check CA audit signing cert
run: |
docker exec subordinate pki-server cert-export ca_audit_signing \
--cert-file ca_audit_signing.crt
docker exec subordinate openssl req -text -noout \
-in /etc/pki/pki-tomcat/certs/ca_audit_signing.csr
docker exec subordinate openssl x509 -text -noout -in ca_audit_signing.crt
- name: Check subsystem cert
run: |
docker exec subordinate pki-server cert-export subsystem \
--cert-file subsystem.crt
docker exec subordinate openssl req -text -noout \
-in /etc/pki/pki-tomcat/certs/subsystem.csr
docker exec subordinate openssl x509 -text -noout -in subsystem.crt
- name: Check SSL server cert
run: |
docker exec subordinate pki-server cert-export sslserver \
--cert-file sslserver.crt
docker exec subordinate openssl req -text -noout \
-in /etc/pki/pki-tomcat/certs/sslserver.csr
docker exec subordinate openssl x509 -text -noout -in sslserver.crt
- name: Check CA admin cert
run: |
docker exec subordinate openssl x509 -text -noout -in /root/.dogtag/pki-tomcat/ca_admin.cert
- name: Run PKI healthcheck
run: docker exec subordinate pki-healthcheck --failures-only
- name: Verify CA admin
run: |
docker exec subordinate pki client-cert-import ca_signing --ca-cert ${SHARED}/root-ca_signing.crt
docker exec subordinate pki pkcs12-import \
--pkcs12 /root/.dogtag/pki-tomcat/ca_admin_cert.p12 \
--pkcs12-password Secret.123
docker exec subordinate pki -n caadmin --ignore-banner ca-user-show caadmin
- name: Check cert requests in subordinate CA
run: |
docker exec subordinate pki -n caadmin --ignore-banner ca-cert-request-find
- name: Gather artifacts from root containers
if: always()
run: |
tests/bin/ds-artifacts-save.sh --output=/tmp/artifacts/root rootds
tests/bin/pki-artifacts-save.sh root
continue-on-error: true
- name: Gather artifacts from subordinate containers
if: always()
run: |
tests/bin/ds-artifacts-save.sh --output=/tmp/artifacts/subordinate subds
tests/bin/pki-artifacts-save.sh subordinate
continue-on-error: true
- name: Remove subordinate CA from subordinate container
run: docker exec subordinate pkidestroy -i pki-tomcat -s CA -v
- name: Remove root CA from root container
run: docker exec root pkidestroy -i pki-tomcat -s CA -v
- name: Upload artifacts from root container
if: always()
uses: actions/upload-artifact@v4
with:
name: subca-basic-root
path: |
/tmp/artifacts/root
- name: Upload artifacts from subordinate container
if: always()
uses: actions/upload-artifact@v4
with:
name: subca-basic-subordinate
path: |
/tmp/artifacts/subordinate