Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: removed socat, fixed aztec-run #8145

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions aztec-up/bin/.aztec-run
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,23 @@ if [[ -z "${SKIP_PORT_ASSIGNMENT:-}" ]]; then
port_assignment="-p $AZTEC_PORT:$AZTEC_PORT"
fi

if [[ "$ENV_VARS_TO_INJECT" == *"SSH_AUTH_SOCK"* && -n "${SSH_AUTH_SOCK:-}" ]]; then
warn "SSH_AUTH_SOCK is set to ${SSH_AUTH_SOCK:-}. Enabling SSH agent forwarding via socat"
socat TCP-LISTEN:${SSH_AUTH_SOCK_SOCAT_PORT:-12345},reuseaddr,fork UNIX-CLIENT:$SSH_AUTH_SOCK &
SOCAT_PID=$!
trap "kill -9 $SOCAT_PID" SIGINT SIGTERM EXIT
DOCKER_ENV+=" -e SSH_AUTH_SOCK_SOCAT_PORT=${SSH_AUTH_SOCK_SOCAT_PORT:-12345}"
ssh_agent_socket_mount=""
if [[ "${ENV_VARS_TO_INJECT:-}" == *"SSH_AUTH_SOCK"* && -n "${SSH_AUTH_SOCK:-}" ]]; then
warn "SSH_AUTH_SOCK is set to ${SSH_AUTH_SOCK:-}. Attempting to enable SSH agent forwarding"

if [[ "$UNAME" == "Darwin" ]]; then
if ! command -v socat &> /dev/null; then
warn "Socat is not installed. To make SSH agent forwarding work in MacOS, please run:\n\nbrew install socat\n"
else
socat TCP-LISTEN:${SSH_AUTH_SOCK_SOCAT_PORT:-12345},reuseaddr,fork UNIX-CLIENT:$SSH_AUTH_SOCK &
SOCAT_PID=$!
trap "kill -9 $SOCAT_PID" SIGINT SIGTERM EXIT
DOCKER_ENV+=" -e SSH_AUTH_SOCK_SOCAT_PORT=${SSH_AUTH_SOCK_SOCAT_PORT:-12345}"
fi
else
DOCKER_ENV+=" -e SSH_AUTH_SOCK=${SSH_AUTH_SOCK}"
ssh_agent_socket_mount="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK"
fi
fi

docker run \
Expand All @@ -134,6 +145,7 @@ docker run \
--workdir "$PWD" \
-v $HOME:$HOME -v cache:/cache \
$port_assignment \
$ssh_agent_socket_mount \
${DOCKER_ENV:-} \
${DOCKER_HOST_BINDS:-} \
${DOCKER_USER:-} \
Expand Down
5 changes: 0 additions & 5 deletions aztec-up/bin/aztec-install
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ if ! command -v docker &>/dev/null; then
exit 1
fi

if ! command -v socat &> /dev/null; then
echo "Socat is not installed. Please install socat and try again."
exit 1
fi

# Check if Docker is running.
if ! docker info &>/dev/null; then
warn "Docker is not running. Please start Docker and try again."
Expand Down
14 changes: 7 additions & 7 deletions yarn-project/cli-wallet/wallet-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash


cleanup() {
kill -9 $SOCAT_PID
rm -rf $SOCKET
}

if [[ -n "${SSH_AUTH_SOCK_SOCAT_PORT:-}" ]]; then
cleanup() {
kill -9 $SOCAT_PID
rm -rf $SOCKET
}

SOCKET="$HOME/.aztec/aztec-wallet-$RANDOM.sock"
socat UNIX-LISTEN:$SOCKET,fork TCP:host.docker.internal:${SSH_AUTH_SOCK_SOCAT_PORT} &
SOCAT_PID=$!
trap cleanup EXIT SIGKILL SIGTERM
export SSH_AUTH_SOCK="${SOCKET:-}"
fi

SSH_AUTH_SOCK="${SOCKET:-}" node --no-warnings /usr/src/yarn-project/cli-wallet/dest/bin/index.js $@
node --no-warnings /usr/src/yarn-project/cli-wallet/dest/bin/index.js $@
Loading