Recommendation

http://www.focuscloud.dev is real.
Recommended architecture
Local inference only
My recommendation is to build FocusCloud.dev as a zero-trust, isolated AI infrastructure, where models can generate ideas and agents can perform tasks, but neither automatically receives access to your server.
Your central security principle should be:
AI can request an action. A security layer decides whether that action is allowed.
This architecture uses your existing Ubuntu, Docker, Nginx, Langflow and Ollama infrastructure. You do not need to replace your existing stack.
1. Overall architecture
FocusCloud secure AI network
Internet / FocusCloud customers
Web applications · SaaS users · API requests
Nginx reverse proxy
HTTPS · TLS · Rate limiting · Request filtering
AI security gateway
Trusted boundary
Authentication
Input inspection
Permissions
Audit logging
Langflow
Agent orchestration, workflows and memory
Ollama
Local model inference only
Restricted execution layer
Separate Docker containers for code execution and agent tools
Filesystem sandbox
Network restrictions
Resource limits
Human approval
Protected data layer
PostgreSQL · Customer files · Secrets vault · Backups
The most important design choice is that the model, agent, execution environment and customer database must be separate security boundaries.
2. Your Docker network design
I would create five separate Docker networks.
| Network | Containers | Access |
|---|---|---|
proxy_net | Nginx | Public entry point |
ai_control | AI gateway, Langflow | Internal |
model_net | Ollama | Internal inference |
execution_net | Code execution agents | Restricted |
data_net | PostgreSQL, Redis | Internal only |
Do not connect every container to every network.
For example:
- Nginx can reach the AI gateway.
- The gateway can communicate with Langflow.
- Langflow can communicate with Ollama.
- Execution containers receive only approved tools.
- Customer databases are accessible through narrowly scoped application services, not directly by the model.
Important: Docker networks alone are not a complete firewall. Use host firewall rules, container-level policies and explicit network egress restrictions as well.
3. The most important component: Langflow isolation
High priority
This is where I would be particularly careful.
Langflow is powerful because it can execute Python code. Its official security documentation explicitly warns that code executed within Langflow can access the filesystem, network and resources available to its backend process. It also does not provide strong tenant isolation inside one Langflow process. Langflow Documentation
For FocusCloud.dev, I recommend:
- Keep Langflow as your internal agent-development and orchestration environment.
- Do not give public customers access to the Langflow administration interface.
- Do not let customers upload arbitrary Python components into your shared Langflow instance.
- Deploy customer-facing workflows through a separate application API.
- Run untrusted customer workflows in separate isolated execution environments.
- Use separate Langflow instances for different trust levels if customers need custom flows.
Three levels of AI access
Level 1
Internal trusted agents
Your own security monitoring, internal assistants and administrative workflows.
Level 2
Customer-facing agents
Pre-approved workflows with restricted tools and customer-specific permissions.
Level 3
Code execution agents
Untrusted generated code, isolated per job, with no access to the host or other customers.
4. Protect Ollama
Your existing configuration already has a good starting point:
- Ollama runs in Docker.
- It is attached to your
ai_network. - Port 11434 is not published to the public host.
- Langflow can reach Ollama through Docker networking.
This is preferable to exposing the Ollama API directly to the internet. Ollama normally binds to localhost by default, and its API should remain behind your internal access controls. GitHub
My proposed configuration:
| Setting | Recommendation |
|---|---|
| API port | Internal Docker network only |
| Public access | Disabled |
| Container user | Non-root where supported |
| Model directory | Read-only for inference |
| Model downloads | Trusted administrator only |
| GPU access | Only the Ollama container |
| API requests | Gateway-controlled |
| Logs | Monitor unusual requests |
Also verify downloaded model files, their provenance and checksums. A checksum verifies file integrity against a known trusted value; it does not prove that a model is benign.
5. Isolate code execution
This is particularly important because FocusCloud.dev generates applications using AI.
Imagine a customer asks an agent to build a website. The AI generates code, and the execution environment runs it.
What happens if that code contains a malicious command?
It must not be able to:
- Read
/root. - Access
/etc. - Read other customers’ projects.
- Access your Docker socket.
- Connect to your PostgreSQL database directly.
- Read
.envfiles containing API credentials. - Access the host’s network interfaces.
I would create a separate execution service.
Code execution sandbox
AI-generated project
Untrusted source code
Temporary isolated environment
- One job per environment
- No host filesystem mounts
- No Docker socket
- Non-root execution
- CPU and RAM limits
- Restricted network
- Read-only base filesystem
Security validation
Build checks · Dependency scanning · Output inspection
Approved deployment
For genuinely untrusted code, I would eventually use a stronger isolation boundary such as a microVM or gVisor rather than relying on ordinary Docker containers alone.
6. Docker hardening
Every container should have the minimum permissions necessary.
For example, a basic Compose security baseline for an application that supports these settings:
services: ai-worker: image: your-pinned-worker-image user: "10001:10001" read_only: true security_opt: - no-new-privileges:true cap_drop: - ALL pids_limit: 128 mem_limit: 1g cpus: 1.0 tmpfs: - /tmp:rw,noexec,nosuid,size=64m restart: unless-stopped
This is a starting baseline, not a complete sandbox. The application must support running as this user, and writable directories must be explicitly provided.
Other measures:
- Keep Docker’s default seccomp profile enabled.
- Apply AppArmor where possible.
- Never mount
/var/run/docker.sockinto an AI container. - Avoid
privileged: true. - Avoid host networking for agents.
- Pin images to verified versions or digests.
Docker documents rootless mode as another way to reduce the impact of container and daemon vulnerabilities. Consider it for suitable services, but test GPU compatibility before changing your existing Ollama deployment. Docker Docs+2
7. Secure customer data
This is essential for a commercial AI SaaS.
Every customer should have a separate security context.
| Resource | Security requirement |
|---|---|
| Customer files | Separate storage directories and permissions |
| Conversations | Tenant-scoped records |
| API credentials | Encrypted secrets storage |
| PostgreSQL | Restricted service accounts |
| Vector databases | Tenant-specific access controls |
| Agent memory | Never shared across customers |
| Logs | Redact credentials and sensitive content |
For example:
FocusCloud│├── Customer A│ ├── files/│ ├── conversations/│ ├── agent-memory/│ └── permissions│├── Customer B│ ├── files/│ ├── conversations/│ ├── agent-memory/│ └── permissions│└── Customer C ├── files/ ├── conversations/ ├── agent-memory/ └── permissions
The model should never decide which customer data it can access. Your backend must enforce that decision.
8. Add an autonomous security monitoring agent
You previously considered building an AI network defense system for FocusCloud.dev.
I would make it a separate security service, not another unrestricted Langflow agent.
FocusCloud AI security operations
Monitoring sensors
Ubuntu audit logs · Docker events · Nginx access logs · Network connections · Authentication events
Detection engine
Rules · Anomaly detection · Local AI analysis
Security response
Automatic
Block known malicious IPs
Automatic
Stop suspicious execution jobs
Approval
Disable customer accounts
Approval
Change firewall policies
Approval
Delete data or terminate production services
The security agent itself should have read-only monitoring access by default. Give it narrowly scoped response tools, not unrestricted shell access.
For important actions, require approval and record the decision.
9. Implementation roadmap
I would implement this in five phases rather than changing everything at once.
- Phase 1 — Secure the existing infrastructure
- Audit public ports.
- Secure Nginx.
- Confirm Langflow authentication.
- Keep Ollama private.
- Review Docker permissions.
- Protect SSH and administrative access.
- Phase 2 — Build the AI security gateway
- Customer authentication.
- Tenant permissions.
- Request validation.
- Tool authorization.
- Usage limits.
- Audit logging.
- Phase 3 — Isolate agents
- Separate internal and customer agents.
- Introduce restricted execution workers.
- Add filesystem and network restrictions.
- Prevent cross-customer access.
- Phase 4 — Add security monitoring
- Docker event monitoring.
- Ubuntu audit monitoring.
- Suspicious process detection.
- Network anomaly detection.
- Controlled automated response.
- Phase 5 — Security testing
- Attempt container escape tests.
- Test customer data isolation.
- Test prompt injection.
- Test malicious generated code.
- Test credential exposure.
- Verify backups and recovery.
10. First, inspect your actual server
I don’t recommend installing or changing anything before auditing the current infrastructure. In particular, your previous configuration had both host Nginx and a Traefik container using host networking, so we should establish which service owns the public ports before making changes.
Run these commands on Ubuntu.
# 1. Running containers
docker ps --no-trunc
# 2. Docker network configuration
docker network ls
# 3. Inspect AI network
docker network inspect ai_network
# 4. Listening network ports
sudo ss -tulpn
# 5. Firewall status
sudo ufw status verbose
# 6. Docker security information
docker info
# 7. Check Ollama connectivity internally
docker exec langflow \
python -c "import urllib.request; print(urllib.request.urlopen('http://ollama:11434/api/tags', timeout=5).status)"
# 8. Check Langflow binding
sudo ss -lntp | grep 7860
# 9. Check Docker socket exposure
docker inspect langflow ollama \
--format '{{.Name}} {{json .Mounts}}'
These are inspection commands; they do not intentionally modify your configuration. The Langflow container name may differ if you have renamed it.
11. The target infrastructure
FocusCloud.dev security blueprint
Public attack surface
Minimal
- Nginx: public HTTPS only.
- SSH: restricted administrative access.
- No publicly accessible Ollama.
- No publicly accessible Docker API.
- No public Langflow administration interface.Private infrastructure
- Langflow: internal orchestration.
- Ollama: private inference.
- PostgreSQL: protected customer data.
- AI gateway: policy enforcement.
- Execution workers: isolated workloads.
- Security monitor: detection and response.Security philosophy
Zero Trust AI
Trust no model, agent, plugin, generated code or customer request by default.
What I need before writing your actual deployment configuration
I would like to build this around your existing containers rather than give you a generic Docker Compose file that might break your running services.
1. Where are FocusCloud and Langflow running?Same Ubuntu serverSeparate Ubuntu serversNot sure
2. How should AI-generated code execute?Docker sandbox per jobMicroVM isolation (stronger isolation)Both, depending on risk
3. Who should use the AI infrastructure?Only FocusCloud internal agentsPaying FocusCloud customersBoth internal agents and customers
Build my deployment plan
My goal would be to make FocusCloud.dev capable of running autonomous AI agents without allowing those agents to become administrators of the machine hosting them.
I can also help you establish a recurring security review of this infrastructure once the initial deployment is complete.
🛡️Review FocusCloud AI security monthlyTap to set up
Technical references:
1

