Authentication
- JWT authentication with RSA key pairs
- Optional SSO via OIDC or SAML 2.0
- Rotate tokens and keys regularly for long-running environments
- Generate RSA key pair:
Secrets management
- HashiCorp Vault for centralized secret storage with auditing and access control
- Docker Swarm secrets for encrypted in-transit/at-rest injection into services
- Store secrets in Vault:
- Store secrets in Swarm:
Network security
- All backend services run on private overlay networks
- Only the NGINX reverse proxy is exposed to the public internet
- Keep all service-to-service traffic inside the private network
- Create a private overlay network:
- Example firewall hardening (Ubuntu ufw):
TLS configuration
- Enforce TLS 1.2 or higher
- Disable weak ciphers and deprecated protocols
- Maintain at least two active certificates to enable seamless rotation
- Example NGINX TLS settings:
Additional controls
- Rate limiting: apply NGINX rate limits to absorb bursts or abuse.
- IP allowlists: restrict access to sensitive services by source IP.
- Log monitoring: ship and watch logs for anomalous events (Grafana, Prometheus alerts, ELK/Loki).