This commit is contained in:
2026-01-17 17:58:31 +00:00
parent bf60412640
commit a2f0b40fa8

View File

@@ -16,13 +16,11 @@ VPN_EMAIL="${VPN_EMAIL:-}"
VPN_PASSWORD="${VPN_PASSWORD:-}" VPN_PASSWORD="${VPN_PASSWORD:-}"
VPN_TOTP_SECRET="${VPN_TOTP_SECRET:-}" VPN_TOTP_SECRET="${VPN_TOTP_SECRET:-}"
VPN_HOST="${VPN_HOST:-}" VPN_HOST="${VPN_HOST:-}"
TARGET_IP="${TARGET_IP:-10.3.1.0}" TARGET_IP="${TARGET_IP:-10.3.1.201}"
TARGET_SUBNET="$(echo "$TARGET_IP" | cut -d. -f1-3).0/24" TARGET_SUBNET="$(echo "$TARGET_IP" | cut -d. -f1-3).0/24"
VPN_INTERFACE="${VPN_INTERFACE:-tun0}" VPN_INTERFACE="${VPN_INTERFACE:-tun0}"
CONTAINER_NETWORK="172.30.0.0/24" CONTAINER_NETWORK="172.30.0.0/24"
# Hardcoded test host (IBM i server)
IBMI_HOST="10.3.1.201"
# Log directory # Log directory
LOG_DIR="/var/log/openconnect-vpn" LOG_DIR="/var/log/openconnect-vpn"
@@ -181,15 +179,15 @@ get_totp() {
oathtool --totp -b "$VPN_TOTP_SECRET" oathtool --totp -b "$VPN_TOTP_SECRET"
} }
# Test connection to IBMI_HOST # Test connection to TARGET_IP
test_connection() { test_connection() {
if [[ -z "$IBMI_HOST" ]]; then if [[ -z "$TARGET_IP" ]]; then
log WARN "IBMI_HOST not set" log WARN "TARGET_IP not set"
return 1 return 1
fi fi
log INFO "Testing connection to $IBMI_HOST..." log INFO "Testing connection to $TARGET_IP..."
if ping -c 3 -W 3 "$IBMI_HOST" &>/dev/null; then if ping -c 3 -W 3 "$TARGET_IP" &>/dev/null; then
log INFO "Connection test: ${GREEN}SUCCESS${NC}" log INFO "Connection test: ${GREEN}SUCCESS${NC}"
return 0 return 0
else else
@@ -547,7 +545,7 @@ main_menu() {
echo -e " ${CYAN}2${NC} - Disconnect VPN" echo -e " ${CYAN}2${NC} - Disconnect VPN"
echo -e " ${CYAN}3${NC} - Show VPN status" echo -e " ${CYAN}3${NC} - Show VPN status"
echo -e " ${CYAN}4${NC} - Setup IP forwarding only" echo -e " ${CYAN}4${NC} - Setup IP forwarding only"
echo -e " ${CYAN}5${NC} - Test connection to $IBMI_HOST" echo -e " ${CYAN}5${NC} - Test connection to $TARGET_IP"
echo -e " ${CYAN}6${NC} - Show network status" echo -e " ${CYAN}6${NC} - Show network status"
echo -e " ${CYAN}7${NC} - Show routing table" echo -e " ${CYAN}7${NC} - Show routing table"
echo -e " ${CYAN}8${NC} - Show live TOTP" echo -e " ${CYAN}8${NC} - Show live TOTP"