Add ACME/Certbot E2E tests with Pebble integration and update dependencies in CI workflows
- Introduced `docker-compose-acme-e2e.yml` for end-to-end testing with Pebble test server. - Added tests to validate ACME challenge routing, certificate issuance, HTTPS functionality, and HAProxy configuration. - Implemented CA certificate download fixture (`create_pebble_ca_file`) for test session initialization. - Updated `.gitignore` to exclude Pebble-related files. - Modified CI workflows to include `needs: [Test]` dependencies for E2E jobs, ensuring proper sequencing.
This commit is contained in:
parent
2e45c3f2e5
commit
3e963228f3
4 changed files with 337 additions and 1 deletions
124
tests_e2e/docker/docker-compose-acme-e2e.yml
Normal file
124
tests_e2e/docker/docker-compose-acme-e2e.yml
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# ==============================================================================
|
||||
# E2E Test: ACME/Certbot with Pebble Test Server
|
||||
# ==============================================================================
|
||||
#
|
||||
# WHAT THIS TESTS:
|
||||
# - HAProxy routing of /.well-known/acme-challenge/ to certbot backend
|
||||
# - Certbot HTTP-01 challenge completion with Pebble ACME server
|
||||
# - Certificate issuance and storage in /certs/certbot/live/{domain}/
|
||||
# - HTTPS serving with issued certificate
|
||||
# - Full end-to-end ACME protocol flow
|
||||
#
|
||||
# ABOUT PEBBLE:
|
||||
# Pebble is Let's Encrypt's official ACME test server (RFC 8555 compliant)
|
||||
# - Runs locally without internet access
|
||||
# - No rate limits or DNS requirements
|
||||
# - Issues test certificates (not trusted by browsers)
|
||||
# - Perfect for integration testing
|
||||
#
|
||||
# HOW TO RUN (via pytest):
|
||||
# ```bash
|
||||
# cd tests_e2e
|
||||
# pytest test_docker_compose.py::TestACME -v
|
||||
# ```
|
||||
#
|
||||
# MANUAL TESTING:
|
||||
# ```bash
|
||||
# cd tests_e2e/docker
|
||||
# docker compose -f docker-compose-acme-e2e.yml up --build
|
||||
#
|
||||
# # Wait 10-15 seconds for certificate issuance
|
||||
# # Check logs
|
||||
# docker compose -f docker-compose-acme-e2e.yml logs haproxy
|
||||
#
|
||||
# # Verify certificate was issued
|
||||
# ls -la ../../certs/certbot/live/test.local/
|
||||
#
|
||||
# # Test HTTPS (will show certificate warning - expected for test certs)
|
||||
# curl -k https://localhost/ -H "Host: test.local"
|
||||
#
|
||||
# # Cleanup
|
||||
# docker compose -f docker-compose-acme-e2e.yml down
|
||||
# ```
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
services:
|
||||
# Pebble ACME Server - Let's Encrypt test environment
|
||||
pebble:
|
||||
image: ghcr.io/letsencrypt/pebble:latest
|
||||
command: -config /test/my-pebble-config.json
|
||||
environment:
|
||||
# Speed up validation (no artificial delays)
|
||||
PEBBLE_VA_NOSLEEP: 1
|
||||
# Actually perform challenge validation (not always valid)
|
||||
PEBBLE_VA_ALWAYS_VALID: 0
|
||||
volumes:
|
||||
# Custom config to use port 80 for validation
|
||||
- ./pebble-config.json:/test/my-pebble-config.json:ro
|
||||
ports:
|
||||
# ACME API endpoint
|
||||
- "14000:14000"
|
||||
# Management API (optional)
|
||||
- "15000:15000"
|
||||
networks:
|
||||
- acme-test
|
||||
|
||||
# Backend web server
|
||||
backend:
|
||||
image: byjg/static-httpserver
|
||||
labels:
|
||||
easyhaproxy.http.host: test.local
|
||||
easyhaproxy.http.localport: 8080
|
||||
easyhaproxy.http.certbot: "true"
|
||||
easyhaproxy.http.clone_to_ssl: "true"
|
||||
easyhaproxy.http.redirect_ssl: "true"
|
||||
networks:
|
||||
- acme-test
|
||||
|
||||
# EasyHAProxy with Certbot
|
||||
haproxy:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: build/Dockerfile
|
||||
depends_on:
|
||||
- pebble
|
||||
- backend
|
||||
environment:
|
||||
EASYHAPROXY_DISCOVER: docker
|
||||
HAPROXY_CUSTOMERRORS: "true"
|
||||
|
||||
# Certbot configuration pointing to Pebble
|
||||
EASYHAPROXY_CERTBOT_EMAIL: test@example.com
|
||||
EASYHAPROXY_CERTBOT_SERVER: https://pebble:14000/dir
|
||||
|
||||
# Trust Pebble's CA certificate
|
||||
REQUESTS_CA_BUNDLE: /etc/ssl/certs/pebble-ca.pem
|
||||
|
||||
# Reduce certbot timeout for faster tests
|
||||
EASYHAPROXY_CERTBOT_TIMEOUT: 30
|
||||
|
||||
# Enable debug logging for troubleshooting
|
||||
EASYHAPROXY_DEBUG: "false"
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
# Certificate storage (Docker volume for clean test isolation)
|
||||
- certbot-certs:/certs/certbot
|
||||
# Pebble CA certificate (downloaded during test session)
|
||||
- ./pebble-ca.pem:/etc/ssl/certs/pebble-ca.pem:ro
|
||||
ports:
|
||||
- "80:80/tcp"
|
||||
- "443:443/tcp"
|
||||
networks:
|
||||
acme-test:
|
||||
aliases:
|
||||
# Allow Pebble to reach HAProxy via test.local for challenge validation
|
||||
- test.local
|
||||
|
||||
networks:
|
||||
acme-test:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
certbot-certs:
|
||||
Loading…
Add table
Add a link
Reference in a new issue