From 5a6cffeef8904ada64aa69263086298eaecc315f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Apr 2026 19:38:41 +0000 Subject: [PATCH] fix: edge control stdout pollution and install.sh dispatch - Redirect all status messages in caddy.sh to stderr (add_route, remove_route, reload_caddy) - Redirect status message in authorized_keys.sh to stderr (rebuild_authorized_keys) - Fix install.sh to source authorized_keys.sh library and call rebuild_authorized_keys directly --- tools/edge-control/install.sh | 5 ++++- tools/edge-control/lib/authorized_keys.sh | 2 +- tools/edge-control/lib/caddy.sh | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/edge-control/install.sh b/tools/edge-control/install.sh index d206e7b..68880ab 100755 --- a/tools/edge-control/install.sh +++ b/tools/edge-control/install.sh @@ -311,7 +311,10 @@ else fi # Create initial authorized_keys for tunnel user -"${INSTALL_DIR}/lib/authorized_keys.sh" rebuild_authorized_keys +# Source the library and call the function directly (not as subprocess) +source "${INSTALL_DIR}/lib/ports.sh" +source "${INSTALL_DIR}/lib/authorized_keys.sh" +rebuild_authorized_keys # ============================================================================= # Step 6: Configure forced command for disinto-register diff --git a/tools/edge-control/lib/authorized_keys.sh b/tools/edge-control/lib/authorized_keys.sh index 5ba32d6..f90bf34 100755 --- a/tools/edge-control/lib/authorized_keys.sh +++ b/tools/edge-control/lib/authorized_keys.sh @@ -85,7 +85,7 @@ rebuild_authorized_keys() { chmod 600 "$TUNNEL_AUTH_KEYS" chown -R "$TUNNEL_USER":"$TUNNEL_USER" "$TUNNEL_SSH_DIR" - echo "Rebuilt authorized_keys for ${TUNNEL_USER} (entries: $(echo "$content" | grep -c 'ssh-' || echo 0))" + echo "Rebuilt authorized_keys for ${TUNNEL_USER} (entries: $(echo "$content" | grep -c 'ssh-' || echo 0))" >&2 } # Get the current authorized_keys content (for verification) diff --git a/tools/edge-control/lib/caddy.sh b/tools/edge-control/lib/caddy.sh index 0bfe307..69970cf 100755 --- a/tools/edge-control/lib/caddy.sh +++ b/tools/edge-control/lib/caddy.sh @@ -69,7 +69,7 @@ EOF return 1 } - echo "Added route: ${fqdn} → 127.0.0.1:${port}" + echo "Added route: ${fqdn} → 127.0.0.1:${port}" >&2 } # Remove a route for a project @@ -104,7 +104,7 @@ remove_route() { return 1 } - echo "Removed route: ${fqdn}" + echo "Removed route: ${fqdn}" >&2 } # Reload Caddy to apply configuration changes @@ -118,7 +118,7 @@ reload_caddy() { return 1 } - echo "Caddy reloaded" + echo "Caddy reloaded" >&2 } # Get Caddy config for debugging