Skip to content

Commit 5886afd

Browse files
committed
fix(security): Use curl with proper timeouts in health check
BusyBox wget ignores --timeout flag causing security health endpoint to hang indefinitely. Switch to curl first with reliable timeouts. Signed-off-by: nfebe <fenn25.fn@gmail.com>
1 parent b4e3859 commit 5886afd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/infra/manager.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,13 +992,10 @@ func (m *Manager) checkNginxLuaDirectoryMounted() bool {
992992
return strings.TrimSpace(string(output)) == "yes"
993993
}
994994

995-
// checkNginxCanReachAgent tests if nginx container can reach the agent API
996995
func (m *Manager) checkNginxCanReachAgent(agentIP string, agentPort int) bool {
997-
// Try to connect to agent health endpoint from nginx container
998-
// Use wget or curl depending on what's available in the container
999996
testCmd := fmt.Sprintf(
1000-
"wget -q -O /dev/null --timeout=2 http://%s:%d/api/health 2>/dev/null && echo yes || "+
1001-
"curl -s --connect-timeout 2 http://%s:%d/api/health >/dev/null 2>&1 && echo yes || "+
997+
"curl -s --connect-timeout 2 --max-time 5 http://%s:%d/api/health >/dev/null 2>&1 && echo yes || "+
998+
"timeout 5 wget -q -O /dev/null http://%s:%d/api/health 2>/dev/null && echo yes || "+
1002999
"echo no",
10031000
agentIP, agentPort, agentIP, agentPort)
10041001

0 commit comments

Comments
 (0)