Files
HotSpot/mikrotik/setup-hotspot.rsc
T
jfeng 83fba15354 feat: portal INCTG, README completo e walled garden do hotspot
- Portal de pagamento redesenhado com identidade INCTG (Manrope/Inter, grafite/azul eletrico)
- Logo INCTG servido pelo backend
- Walled garden para fontes do portal (Google Fonts) no setup-hotspot.rsc
- README passo a passo: Mercado Pago, ZimaOS, MikroTik, producao, CI e troubleshooting
- Protege chaves SSH locais no .gitignore
2026-10-21 14:13:35 -03:00

69 lines
3.9 KiB
Plaintext

# ============================================================
# pix-hotspot - Setup MikroTik hAP lite
# WiFi de convidados isolado + Hotspot + perfis PIX
# Importe via: /import file-name=setup-hotspot.rsc
# (ou cole linha a linha no Terminal do Winbox)
# ============================================================
# ===== EDITAR ABAIXO =====
:local guestSubnet "10.10.10.0/24"
:local guestIP "10.10.10.1"
:local backendIP "192.168.3.100"
:local wanInterface "ether1"
:local guestInterface "ether4"
# ===== 1. REDE DOS CONVIDADOS (isolada) =====
/interface bridge add name=bridge-guest comment="REDE CONVIDADOS"
/ip address add address=($guestIP . "/24") interface=bridge-guest
# ether4 = porta fisica dos convidados (opcional - cabo para switch guest)
/interface bridge port add bridge=bridge-guest interface=$guestInterface comment="porta convidados"
# WiFi virtual para convidados (SSID separado)
/interface wireless add master-interface=wlan1 name=wlan-guest ssid="Convidados-Pix" mode=ap disabled=no comment="WiFi convidados"
/interface bridge port add bridge=bridge-guest interface=wlan-guest comment="wifi convidados"
# ===== 2. POOL + HOTSPOT =====
/ip pool add name=guest-pool ranges=($guestIP . "10-")($guestIP . "50")
/ip pool set [find name=guest-pool] ranges=("10.10.10.10-10.10.10.50")
/ip hotspot profile add name=hs-guest hotspot-interface=bridge-guest html-directory=hotspot login-by=http-chap dns-name="" comment="perfil hotspot convidados"
/ip hotspot add name=guest-hotspot interface=bridge-guest address-pool=guest-pool profile=hs-guest lease-time=1h disabled=no
# ===== 3. PERFIS DE PLANO (nomes devem bater com o backend) =====
/ip hotspot user profile remove [find name~"pix-"]
/ip hotspot user profile add name=pix-1h rate-limit=5M/1M shared-users=1 comment="plano 1h"
/ip hotspot user profile add name=pix-24h rate-limit=8M/2M shared-users=1 comment="plano 24h"
/ip hotspot user profile add name=pix-7d rate-limit=10M/3M shared-users=1 comment="plano 7d"
# ===== 4. DNS/Internet dos convidados =====
/ip firewall nat add chain=srcnat out-interface=$wanInterface src-address=$guestSubnet action=masquerade comment="NAT convidados"
# ===== 5. FIREWALL - ISOLAMENTO =====
# Convidado pode ir: internet + backend (portal de pagamento) + DNS do hotspot
# Convidado NAO pode: rede interna192.168.3.0/24 (seus PCs, MikroTik, etc)
/ip firewall filter
# permite convidado -> backend:3000 (pagamento PIX)
add chain=forward src-address=$guestSubnet dst-address=$backendIP protocol=tcp dst-port=3000 action=accept place-before=0 comment="guest->backend PIX"
# permite respostas estabelecidas
add chain=forward connection-state=established,related action=accept place-before=0 comment="estabelecidos"
# BLOQUEIA convidado -> qualquer rede interna (exceto o backend ja aceito acima)
add chain=forward src-address=$guestSubnet dst-address=192.168.0.0/16 action=drop comment="guest nao acessa rede interna"
add chain=forward src-address=$guestSubnet dst-address=10.0.0.0/8 action=drop comment="guest nao acessa10.x"
add chain=forward src-address=$guestSubnet dst-address=172.16.0.0/12 action=drop comment="guest nao acessa172.x"
# gerenciao MikroTik pelo lado guest = bloqueado
add chain=input src-address=$guestSubnet dst-address=$guestIP action=drop comment="guest nao gerencia o MikroTik"
add chain=input src-address=$guestSubnet action=drop comment="guest so usa hotspot"
# ===== 6. WALLED GARDEN (fontes do portal antes do login) =====
/ip hotspot walled-garden remove [find dst-host="fonts.googleapis.com"]
/ip hotspot walled-garden add dst-host=fonts.googleapis.com action=accept comment="fontes portal"
/ip hotspot walled-garden remove [find dst-host="fonts.gstatic.com"]
/ip hotspot walled-garden add dst-host=fonts.gstatic.com action=accept comment="fontes portal"
# ===== 7. LIMPA HOTSPOT ANTIGO (se houver) =====
/ip hotspot user remove [find where comment~"pix"]
:log info "pix-hotspot: setup de rede convidados concluido"