Skip to main content
iii is designed with security in mind, but proper configuration is essential for production deployments. This guide covers security best practices for running iii in production.

Production Docker Deployment

Hardened Container

Use security-hardened Docker configuration:
Security features:
  • --read-only: Immutable root filesystem
  • --tmpfs /tmp: Writable temporary storage
  • --cap-drop=ALL: Drop all Linux capabilities
  • --cap-add=NET_BIND_SERVICE: Allow binding to privileged ports only
  • --security-opt=no-new-privileges: Prevent privilege escalation
  • :ro: Mount config as read-only

Distroless Base Image

iii uses Google’s distroless base image for minimal attack surface:
Benefits:
  • No shell or package manager
  • Minimal dependencies
  • Non-root user by default
  • Smaller attack surface

TLS with Caddy

Reverse Proxy Setup

Use Caddy for automatic TLS with Let’s Encrypt: Caddyfile:
Docker Compose:

WebSocket over TLS

Connect workers using wss:// (secure WebSocket):

Custom TLS Certificates

For custom certificates, mount them in Caddy:

Authentication

HTTP Function Authentication

iii supports multiple authentication methods for external HTTP functions:

Bearer Token

Set the token in environment:

API Key

HMAC Signature

Always use environment variables for secrets. Never hardcode credentials in configuration files or code.

API Authentication

For the HTTP API, implement authentication via middleware or reverse proxy: Caddy with Basic Auth:
Caddy with JWT:

Network Security

Port Exposure

Public-facing ports:
  • 443 (HTTPS) - Caddy/reverse proxy only
  • 80 (HTTP) - Redirect to HTTPS
Internal ports (not exposed):
  • 3111 - HTTP API (behind proxy)
  • 49134 - WebSocket (behind proxy)
  • 3112 - Stream API (behind proxy)
  • 9464 - Prometheus metrics (internal only)
Docker configuration:

Firewall Rules

Configure firewall to restrict access:

Network Isolation

Use Docker networks for service isolation:

Secrets Management

Environment Variables

Use Docker secrets or external secret managers: Docker Swarm Secrets:
Kubernetes Secrets:

Vault Integration

Integrate with HashiCorp Vault:

Configuration Security

Environment Variable Expansion

iii supports environment variable expansion in config files:

Read-Only Configuration

Mount configuration as read-only:

Sensitive Data Filtering

iii automatically redacts sensitive fields in logs:
  • Passwords
  • API keys
  • Tokens
  • Connection strings

Monitoring Security

Secure Metrics Endpoint

Restrict Prometheus metrics access: Caddy with IP allowlist:
Prometheus with basic auth:

Audit Logging

Enable audit logging for security events:

Resource Limits

Docker Resource Constraints

Rate Limiting

Implement rate limiting at the reverse proxy:

Incident Response

Security Monitoring

Monitor for security events:

Log Retention

Configure appropriate log retention:
Export logs to external SIEM:

Compliance

Data Encryption

  • In transit: TLS 1.3 for all network communication
  • At rest: Use encrypted volumes for persistent data

Data Retention

Configure retention policies:

Access Control

Implement least-privilege access:
  • Separate service accounts for each component
  • Use RBAC for Kubernetes deployments
  • Implement network policies
  • Regular access reviews

Security Checklist

  • Use TLS for all external communication
  • Run containers as non-root user
  • Use read-only root filesystem
  • Drop all unnecessary capabilities
  • Implement authentication on all APIs
  • Use environment variables for secrets
  • Enable security audit logging
  • Configure resource limits
  • Implement rate limiting
  • Restrict network access with firewall
  • Use private Docker networks
  • Mount configs as read-only
  • Enable security monitoring alerts
  • Regular security updates
  • Backup encryption keys
  • Document incident response plan

References