|
272 | 272 | until: terrarium_post_proxy_sync.rc == 0 |
273 | 273 | changed_when: false |
274 | 274 |
|
275 | | - - name: Remove local auth bootstrap routes before requesting public TLS |
| 275 | + - name: Retire local auth bootstrap TLS before verifying public TLS |
276 | 276 | ansible.builtin.file: |
277 | 277 | path: "{{ item }}" |
278 | 278 | state: absent |
279 | 279 | loop: |
280 | 280 | - "{{ terrarium_traefik_config_dir }}/dynamic/bootstrap-routes.yml" |
281 | | - register: terrarium_bootstrap_routes_removed |
| 281 | + - "{{ terrarium_traefik_config_dir }}/dynamic/bootstrap-cert.yml" |
| 282 | + - "{{ terrarium_traefik_config_dir }}/bootstrap-certs" |
| 283 | + - /usr/local/share/ca-certificates/terrarium-bootstrap.crt |
| 284 | + register: terrarium_bootstrap_tls_retired |
282 | 285 | when: |
283 | 286 | - terrarium_idp_mode == 'local' |
284 | 287 | - terrarium_auth_domain | default('') | length > 0 |
285 | 288 |
|
286 | | - - name: Restart Traefik after removing bootstrap routes |
| 289 | + - name: Refresh system CA certificates after retiring bootstrap TLS |
| 290 | + ansible.builtin.command: update-ca-certificates |
| 291 | + changed_when: terrarium_bootstrap_tls_retired is changed |
| 292 | + when: terrarium_bootstrap_tls_retired is changed |
| 293 | + |
| 294 | + - name: Restart LXD after retiring bootstrap TLS trust |
| 295 | + ansible.builtin.command: systemctl try-restart snap.lxd.daemon.service |
| 296 | + when: terrarium_bootstrap_tls_retired is changed |
| 297 | + |
| 298 | + - name: Restart Traefik after retiring bootstrap TLS |
287 | 299 | ansible.builtin.systemd: |
288 | 300 | name: traefik |
289 | 301 | state: restarted |
290 | | - when: terrarium_bootstrap_routes_removed is changed |
| 302 | + when: terrarium_bootstrap_tls_retired is changed |
291 | 303 |
|
292 | | - - name: Wait for local auth domain to serve trusted TLS |
| 304 | + - name: Wait for local auth domain to serve public TLS |
293 | 305 | ansible.builtin.command: |
294 | 306 | argv: |
295 | 307 | - curl |
|
303 | 315 | - --max-time |
304 | 316 | - "20" |
305 | 317 | - "https://{{ terrarium_auth_domain }}/.well-known/openid-configuration" |
306 | | - register: terrarium_auth_trusted_tls |
| 318 | + register: terrarium_auth_public_tls |
307 | 319 | retries: 36 |
308 | 320 | delay: 10 |
309 | | - until: terrarium_auth_trusted_tls.rc == 0 |
| 321 | + until: terrarium_auth_public_tls.rc == 0 |
310 | 322 | changed_when: false |
311 | 323 | failed_when: false |
312 | 324 | when: |
313 | 325 | - terrarium_idp_mode == 'local' |
314 | 326 | - terrarium_auth_domain | default('') | length > 0 |
315 | 327 |
|
316 | | - - name: Restart Traefik to retry local auth TLS after trusted TLS wait failure |
| 328 | + - name: Restart Traefik to retry local auth ACME after public TLS wait failure |
317 | 329 | ansible.builtin.systemd: |
318 | 330 | name: traefik |
319 | 331 | state: restarted |
320 | 332 | when: |
321 | 333 | - terrarium_idp_mode == 'local' |
322 | 334 | - terrarium_auth_domain | default('') | length > 0 |
323 | | - - terrarium_auth_trusted_tls is defined |
324 | | - - terrarium_auth_trusted_tls.rc | default(0) != 0 |
| 335 | + - terrarium_auth_public_tls is defined |
| 336 | + - terrarium_auth_public_tls.rc | default(0) != 0 |
325 | 337 |
|
326 | | - - name: Wait again for local auth domain to serve trusted TLS after retry |
| 338 | + - name: Wait again for local auth domain to serve public TLS after ACME retry |
327 | 339 | ansible.builtin.command: |
328 | 340 | argv: |
329 | 341 | - curl |
|
337 | 349 | - --max-time |
338 | 350 | - "20" |
339 | 351 | - "https://{{ terrarium_auth_domain }}/.well-known/openid-configuration" |
340 | | - register: terrarium_auth_trusted_tls_retry |
| 352 | + register: terrarium_auth_public_tls_retry |
341 | 353 | retries: 36 |
342 | 354 | delay: 10 |
343 | | - until: terrarium_auth_trusted_tls_retry.rc == 0 |
| 355 | + until: terrarium_auth_public_tls_retry.rc == 0 |
344 | 356 | changed_when: false |
345 | 357 | failed_when: false |
346 | 358 | when: |
347 | 359 | - terrarium_idp_mode == 'local' |
348 | 360 | - terrarium_auth_domain | default('') | length > 0 |
349 | | - - terrarium_auth_trusted_tls is defined |
350 | | - - terrarium_auth_trusted_tls.rc | default(0) != 0 |
| 361 | + - terrarium_auth_public_tls is defined |
| 362 | + - terrarium_auth_public_tls.rc | default(0) != 0 |
351 | 363 |
|
352 | | - - name: Verify local auth domain serves trusted TLS after waits |
| 364 | + - name: Verify local auth domain serves public TLS after waits |
353 | 365 | ansible.builtin.command: |
354 | 366 | argv: |
355 | 367 | - curl |
|
363 | 375 | - --max-time |
364 | 376 | - "20" |
365 | 377 | - "https://{{ terrarium_auth_domain }}/.well-known/openid-configuration" |
366 | | - register: terrarium_auth_trusted_tls_final |
| 378 | + register: terrarium_auth_public_tls_final |
367 | 379 | changed_when: false |
368 | 380 | failed_when: false |
369 | 381 | when: |
370 | 382 | - terrarium_idp_mode == 'local' |
371 | 383 | - terrarium_auth_domain | default('') | length > 0 |
372 | 384 |
|
373 | | - - name: Show local auth TLS diagnostics after trusted TLS failure |
| 385 | + - name: Show local auth TLS diagnostics after public TLS failure |
374 | 386 | ansible.builtin.shell: | |
375 | 387 | set +e |
376 | 388 | echo "== presented certificate ==" |
|
389 | 401 | when: |
390 | 402 | - terrarium_idp_mode == 'local' |
391 | 403 | - terrarium_auth_domain | default('') | length > 0 |
392 | | - - terrarium_auth_trusted_tls_final is defined |
393 | | - - terrarium_auth_trusted_tls_final.rc | default(0) != 0 |
| 404 | + - terrarium_auth_public_tls_final is defined |
| 405 | + - terrarium_auth_public_tls_final.rc | default(0) != 0 |
394 | 406 |
|
395 | | - - name: Fail when local auth domain still does not serve trusted TLS |
| 407 | + - name: Fail when local auth domain still does not serve public TLS |
396 | 408 | ansible.builtin.fail: |
397 | | - msg: "Local auth domain {{ terrarium_auth_domain }} still does not serve TLS trusted by the host; see Traefik TLS diagnostics above." |
| 409 | + msg: "Local auth domain {{ terrarium_auth_domain }} still does not serve public TLS after retiring bootstrap TLS; see Traefik TLS diagnostics above." |
398 | 410 | when: |
399 | 411 | - terrarium_idp_mode == 'local' |
400 | 412 | - terrarium_auth_domain | default('') | length > 0 |
401 | | - - terrarium_auth_trusted_tls_final is defined |
402 | | - - terrarium_auth_trusted_tls_final.rc | default(0) != 0 |
| 413 | + - terrarium_auth_public_tls_final is defined |
| 414 | + - terrarium_auth_public_tls_final.rc | default(0) != 0 |
403 | 415 |
|
404 | 416 | - name: Enable Traefik sync timer after dependent services are configured |
405 | 417 | ansible.builtin.systemd: |
|
0 commit comments