SSL Certificates

Enable HTTPS for Authority.

Overview

There are two approaches to enable HTTPS:

  1. Reverse proxy (recommended) - Terminate SSL at Nginx/Traefik

  2. Direct SSL - Authority handles SSL directly

Nginx with Let's Encrypt

Install Certbot:

sudo apt install certbot python3-certbot-nginx

Get certificate:

sudo certbot --nginx -d auth.example.com

Nginx configuration:

server {
    listen 443 ssl http2;
    server_name auth.example.com;

    ssl_certificate /etc/letsencrypt/live/auth.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/auth.example.com/privkey.pem;

    # SSL settings
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
    ssl_prefer_server_ciphers off;

    # HSTS
    add_header Strict-Transport-Security "max-age=63072000" always;

    location / {
        proxy_pass http://127.0.0.1:4000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    listen 80;
    server_name auth.example.com;
    return 301 https://$server_name$request_uri;
}

Update Authority configuration:

Traefik with Let's Encrypt

Docker labels:

Option 2: Direct SSL

Authority can handle SSL directly using environment variables.

Generate Self-Signed Certificate (Development)

Configure Authority

Using Let's Encrypt Certificates

Certificate Renewal

Certbot Auto-Renewal

Certbot sets up automatic renewal. Test with:

Manual Renewal Hook

Create renewal hook to reload Authority:

Security Headers

Add security headers in your reverse proxy:

Verify SSL Configuration

Test your SSL setup:

Troubleshooting

Certificate chain incomplete

Include the full chain:

Permission denied

Ensure Authority can read certificates:

Mixed content warnings

Ensure BASE_URL uses https://:

Next Steps

Last updated

Was this helpful?