#!/bin/bash # Network routing and terminal prerequisites ensure_prerequisites() { local target_ip="${VAULT_ADDR#*//}" target_ip="${target_ip%%:*}" if ! ip route get "${target_ip}" 2>/dev/null | grep -q "${VYOS_ROUTER_IP}"; then log_info "Восстанавливаем маршрут к ${NET_PREFIX} через VyOS (${VYOS_ROUTER_IP})..." sudo ip route replace "${NET_PREFIX}" via "${VYOS_ROUTER_IP}" 2>/dev/null || true fi # Регистрация Git Credential Helper (доменный и прямой IP Tier-0) local target_helper="!${REPO_ROOT}/deploy.sh git-credential" local current_helper current_helper=$(git config --global --get credential."https://${GIT_HOST}".helper 2>/dev/null || true) if [[ "${current_helper}" != "${target_helper}" ]]; then git config --global credential."https://${GIT_HOST}".helper "${target_helper}" fi local direct_helper direct_helper=$(git config --global --get credential."http://10.0.10.13:3000".helper 2>/dev/null || true) if [[ "${direct_helper}" != "${target_helper}" ]]; then git config --global credential."http://10.0.10.13:3000".helper "${target_helper}" fi # Нативная привязка IdentityFile для всех C2-хостов и LXC-контейнеров local ssh_hosts="proxmox pve0 vyos vyos_router 10.0.* dns0 vault0 git0 storage0 registry0" if [[ -f "${HOME}/.ssh/config" ]] && ! grep -q "IdentityFile ${RAM_KEY}" "${HOME}/.ssh/config"; then printf "\nHost %s\n IdentityFile %s\n IdentitiesOnly yes\n" "${ssh_hosts}" "${RAM_KEY}" >> "${HOME}/.ssh/config" fi }