Reverse Proxy ve Ağ Kurulum Kılavuzu
AiPBX'i mevcut bir HTTP/HTTPS ters proxy (Nginx, Caddy, Traefik, HAProxy veya Apache) arkasında güvenle çalıştırmak için yapılandırın. Gerçek istemci IP adreslerini almak için güvenilen proxy IP'lerini yönetin, hazır yapılandırmaları kopyalayın ve gerekli ağ portları ile güvenlik duvarı kurallarını inceleyin.
- Proxy ile AiPBX arasındaki HTTPS yalnızca HAProxy ile çalışır. 443 numaralı bağlantı noktası, ALPN aracılığıyla HTTPS'i TURNS'ten ayırır; Nginx, Apache, Caddy ve Traefik ise softphone'ların ihtiyaç duyduğu bağlantılarda bunu iletmez. Bunları kullanırken TLS'i proxy üzerinde sonlandırın ve AiPBX'e ulaşmak için özel bir ağ kullanın.
10.218.49.1
Doğrudan / Güvenilmeyen
—
—
10.218.49.1
WebRTC WebSocket (/ws) yükseltme başlıklarını ve istemci IP iletimini içeren üretime hazır yapılandırma örnekleri.
# ==============================================================================
# /etc/nginx/sites-available/aipbx.conf
# AiPBX Reverse Proxy Configuration (Nginx)
# External FQDN: demo.aipbx.local
# Backend Target: http://10.218.49.190:80
#
# IMPORTANT: VoIP protocols (SIP 5060/5061 and RTP 10000-20000 UDP) MUST bypass
# this HTTP proxy and connect directly to the server host.
# ==============================================================================
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream aipbx_web_backend {
server 10.218.49.190:80;
keepalive 32;
}
# Redirect HTTP to HTTPS
server {
listen 80;
listen [::]:80;
server_name demo.aipbx.local;
location /.well-known/acme-challenge/ {
root /var/www/html;
}
location / {
return 301 https://$host$request_uri;
}
}
# Main HTTPS Server
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name demo.aipbx.local;
# TLS Certificates (manage via certbot or centralized PKI)
ssl_certificate /etc/letsencrypt/live/demo.aipbx.local/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/demo.aipbx.local/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
client_max_body_size 64M;
# 1. WebRTC WebSocket Signaling (Softphones)
location /ws {
proxy_pass http://aipbx_web_backend/ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Keep alive for long WebRTC sessions
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
# 2. Main Portal, Chat WebSocket & Desk Phone Provisioning
location / {
proxy_pass http://aipbx_web_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 60s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
proxy_buffering off;
}
}
AiPBX tarafından kullanılan tüm portların, protokollerin, erişim kapsamlarının ve proxy baypas durumunun kapsamlı tablosu.
| Port Aralığı | Protokol | Servis / Amaç | Erişim Kapsamı | Proxy Baypas | Açıklama ve Notlar |
|---|---|---|---|---|---|
| 5060 | UDP / TCP | SIP Signaling | Public / LAN | Doğrudan (Baypas) | Standard SIP phone signaling, PBX trunks, and softphone registrations. |
| 5061 | TCP | SIP-TLS Signaling | Public / LAN | Doğrudan (Baypas) | Secure encrypted SIP signaling via TLS. |
| 10000-20000 | UDP | RTP / SRTP Media | Public / LAN | Doğrudan (Baypas) | Real-time Transport Protocol streams for two-way audio and video calls. |
| 80 | TCP | HTTP Web Portal / ACME | Public / LAN | Proxy Üzerinden (HTTP/WS) | Web administration portal, phone auto-provisioning, and Let's Encrypt HTTP-01 challenge. |
| 443 | TCP | HTTPS Web Portal | Public / LAN | Proxy Üzerinden (HTTP/WS) | Encrypted Web portal, REST API endpoints, and WebSocket proxying. |
| 8089 | TCP | Asterisk WSS (WebRTC) | Localhost (127.0.0.1) | Proxy Üzerinden (HTTP/WS) | Not used by clients and never opened: browsers and the mobile apps reach WebRTC signaling over 443 at /ws. |
| 8088 | TCP | Asterisk HTTP / WS | Localhost (127.0.0.1) | Proxy Üzerinden (HTTP/WS) | Behind /ws of the portal. A reverse proxy connects to the portal, not to this port. |
| 3478 / 5349 | UDP / TCP | STUN / TURNS (coturn) | Public | Doğrudan (Baypas) | NAT traversal relay for WebRTC media behind symmetric NAT or corporate firewalls. |
| 69 | UDP | TFTP Provisioning | LAN only | Doğrudan (Baypas) | Legacy desk phone configuration and firmware downloads. |
| 9061 | UDP | HEP / Homer SIP Capture | Internal / Monitoring | Doğrudan (Baypas) | Encapsulated SIP packet capture streaming for Homer VoIP monitoring. |
| 5038 | TCP | AMI (Asterisk Manager) | Localhost only (127.0.0.1) | Doğrudan (Baypas) | Internal Asterisk management interface. NEVER expose to the internet. |
| 3306 | TCP | MariaDB Database | Localhost only (127.0.0.1) | Doğrudan (Baypas) | Core PBX database. Bound to 127.0.0.1 only. |
#!/usr/bin/env bash # AiPBX UFW Firewall Rules Setup # Run with root privileges set -euo pipefail # 1. Reset or set baseline defaults ufw default deny incoming ufw default allow outgoing # 2. Management & Web ufw allow 22/tcp comment 'SSH Access' ufw allow 80/tcp comment 'AiPBX Web Portal / HTTP-01' ufw allow 443/tcp comment 'AiPBX Web Portal / HTTPS' # 3. VoIP Signaling (MUST route directly to server) ufw allow 5060/udp comment 'SIP Signaling UDP' ufw allow 5060/tcp comment 'SIP Signaling TCP' ufw allow 5061/tcp comment 'SIP-TLS Signaling TCP' # 4. RTP Audio / Video Media Range (Direct UDP) ufw allow 10000:20000/udp comment 'AiPBX RTP Media Streams' # 5. WebRTC STUN / TURNS Relay ufw allow 3478/udp comment 'STUN / TURN UDP' ufw allow 3478/tcp comment 'STUN / TURN TCP' ufw allow 5349/tcp comment 'TURNS TLS' # 6. Internal Desk Phone Provisioning (Restrict to local subnet if desired) # ufw allow from 192.168.1.0/24 to any port 69 proto udp comment 'TFTP Phone Provisioning' # Enable firewall ufw --force enable ufw status verbose