wallarm/pre-deployment-test.sh
2026-03-12 09:17:43 +00:00

56 lines
No EOL
1.9 KiB
Bash

#!/bin/bash
# --- Styling ---
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${YELLOW}=== Wallarm Pre-Deployment Connectivity Test ===${NC}"
# --- INTERACTIVE INPUT (FORCED TO TTY) ---
read -p "Enter Application Server IP [127.0.0.1]: " APP_HOST </dev/tty
APP_HOST=${APP_HOST:-127.0.0.1}
read -p "Enter Application Server Port [8080]: " APP_PORT </dev/tty
APP_PORT=${APP_PORT:-8080}
echo -e "\n${YELLOW}[1/3] Testing Wallarm Cloud Connectivity...${NC}"
# Function to test IP/Port
test_connection() {
local target=$1
local description=$2
# Using timeout to prevent hanging on bank firewalls
if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$target/443" 2>/dev/null; then
echo -e "${GREEN}[PASS]${NC} $description ($target)"
else
echo -e "${RED}[FAIL]${NC} $description ($target) - BLOCKED"
fi
}
# --- EU ENDPOINTS ---
echo "--- EU Cloud ---"
test_connection "34.160.38.183" "node-data1.eu1"
test_connection "34.144.227.90" "node-data0.eu1"
test_connection "34.90.110.226" "api.wallarm.com"
# --- US ENDPOINTS ---
echo -e "\n--- US Cloud ---"
test_connection "34.96.64.17" "node-data0.us1"
test_connection "34.110.183.149" "node-data1.us1"
test_connection "35.235.66.155" "us1.api.wallarm.com"
test_connection "34.102.90.100" "Extra US-1"
test_connection "34.94.156.115" "Extra US-2"
test_connection "35.235.115.105" "Extra US-3"
echo -e "\n${YELLOW}[2/3] Testing Internal App Connectivity...${NC}"
if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$APP_HOST/$APP_PORT" 2>/dev/null; then
echo -e "${GREEN}[PASS]${NC} Reached App at $APP_HOST:$APP_PORT"
else
echo -e "${RED}[FAIL]${NC} Cannot reach $APP_HOST on port $APP_PORT"
fi
echo -e "\n${YELLOW}-------------------------------------------------------"
echo -e "SCREENSHOT THIS RESULT AND SEND TO SECHPOINT SUPPORT"
echo -e "-------------------------------------------------------${NC}"