-
Notifications
You must be signed in to change notification settings - Fork 36
257 lines (230 loc) · 11.1 KB
/
ca_handler_tests_nclm.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
name: CA handler tests - NCLM
on:
push:
pull_request:
branches: [ devel ]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 2 * * 6'
jobs:
nclm_handler_tests:
name: "nclm_handler_tests"
runs-on: ubuntu-latest
strategy:
fail-fast: false
# max-parallel: 1
matrix:
websrv: ['apache2', 'nginx']
dbhandler: ['wsgi', 'django']
steps:
- name: "checkout GIT"
uses: actions/checkout@v4
- name: "Generate UUID"
run: |
echo UUID=$(uuidgen | cut -d "-" -f1) >> $GITHUB_ENV
- run: echo "UUID ${{ env.UUID }}"
- name: "Build container"
uses: ./.github/actions/container_prep
with:
DB_HANDLER: ${{ matrix.dbhandler }}
WEB_SRV: ${{ matrix.websrv }}
- name: "Setup a2c with nclm_ca_handler"
run: |
sudo cp test/ca/certsrv_ca_certs.pem examples/Docker/data/ca_certs.pem
sudo touch examples/Docker/data/acme_srv.cfg
sudo chmod 777 examples/Docker/data/acme_srv.cfg
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > examples/Docker/data/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/nclm_ca_handler.py" >> examples/Docker/data/acme_srv.cfg
sudo echo "api_host: $NCLM_API_HOST" >> examples/Docker/data/acme_srv.cfg
sudo echo "api_user: $NCLM_API_USER" >> examples/Docker/data/acme_srv.cfg
sudo echo "api_password: $NCLM_API_PASSWORD" >> examples/Docker/data/acme_srv.cfg
sudo echo "tsg_name: $NCLM_TSG_NAME" >> examples/Docker/data/acme_srv.cfg
sudo echo "ca_name: $NCLM_CA_NAME" >> examples/Docker/data/acme_srv.cfg
sudo echo "ca_id_list: [$NCLM_CA_ID_LIST]" >> examples/Docker/data/acme_srv.cfg
sudo echo "request_timeout: 40" >> examples/Docker/data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout: 40/g" examples/Docker/data/acme_srv.cfg
cd examples/Docker/
docker-compose restart
env:
NCLM_API_HOST: ${{ secrets.NCLM_API_HOST }}
NCLM_API_USER: ${{ secrets.NCLM_API_USER }}
NCLM_API_PASSWORD: ${{ secrets.NCLM_API_PASSWORD }}
NCLM_TSG_NAME: ${{ secrets.NCLM_TSG_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
NCLM_CA_ID_LIST: ${{ secrets.NCLM_CA_ID_LIST }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
HOSTNAME_SUFFIX: -${{ env.UUID }}
- name: "Generate UUID"
run: |
echo UUID=$(uuidgen | cut -d "-" -f1) >> $GITHUB_ENV
- run: echo "UUID ${{ env.UUID }}"
- name: "Reconfigure nclm handler to test enrollment from MSCA"
run: |
sudo sed -i "s/ca_name: $NCLM_CA_NAME/ca_name: $NCLM_MSCA_NAME/g" examples/Docker/data/acme_srv.cfg
sudo echo "template_name: $NCLM_MSCA_TEMPLATE_NAME" >> examples/Docker/data/acme_srv.cfg
cd examples/Docker/
docker-compose restart
env:
NCLM_MSCA_TEMPLATE_NAME: ${{ secrets.NCLM_MSCA_TEMPLATE_NAME }}
NCLM_MSCA_NAME: ${{ secrets.NCLM_MSCA_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
USE_RSA: true
HOSTNAME_SUFFIX: -${{ env.UUID }}
- name: "[ * ] collecting test logs"
if: ${{ failure() }}
run: |
mkdir -p ${{ github.workspace }}/artifact/upload
mkdir -p ${{ github.workspace }}/artifact/clients
sudo cp -rp examples/Docker/data/ ${{ github.workspace }}/artifact/data/
sudo cp *.pem ${{ github.workspace }}/artifact/data/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/acme-sh/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/certbot/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/lego/
cd examples/Docker
docker-compose logs > ${{ github.workspace }}/artifact/docker-compose.log
sudo tar -C ${{ github.workspace }}/artifact/ -cvzf ${{ github.workspace }}/artifact/upload/artifact.tar.gz docker-compose.log data clients
- name: "[ * ] uploading artificates"
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: nclm_handler_tests-${{ matrix.websrv }}-${{ matrix.dbhandler }}.tar.gz
path: ${{ github.workspace }}/artifact/upload/
nclm_handler_tests_rpm:
name: "nclm_handler_tests_rpm"
runs-on: ubuntu-latest
strategy:
fail-fast: false
# max-parallel: 1
matrix:
rhversion: [8, 9]
execscript: ['rpm_tester.sh', 'django_tester.sh']
steps:
- name: "checkout GIT"
uses: actions/checkout@v4
- name: "Generate UUID"
run: |
echo UUID=$(uuidgen | cut -d "-" -f1) >> $GITHUB_ENV
- run: echo "UUID ${{ env.UUID }}"
- name: "Prepare Alma environment"
uses: ./.github/actions/rpm_prep
with:
GH_SBOM_USER: ${{ secrets.GH_SBOM_USER }}
GH_SBOM_TOKEN: ${{ secrets.GH_SBOM_TOKEN }}
RH_VERSION: ${{ matrix.rhversion }}
- name: "Setup a2c with with nclm_ca_handler"
if: matrix.execscript == 'rpm_tester.sh'
run: |
mkdir -p data/acme_ca
sudo cp test/ca/certsrv_ca_certs.pem data/acme_ca/ca_certs.pem
sudo touch data/acme_srv.cfg
sudo chmod 777 data/acme_srv.cfg
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/nclm_ca_handler.py" >> data/acme_srv.cfg
sudo echo "api_host: $NCLM_API_HOST" >> data/acme_srv.cfg
sudo echo "api_user: $NCLM_API_USER" >> data/acme_srv.cfg
sudo echo "api_password: $NCLM_API_PASSWORD" >> data/acme_srv.cfg
sudo echo "tsg_name: $NCLM_TSG_NAME" >> data/acme_srv.cfg
sudo echo "ca_name: $NCLM_CA_NAME" >> data/acme_srv.cfg
sudo echo "ca_id_list: [$NCLM_CA_ID_LIST]" >> data/acme_srv.cfg
sudo echo "request_timeout: 40" >> data/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout: 60/g" data/acme_srv.cfg
env:
NCLM_API_HOST: ${{ secrets.NCLM_API_HOST }}
NCLM_API_USER: ${{ secrets.NCLM_API_USER }}
NCLM_API_PASSWORD: ${{ secrets.NCLM_API_PASSWORD }}
NCLM_TSG_NAME: ${{ secrets.NCLM_TSG_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
NCLM_CA_ID_LIST: ${{ secrets.NCLM_CA_ID_LIST }}
- name: "Setup a2c with with nclm_ca_handler for django"
if: matrix.execscript == 'django_tester.sh'
run: |
sudo mkdir -p data/volume/acme_ca/certs
sudo cp test/ca/certsrv_ca_certs.pem data/volume/acme_ca/ca_certs.pem
sudo touch data/volume/acme_srv.cfg
sudo chmod 777 data/volume/acme_srv.cfg
sudo head -n -8 .github/openssl_ca_handler.py_acme_srv_default_handler.cfg > data/volume/acme_srv.cfg
sudo echo "handler_file: examples/ca_handler/nclm_ca_handler.py" >> data/volume/acme_srv.cfg
sudo echo "api_host: $NCLM_API_HOST" >> data/volume/acme_srv.cfg
sudo echo "api_user: $NCLM_API_USER" >> data/volume/acme_srv.cfg
sudo echo "api_password: $NCLM_API_PASSWORD" >> data/volume/acme_srv.cfg
sudo echo "tsg_name: $NCLM_TSG_NAME" >> data/volume/acme_srv.cfg
sudo echo "ca_name: $NCLM_CA_NAME" >> data/volume/acme_srv.cfg
sudo echo "ca_id_list: [$NCLM_CA_ID_LIST]" >> data/volume/acme_srv.cfg
sudo echo "request_timeout: 40" >> data/volume/acme_srv.cfg
sudo sed -i "s/revocation_reason_check_disable: False/revocation_reason_check_disable: False\nenrollment_timeout: 60/g" data/volume/acme_srv.cfg
env:
NCLM_API_HOST: ${{ secrets.NCLM_API_HOST }}
NCLM_API_USER: ${{ secrets.NCLM_API_USER }}
NCLM_API_PASSWORD: ${{ secrets.NCLM_API_PASSWORD }}
NCLM_TSG_NAME: ${{ secrets.NCLM_TSG_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
NCLM_CA_ID_LIST: ${{ secrets.NCLM_CA_ID_LIST }}
- name: "Execute install scipt"
run: |
docker exec acme-srv sh /tmp/acme2certifier/$EXEC_SCRIPT
env:
EXEC_SCRIPT: ${{ matrix.execscript }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
HOSTNAME_SUFFIX: -${{ env.UUID }}
- name: "Generate UUID"
run: |
echo UUID=$(uuidgen | cut -d "-" -f1) >> $GITHUB_ENV
- run: echo "UUID ${{ env.UUID }}"
- name: "Reconfigure nclm handler to test enrollment from MSCA"
if: matrix.execscript == 'rpm_tester.sh'
run: |
sudo sed -i "s/ca_name: $NCLM_CA_NAME/ca_name: $NCLM_MSCA_NAME/g" data/acme_srv.cfg
sudo echo "template_name: $NCLM_MSCA_TEMPLATE_NAME" >> data/acme_srv.cfg
env:
NCLM_MSCA_TEMPLATE_NAME: ${{ secrets.NCLM_MSCA_TEMPLATE_NAME }}
NCLM_MSCA_NAME: ${{ secrets.NCLM_MSCA_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
- name: "Reconfigure nclm handler to test enrollment from MSCA"
if: matrix.execscript == 'django_tester.sh'
run: |
sudo sed -i "s/ca_name: $NCLM_CA_NAME/ca_name: $NCLM_MSCA_NAME/g" data/volume/acme_srv.cfg
sudo echo "template_name: $NCLM_MSCA_TEMPLATE_NAME" >> data/volume/acme_srv.cfg
env:
NCLM_MSCA_TEMPLATE_NAME: ${{ secrets.NCLM_MSCA_TEMPLATE_NAME }}
NCLM_MSCA_NAME: ${{ secrets.NCLM_MSCA_NAME }}
NCLM_CA_NAME: ${{ secrets.NCLM_CA_NAME }}
- name: "Execute install scipt"
run: |
docker exec acme-srv sh /tmp/acme2certifier/$EXEC_SCRIPT restart
env:
EXEC_SCRIPT: ${{ matrix.execscript }}
- name: "Test enrollment"
uses: ./.github/actions/acme_clients
with:
USE_RSA: true
HOSTNAME_SUFFIX: -${{ env.UUID }}
- name: "[ * ] collecting test logs"
if: ${{ failure() }}
continue-on-error: true
run: |
mkdir -p ${{ github.workspace }}/artifact/upload
mkdir -p ${{ github.workspace }}/artifact/clients
docker exec acme-srv tar cvfz /tmp/acme2certifier/a2c.tgz /opt/acme2certifier
sudo cp -rp data/ ${{ github.workspace }}/artifact/data/
sudo cp *.pem ${{ github.workspace }}/artifact/data/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/acme-sh/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/certbot/
sudo cp -rp acme-sh/ ${{ github.workspace }}/artifact/clients/lego/
sudo rm ${{ github.workspace }}/artifact/data/*.rpm
docker exec acme-srv cat /etc/nginx/nginx.conf.orig > ${{ github.workspace }}/artifact/data/nginx.conf.orig
docker exec acme-srv cat /etc/nginx/nginx.conf > ${{ github.workspace }}/artifact/data/nginx.conf
docker exec acme-srv cat /var/log/messages > ${{ github.workspace }}/artifact/acme-srv.log
sudo tar -C ${{ github.workspace }}/artifact/ -cvzf ${{ github.workspace }}/artifact/upload/artifact.tar.gz data clients acme-srv.log
- name: "[ * ] uploading artificates"
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: nclm_ca_handler_rpm-rh${{ matrix.rhversion }}-${{ matrix.execscript}}.tar.gz
path: ${{ github.workspace }}/artifact/upload/