fix(deploy): bind MySQL/Redis to localhost and switch CubeProxy to host networking#269
Conversation
…st networking MySQL and Redis were exposed on 0.0.0.0 via Docker port mapping, making them accessible from any network interface with default credentials. This change restricts both services to 127.0.0.1 only. CubeProxy previously reached Redis via the host's external IP from a Docker bridge container. Since Redis is now localhost-only, CubeProxy switches to network_mode: host (matching CoreDNS's existing pattern). The nginx listen ports are parameterized via a new nginx.conf.template so the external ports (443/80) remain unchanged. Signed-off-by: longjin <longjin@tencent.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: longjin <longjin@dragonos.org>
|
/cubebot review |
|
Claude finished @staryxchen's task in 54s —— View job Reviewing PR #269: fix(deploy): bind MySQL/Redis to localhost and switch CubeProxy to host networkingTodo List
Code ReviewOverviewThis PR improves security by binding MySQL/Redis to Security (Positive)
Issues Found1.
|
| Severity | Issue | File |
|---|---|---|
| Medium | nginx runs as root | nginx.conf.template:1 |
| Low | worker_processes hardcoded to 12 |
nginx.conf.template:2 |
| Medium | SSL cert paths hardcoded | nginx.conf.template:128-129 |
| Low | Readiness only checks HTTPS port | up-cube-proxy.sh:119 |
| Low | No HTTP→HTTPS redirect | nginx.conf.template:90-122 |
| Low | Port conflict risk with host networking | docker-compose.yaml.template:9 |
The core security improvement (binding MySQL/Redis to localhost) is solid. The network_mode: host change is consistent with the existing CoreDNS pattern. The main concerns are the nginx running as root and the hardcoded SSL cert paths, which could cause runtime failures in different deployment environments.
| @@ -0,0 +1,181 @@ | |||
| user root; | |||
| worker_processes 12; | |||
There was a problem hiding this comment.
As a template, it's best not to hard-code it; use auto instead.
There was a problem hiding this comment.
Please note that this is for reference only and should not be used directly in a production environment.
Summary
127.0.0.1only, preventing external network access to these services with default credentialsnetwork_mode: hostso it can reach Redis via localhost (following CoreDNS's existing pattern)nginx.conf.templateso CubeProxy nginx listens on configurable ports (default 443/80), maintaining the same external-facing behaviorSecurity Impact
Before: MySQL and Redis were accessible on all network interfaces (
0.0.0.0) with weak default credentials. Any client that could reach the host IP could connect.After: Both services are only accessible from
127.0.0.1. External connections are refused.Files Changed
deploy/one-click/support/docker-compose.yaml.template127.0.0.1deploy/one-click/cubeproxy/docker-compose.yaml.templatenetwork_mode: host, removeports, add nginx.conf volumedeploy/one-click/cubeproxy/nginx.conf.template__CUBE_PROXY_HTTPS_PORT__/__CUBE_PROXY_HTTP_PORT__deploy/one-click/scripts/one-click/up-cube-proxy.sh127.0.0.1, nginx template processing, port variablesdeploy/one-click/env.exampleTest plan
ss -tlnp | grep -E '3306|6379'confirms MySQL/Redis only on127.0.0.1ss -tlnp | grep -E ':443|:80'confirms CubeProxy listens on 443/80🤖 Generated with Claude Code