HAProxy: perimeter TCP+SNI for kalinamall.ru (Exchange, RDS, 1C, KSMG, RDP, SSH)

This commit is contained in:
PTah
2026-04-11 12:14:18 +10:00
commit 6cd45fbc42
5 changed files with 178 additions and 0 deletions
+103
View File
@@ -0,0 +1,103 @@
# HAProxy — периметровый reverse-proxy для kalinamall.ru
# Режим: TCP + SNI на 443 (TLS end-to-end, сертификаты GlobalSign wildcard на бэкендах)
#
# Проверка синтаксиса: haproxy -c -f haproxy.cfg
# Установка: скопируйте в /etc/haproxy/haproxy.cfg и подставьте пути к trusted/*.lst
global
log stdout format raw local0
maxconn 50000
# Раскомментируйте на Linux с syslog:
# log /dev/log local0
defaults
log global
mode tcp
option dontlognull
option tcplog
timeout connect 10s
timeout client 3600s
timeout server 3600s
# Для ActiveSync / больших вложений Exchange при необходимости увеличьте client/server
# -----------------------------------------------------------------------------
# HTTPS (443): маршрутизация по SNI → внутренние серверы с wildcard на 443
# Клиенты: ext / rds / erp.kalinamall.ru
# Бэкенды: Exchange, RDS, 1С (см. README)
# -----------------------------------------------------------------------------
frontend fe_https_sni
bind *:443
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend be_exchange if { req_ssl_sni -i ext.kalinamall.ru }
use_backend be_rds if { req_ssl_sni -i rds.kalinamall.ru }
use_backend be_erp if { req_ssl_sni -i erp.kalinamall.ru }
# Неизвестный SNI или отсутствие SNI — разрыв
tcp-request connection reject
backend be_exchange
# fifth.kalinamall.ru (192.168.160.42) — внешнее имя HTTPS: ext.kalinamall.ru
server exch 192.168.160.42:443 check ssl verify none
backend be_rds
# k6a-dc3.b26.kalinamall.ru (192.168.160.40)
server rds 192.168.160.40:443 check ssl verify none
backend be_erp
# hp-serv.b26.kalinamall.ru (192.168.160.150)
server erp 192.168.160.150:443 check ssl verify none
# -----------------------------------------------------------------------------
# SMTP (25): почтовый шлюз KSMG
# Внешнее имя: ksmg.kalinamall.ru
# -----------------------------------------------------------------------------
frontend fe_smtp
bind *:25
default_backend be_ksmg_smtp
backend be_ksmg_smtp
server ksmg 192.168.160.57:25 check
# -----------------------------------------------------------------------------
# RDP (3389): itis.b26.kalinamall.ru → 192.168.160.198
# Доступ только с адресов из trusted/rdp.lst (одна сеть или IP на строку)
# -----------------------------------------------------------------------------
frontend fe_rdp
bind *:3389
acl trusted_rdp src -f /etc/haproxy/trusted/rdp.lst
tcp-request connection reject if !trusted_rdp
default_backend be_rdp
backend be_rdp
server itis 192.168.160.198:3389
# -----------------------------------------------------------------------------
# SSH (22): Ubuntu → 192.168.160.85
# Доступ только с адресов из trusted/ssh.lst
# -----------------------------------------------------------------------------
frontend fe_ssh
bind *:22
acl trusted_ssh src -f /etc/haproxy/trusted/ssh.lst
tcp-request connection reject if !trusted_ssh
default_backend be_ssh
backend be_ssh
server ubuntu 192.168.160.85:22
# -----------------------------------------------------------------------------
# Опционально: статистика (раскомментируйте и задайте пароль)
# -----------------------------------------------------------------------------
# frontend fe_stats
# bind *:8404
# mode http
# stats enable
# stats uri /stats
# stats refresh 10s
# stats auth admin:CHANGEME