Como criar o portal cativo de controle de acesso
Informações preliminares
- Essas instruções são para o roteador que está conectado à internet, fornecendo para o resto da rede. Não foi testado com mais de um gateway
- Esse sistema de validação e portal cativo não funciona quando não há acesso internet, ou quando o acesso cai. Para isso, tem uma gambiarra descrita no fim da página
Índice
Para versão DaybootRely da LibreMesh (1706)
- Faça o login na linha de comando via SSH e atualize os repositórios do roteador que receberá o portal captivo:
opkg update
- Vamos agora instalar o nodogsplash. Esté um pacote com as mudanças necessárias para instalar o captivo na versão 17.
opkg install http://nuvem.tk/files/nodogsplash_0.9.2-1_mips_24kc.ipk
- Agora vamos editar o arquivo de configuração
vi /etc/config/nodogsplash
Neste arquivo, altere o arquivo nas seguintes linhas, de modo que se registre os seguintes parâmetros:
Altere o valor do "option enable" de 0 para 1
option enable 1
Descomentar (apagar o jogo da velha do início da linha) a linha a seguir:
option config '/etc/nodogsplash/nodogsplash.conf'
- Agora salve o arquivo e saia do editor de texto.
- Crie o arquivo /etc/nodogsplash/nodogsplash.conf pelo listado abaixo (fazendo as devidas modificações nos IP e página de redirecionamento). O IP a ser usado é o do menu network -> interfaces, interface LAN (IPV4) (sem o /16). O range são os dois primeiros números, seguidos de .0.0/16. (ex se o ip é 10.7.255.50, o range é 10.7.0.0/16.
GatewayInterface br-lan GatewayInterfaceExtra bmx+ GatewayInterfaceExtra2 anygw
FirewallRuleSet authenticated-users {
FirewallRule allow to 0.0.0.0/0
}
FirewallRuleSet users-to-router {
# Nodogsplash automatically allows tcp to GatewayPort,
# at GatewayAddress, to serve the splash page.
# However you may want to open up other ports, e.g.
# 53 for DNS and 67 for DHCP if the router itself is
# providing these services.
FirewallRule allow udp port 53
FirewallRule allow tcp port 53
FirewallRule allow udp port 67
# You may want to allow ssh, http, and https to the router
# for administration from the GatewayInterface. If not,
# comment these out.
FirewallRule allow tcp port 22
FirewallRule allow tcp port 80
FirewallRule allow tcp port 443
}
end FirewallRuleSet users-to-router
FirewallRuleSet preauthenticated-users {
# For preauthenticated users to resolve IP addresses in their initial
# request not using the router itself as a DNS server,
# you probably want to allow port 53 udp and tcp for DNS.
FirewallRule allow tcp port 53
FirewallRule allow udp port 53
# For splash page content not hosted on the router, you
# will want to allow port 80 tcp to the remote host here.
# Doing so circumvents the usual capture and redirect of
# any port 80 request to this remote host.
# Note that the remote host's numerical IP address must be known
# and used here.
#change the IP for the address of the gateway router
FirewallRule allow tcp port 80 to 10.7.122.55
}
end FirewallRuleSet preauthenticated-users
EmptyRuleSetPolicy preauthenticated-users passthrough
EmptyRuleSetPolicy users-to-router passthrough
change the IP for the address of the gateway router
GatewayName 10.7.122.55:80
GatewayPort 80
MaxClients 500
ClientIdleTimeout 720
ClientForceTimeout 14400
change the range for the ip range of your mesh network
GatewayIPRange 10.7.0.0/16
BinVoucher "vale.sh"
ForceVoucher yes
EnablePreAuth yes
Referências