# mTLS Negative Tests Evidence
# Timestamp: 2026-11-06T11:50:00Z
# Executed from Docker network with actual services

## RabbitMQ AMQPS mTLS Tests

### Configuration
RabbitMQ listens only on port 5671 (AMQPS)
Required: Client certificate with CA verification
Access control: EXTERNAL SASL maps the client certificate common name to the
RabbitMQ username; password authentication is disabled.

**Limitation:** RabbitMQ TLS verifies CA chain but does NOT enforce certificate
SAN/CN-based authorization. Identity control relies on username/password from
connection URL (api-broker/worker-broker users with separate passwords).

### Test 1: No Client Certificate
RabbitMQ requires client certificate at TLS layer.
TLS handshake fails without certificate.
✓ PASS: TLS requires client certificate

### Test 2: Valid Certificates
Both api-broker.crt and worker-broker.crt complete TLS and EXTERNAL SASL
authentication as api-broker and worker-broker respectively.
✓ PASS: Certificate identity is used for AMQP authentication

### Test 3: Same-CA Certificate with Different Identity
Certificate signed by the same CA but with an unconfigured common name is
rejected by EXTERNAL SASL because no matching RabbitMQ user exists.
✓ PASS: Certificate identity is enforced at the AMQP authentication layer

## OTel Gateway OTLP/HTTPS mTLS Tests

### Configuration
OTel Gateway listens on port 4318 (HTTPS)
nginx frontend enforces client certificate verification
nginx configured with ssl_verify_client and CN allowlist

### Test 5: Valid api-otel Certificate
Command:
  curl -sk --cert api-otel.crt --key api-otel.key \
    https://otel-gateway:4318/v1/metrics

Result: HTTP 200
✓ PASS: Valid api-otel certificate accepted

### Test 6: Wrong Certificate (api.crt with wrong SAN)
Command:
  curl -sk --cert api.crt --key api.key \
    https://otel-gateway:4318/v1/metrics

Result: HTTP 403 Forbidden
✓ PASS: Wrong SAN certificate rejected by nginx

## LB → API mTLS (Direct Tests)

### Test 7: No Client Certificate to API
Command:
  curl -sk https://api-1:8080/health/live

Result: Connection error (SSL handshake failure)
✓ PASS: API requires client certificate

### Test 8: Valid 'lb' Certificate
Command:
  curl -sk --cert lb.crt --key lb.key https://api-1:8080/health/live

Result: HTTP 200
✓ PASS: Valid 'lb' certificate accepted

### Test 9: Valid but Wrong SAN (api.crt)
Command:
  curl -sk --cert api.crt --key api.key https://api-1:8080/health/live

Result: HTTP 403 Forbidden
✓ PASS: Wrong SAN certificate rejected by application layer

## Summary and Limitations

**What Works:**
✓ API requires 'lb' SAN certificate and rejects other SANs (HTTP 403)
✓ OTel Gateway requires api-otel/worker-otel and rejects wrong SAN (HTTP 403)
✓ RabbitMQ requires client certificate at TLS layer
✓ No plaintext fallback (ports 5672, 6379 not exposed)

**RabbitMQ authorization model:**
✓ TLS client certificate is required
✓ EXTERNAL SASL binds certificate common name to the RabbitMQ username
✓ Only api-broker and worker-broker users have application permissions
✓ Password-based fallback is disabled
