Repository navigation
docs: LiteLLM Hardened Production Stack Documentation - #39405
myu1d157h0u54nd wants to merge 4 commits into
Conversation
…-docker-compose-hardened
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR replaces the repository-root development and hardened Compose files with a generated production deployment stack supporting direct and Squid-based egress. It adds secret provisioning, firewall checks, health polling, optional systemd installation, and an operator deployment guide
Confidence Score: 2/5This PR should not merge until the removed Compose interfaces are preserved and proxy mode actually enforces the promised egress boundary Existing documented development commands lose their Compose files, and the replacement proxy topology permits both direct outbound routing and unrestricted proxy destinations Files Needing Attention: docker-compose.yml, docker-compose.hardened.yml, docker-compose/compose.yaml.template, docker-compose/deploy.sh
|
| Filename | Overview |
|---|---|
| docker-compose.yml | Deletes the established root development stack without preserving compatibility for documented repository-root Compose workflows |
| docker-compose.hardened.yml | Deletes the established hardened Compose entrypoint and leaves existing hardened-stack instructions referencing a missing file |
| docker-compose/compose.yaml.template | Adds a valid hardened Compose template, but proxy mode retains a direct public-egress route that bypasses Squid |
| docker-compose/deploy.sh | Adds provisioning and lifecycle automation, but its Squid policy allows arbitrary HTTP and HTTPS destinations |
| docker-compose/README.md | Adds comprehensive customer-facing production deployment documentation in a repository where product documentation belongs elsewhere |
Comments Outside Diff (1)
-
docker-compose.ymlRoot Compose Interface Removed
Existing documented root-level Compose commands now lack configuration files, causing development, database, Prometheus, and hardened-stack startup commands to fail.
Rule Used: What: avoid backwards-incompatible changes without... (source)
Knowledge Base Used: Proxy configuration and deployment
Reviews (1): Last reviewed commit: "LiteLLM Hardened Production Stack Docume..." | Re-trigger Greptile
| networks: | ||
| - public-egress | ||
| - backend-internal |
There was a problem hiding this comment.
Proxy Egress Remains Unrestricted
In proxy mode, LiteLLM retains direct internet routing, while Squid permits arbitrary destinations on ports 80 and 443, defeating filtered egress.
How this was verified: The network remains externally routed and the complete Squid policy ends with http_access allow all.
| # LiteLLM Hardened Production Stack Documentation | ||
|
|
||
| This document outlines the production-grade deployment guidelines for the LiteLLM Proxy infrastructure. The system is engineered as a single, unified architecture offering two configurable egress topologies: **Direct Egress** and **Proxy-Filtered Egress (Squid)**. The underlying design emphasizes container isolation, OWASP-compliant secrets management, and strict network segmentation through a Zero-Trust internal model. |
There was a problem hiding this comment.
Product Documentation Added In-Tree
This operator-facing production guide belongs in litellm-docs; keeping it here splits publishing and maintenance across repositories.
Rule Used: Prevent documentation about the LiteLLM product fr... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if command -v ufw >/dev/null 2>&1; then | ||
| UFW_STATUS=$(ufw status | grep -i "status: active" || true) | ||
| if [ -n "${UFW_STATUS}" ]; then | ||
| PORT_ALLOWED=$(ufw status | grep -E "${TARGET_PORT}(/tcp)?.*ALLOW" || true) |
There was a problem hiding this comment.
Redundant Script Comments Added
Ordinary section labels and narration duplicate straightforward commands throughout this script, violating the source-comment policy and adding maintenance overhead.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| acl CONNECT method CONNECT | ||
| http_access deny !Safe_ports | ||
| http_access deny CONNECT !SSL_ports | ||
| http_access allow all |
There was a problem hiding this comment.
Low: Proxy mode does not enforce filtered egress
http_access allow all permits requests to every HTTP/HTTPS destination, and the LiteLLM container remains attached directly to the non-internal public-egress bridge. An attacker who can induce or execute an outbound request can therefore send data to an arbitrary host, either through Squid or by bypassing it; use destination allowlists and a network topology where only the egress gateway has an external route.
| echo -e "${GREEN}=====================================================${NC}" | ||
| echo -e " ${BOLD}URL:${NC} http://127.0.0.1:${TARGET_PORT}/ui/login/" | ||
| echo -e " ${BOLD}User:${NC} admin (or Bearer Token / UI Auth)" | ||
| echo -e " ${BOLD}Password:${NC} ${YELLOW}${LITELLM_MASTER_KEY}${NC}" |
There was a problem hiding this comment.
Low: Administrator key exposed in deployment output
This prints the master key verbatim, so anyone with access to captured provisioning output, CI logs, or terminal-session logs can authenticate as the administrator. Keep the key only in the restricted secret file and print the command or path needed to retrieve it instead.
PR overviewThis pull request documents and provides deployment automation for a production LiteLLM stack using Docker Compose, including proxy-based egress and generated service credentials. Three issues remain open around unrestricted outbound connectivity and credential handling. The deployment can expose the administrator key through logs, leave generated secrets vulnerable to accidental Git commits, and allow arbitrary external destinations; exploitation generally requires access to deployment artifacts, repository contents, or the ability to induce outbound requests. No issues have yet been addressed. Open issues (3)
Fixed/addressed: 0 · PR risk: 4/10 |
| fi | ||
|
|
||
| # Provision Secrets | ||
| mkdir -p -m 700 "${SECRETS_DIR}" |
There was a problem hiding this comment.
Low: Generated credentials are not excluded from Git
This creates the secrets directory inside the cloned repository, while the current .gitignore does not exclude docker-compose/secrets/. Add that directory to the repository's ignore rules so a routine git add -A cannot commit the master key, salt key, and database credentials.
…-docker-compose-hardened
This document outlines the production-grade deployment guidelines for the LiteLLM Proxy infrastructure. The system is engineered as a single, unified architecture offering two configurable egress topologies: Direct Egress and Proxy-Filtered Egress (Squid). The underlying design emphasizes container isolation, OWASP-compliant secrets management, and strict network segmentation through a Zero-Trust internal model.
TLDR
Problem this solves
How it solves it
User Flow
Before: Manual deployment without hardening
After: Deploy using deploy.sh template
(Steps 1–3 are identical in both flows; divergence begins at step 4 with firewall/proxy selection.)
Relevant issues
Linear ticket
—
Screenshots / Proof of Fix
Since this is an infrastructure/ops PR, proof takes the form of:
Structure per the template: Before and After one heading level below this section, each naming the commit hash it was captured at, one lower-level heading per case inside each, the same case names in the same order on both sides, and numbered steps (command, observed output) under every case.
Type
🚄 Infrastructure
Caveats (if any)
Severe: Inherent to deployment configuration
Medium: Operational gaps someone can hit
Low: Edge cases and cleanup
QA runbook
Note environment prerequisites (root, UFW, Docker Engine 20.10+, Docker Compose V2) and any nuances a manual run will hit. See PRs test(e2e): cover key rpm/tpm rate limiting, window reset, and pacing headers #32914 and test(e2e): cover model-aware mid-conversation system handling on Bedrock Invoke /v1/messages #32963 for full examples.