-
Notifications
You must be signed in to change notification settings - Fork 30
221 lines (188 loc) · 7.02 KB
/
tomcat-tests.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
name: Tomcat Tests
on: [push, pull_request]
env:
NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || 'dogtagpki' }}
jobs:
build:
name: Waiting for build
runs-on: ubuntu-latest
steps:
- name: Wait for build
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'Building JSS'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
if: github.event_name == 'push'
- name: Wait for build
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: 'Building JSS'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
if: github.event_name == 'pull_request'
# docs/admin/server/Configuring-HTTPS-Connector-with-NSS-Database.adoc
https-nssdb-test:
name: Testing HTTPS connector with NSS database
needs: build
runs-on: ubuntu-latest
env:
SHARED: /tmp/workdir/pki
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install xmlstarlet
- name: Clone repository
uses: actions/checkout@v4
- name: Retrieve JSS images
uses: actions/cache@v4
with:
key: jss-images-${{ github.sha }}
path: jss-images.tar
- name: Load JSS images
run: docker load --input jss-images.tar
- name: Create network
run: docker network create example
- name: Set up JSS container
run: |
tests/bin/runner-init.sh \
--hostname=server.example.com \
--network=example \
--network-alias=server.example.com \
server
- name: Import LDAP SDK packages
run: |
docker create --name=ldapjdk-dist quay.io/$NAMESPACE/ldapjdk-dist:5.5
docker cp ldapjdk-dist:/root/RPMS/. /tmp/RPMS/
docker rm -f ldapjdk-dist
- name: Import PKI packages
run: |
docker create --name=pki-dist quay.io/$NAMESPACE/pki-dist:11.5
docker cp pki-dist:/root/RPMS/. /tmp/RPMS/
docker rm -f pki-dist
- name: Install packages
run: |
docker cp /tmp/RPMS/. server:/root/RPMS/
docker exec server bash -c "dnf localinstall -y /root/RPMS/*"
- name: Create Tomcat
run: |
docker exec server pki-server create -v
- name: Create NSS database in Tomcat
run: |
docker exec server pki-server nss-create --no-password
- name: Create SSL server cert
run: |
docker exec server pki -d /var/lib/pki/pki-tomcat/alias \
nss-cert-request \
--subject "CN=server.example.com" \
--ext /usr/share/pki/server/certs/sslserver.conf \
--csr sslserver.csr
docker exec server pki -d /var/lib/pki/pki-tomcat/alias \
nss-cert-issue \
--csr sslserver.csr \
--ext /usr/share/pki/server/certs/sslserver.conf \
--cert sslserver.crt
docker exec server pki -d /var/lib/pki/pki-tomcat/alias \
nss-cert-import \
--cert sslserver.crt \
sslserver
- name: Create HTTPS connector with NSS database
run: |
docker exec server pki-server jss-enable
docker exec server pki-server http-connector-add \
--port 8443 \
--scheme https \
--secure true \
--sslEnabled true \
--sslProtocol SSL \
--sslImpl org.dogtagpki.jss.tomcat.JSSImplementation \
Secure
docker exec server pki-server http-connector-cert-add \
--keyAlias sslserver \
--keystoreType pkcs11 \
--keystoreProvider Mozilla-JSS
- name: Start Tomcat
run: |
docker exec server pki-server start --wait -v
- name: Set up client container
run: |
tests/bin/runner-init.sh \
--hostname=client.example.com \
--network=example \
--network-alias=client.example.com \
client
- name: Install dependencies
run: docker exec client dnf install -y sslscan
- name: Check SSL connection
run: |
docker exec client sslscan --xml=$SHARED/sslscan.xml server.example.com:8443
cat sslscan.xml
# TLS 1.0 should be disabled
echo -n "0" > expected
xmlstarlet sel -t -v \
"/document/ssltest/protocol[@type='tls' and @version='1.0']/@enabled" \
sslscan.xml > actual
diff expected actual
# TLS 1.1 should be disabled
echo -n "0" > expected
xmlstarlet sel -t -v \
"/document/ssltest/protocol[@type='tls' and @version='1.1']/@enabled" \
sslscan.xml > actual
diff expected actual
# TLS 1.2 should be disabled
echo -n "0" > expected
xmlstarlet sel -t -v \
"/document/ssltest/protocol[@type='tls' and @version='1.2']/@enabled" \
sslscan.xml > actual
diff expected actual
# TLS 1.3 should be enabled
echo -n "1" > expected
xmlstarlet sel -t -v \
"/document/ssltest/protocol[@type='tls' and @version='1.3']/@enabled" \
sslscan.xml > actual
diff expected actual
# cert subject should be server.example.com
echo -n "server.example.com" > expected
xmlstarlet sel -t -v \
"/document/ssltest/certificates/certificate/subject" \
sslscan.xml > actual
diff expected actual
# SAN extension should be DNS:server.example.com
echo -n "DNS:server.example.com" > expected
xmlstarlet sel -t -v \
"/document/ssltest/certificates/certificate/altnames" \
sslscan.xml > actual
diff expected actual
# cert issuer should be server.example.com
echo -n "server.example.com" > expected
xmlstarlet sel -t -v \
"/document/ssltest/certificates/certificate/issuer" \
sslscan.xml > actual
diff expected actual
# cert should be self-signed
echo -n "true" > expected
xmlstarlet sel -t -v \
"/document/ssltest/certificates/certificate/self-signed" \
sslscan.xml > actual
diff expected actual
- name: Stop Tomcat
run: |
docker exec server pki-server stop --wait -v
- name: Remove Tomcat
run: |
docker exec server pki-server remove -v
- name: Gather artifacts from server container
if: always()
run: |
tests/bin/pki-artifacts-save.sh server
continue-on-error: true
- name: Upload artifacts from server container
if: always()
uses: actions/upload-artifact@v4
with:
name: https-nssdb-test
path: |
/tmp/artifacts/server