mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Push up some local changes
This commit is contained in:
parent
3420290ea9
commit
3fe62d4606
5 changed files with 130 additions and 16 deletions
|
|
@ -17,18 +17,46 @@ security add-trusted-cert -d -r trustRoot \
|
|||
-k /Library/Keychains/System.keychain \
|
||||
"$INSTALL_DIR/certs/ca-cert.pem" || true
|
||||
|
||||
# Configure system proxy
|
||||
echo "Configuring system proxy settings..."
|
||||
"$INSTALL_DIR/bin/node" "$INSTALL_DIR/agent/configure-proxy.js" --install || {
|
||||
echo "Warning: Failed to configure system proxy. You may need to configure manually."
|
||||
}
|
||||
|
||||
# Load and start the LaunchDaemon
|
||||
# Load and start the LaunchDaemon FIRST (before configuring proxy)
|
||||
echo "Starting Aikido Safe Chain Agent..."
|
||||
launchctl load -w "$LAUNCHD_PLIST" || {
|
||||
echo "Warning: Failed to start agent. You may need to restart your computer."
|
||||
echo "ERROR: Failed to start agent."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Wait for agent to be ready (check if port is listening)
|
||||
echo "Waiting for agent to start..."
|
||||
for i in {1..10}; do
|
||||
if lsof -Pi :8765 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
||||
echo "Agent is running on port 8765"
|
||||
break
|
||||
fi
|
||||
if [ $i -eq 10 ]; then
|
||||
echo "ERROR: Agent failed to start within 10 seconds"
|
||||
launchctl unload "$LAUNCHD_PLIST" 2>/dev/null || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Now configure system proxy (agent is confirmed running)
|
||||
echo "Configuring system proxy settings..."
|
||||
"$INSTALL_DIR/bin/node" "$INSTALL_DIR/agent/configure-proxy.js" --install || {
|
||||
echo "ERROR: Failed to configure system proxy."
|
||||
launchctl unload "$LAUNCHD_PLIST" 2>/dev/null || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Configure pip to trust the CA certificate
|
||||
echo "Configuring pip to trust Aikido CA certificate..."
|
||||
PIP_CONFIG_DIR="/Library/Application Support/pip"
|
||||
mkdir -p "$PIP_CONFIG_DIR"
|
||||
cat > "$PIP_CONFIG_DIR/pip.conf" << EOF
|
||||
[global]
|
||||
cert = $INSTALL_DIR/certs/ca-cert.pem
|
||||
EOF
|
||||
chmod 644 "$PIP_CONFIG_DIR/pip.conf"
|
||||
|
||||
echo "Aikido Safe Chain Agent installed successfully!"
|
||||
echo ""
|
||||
echo "The agent is now running in the background and will protect"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ if [ -f "$INSTALL_DIR/agent/configure-proxy.js" ]; then
|
|||
}
|
||||
fi
|
||||
|
||||
# Remove pip configuration
|
||||
echo "Removing pip configuration..."
|
||||
rm -f "/Library/Application Support/pip/pip.conf"
|
||||
|
||||
# Remove files
|
||||
echo "Removing files..."
|
||||
rm -rf "$INSTALL_DIR"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue