This commit is contained in:
2026-01-17 16:33:22 +00:00
parent 1bd5a21a94
commit 84b1eb3f5d

View File

@@ -10,7 +10,7 @@ VPN_TOTP_SECRET="${VPN_TOTP_SECRET:-}"
VPN_HOST="${VPN_HOST:-}"
TARGET_IP="${TARGET_IP:-}"
VPN_INTERFACE="${VPN_INTERFACE:-tun0}"
IBMI_HOST="10.3.1.201"
# Log directory
LOG_DIR="/var/log/openconnect-vpn"
@@ -164,6 +164,7 @@ show_help() {
echo " VPN_HOST VPN server hostname"
echo " TARGET_IP Target IP for connectivity test"
echo " VPN_INTERFACE TUN interface name (default: tun0)"
echo " IBM_HOST IBM i Host"
}
get_vpn_interface() {
@@ -402,9 +403,9 @@ connect_vpn() {
setup_forwarding
# Test connection if TARGET_IP is set
if [[ -n "$TARGET_IP" ]]; then
log INFO "Testing connection to $TARGET_IP..."
if ping -c 2 -W 3 "$TARGET_IP" &>/dev/null; then
if [[ -n "$IBMI_HOST" ]]; then
log INFO "Testing connection to $IBMI_HOST..."
if ping -c 2 -W 3 "$IBMI_HOST" &>/dev/null; then
log INFO "Connection test: ${GREEN}SUCCESS${NC}"
else
log WARN "Connection test: ${RED}FAILED${NC}"
@@ -513,11 +514,11 @@ while true; do
2) disconnect_vpn ;;
3) check_vpn_status ;;
4) setup_forwarding ;;
5) if [[ -n "$TARGET_IP" ]]; then
log INFO "Testing connection to $TARGET_IP..."
ping -c 3 "$TARGET_IP" && log INFO "Connection test: ${GREEN}SUCCESS${NC}" || log ERROR "Connection test: ${RED}FAILED${NC}"
5) if [[ -n "$IBMI_HOST" ]]; then
log INFO "Testing connection to $IBMI_HOST..."
ping -c 3 "$IBMI_HOST" && log INFO "Connection test: ${GREEN}SUCCESS${NC}" || log ERROR "Connection test: ${RED}FAILED${NC}"
else
log WARN "TARGET_IP not set"
log WARN "IBMI_HOST not set"
fi ;;
6) show_network_status ;;
7) show_routes ;;