====== Сервис Captive Portal ======
===== pfSense =====
* [[Администрирование pfSense]]
* [[https://opnsense.org/]]
* [[https://www.pfsense.org/]]
* [[https://val.bmstu.ru/unix/img/My%20Documents/pfSense-CE-2.7.2.ova]]
* [[https://ftp.fagskolen.gjovik.no/pub/pfSense/]]
* [[https://simplificandoredes.com/en/install-pfsense-on-virtualbox/]]
==== Базовая настройка ====
* По умолчанию, em0 WAN, em1 LAN
Username: admin
Password: pfsense
Default IP: 192.168.1.1
Через консоль назначаем LAN IP: 192.168.X.1/24, dhpc потом в визарде
* Подключаемся через Web и отвечаем на вопросы Визарда:
Hostname: gate
Domain: corpX.un
Primary DNS Server: 192.168.X.10
Override DNS: No
Timezone: Europe/Moscow
Configure WAN Interface
SelectedType: static
IP Address: 172.16.1.X
Subnet Mask: 24
Add a new gateway ...
Admin Password: Pa$$w0rd
Services/DNS Resolver/General Settings/Enable: false
==== Services/DHCP Server/LAN ====
Address Pool Range: 192.168.X.101 - 192.168.X.109
DNS Servers: 192.168.X.10
==== System/Certificates/Certificates ====
* [[Пакет OpenSSL#Создание самоподписанного сертификата]] wild
==== System/Advanced/Admin Access ====
* SSL/TLS Certificate: wild
==== System/User Manager/Authentication Servers ====
* [[Сервис FreeRADIUS]]
Descriptive name: radius server
Type: RADIUS
Hostname or IP address: server
Shared Secret: testing123
RADIUS NAS IP Attribute: LAN...
==== Services/Captive Portal ====
Interfaces: LAN
Authentication Method: Authentication backend !!! По умолчанию
Authentication Server: radius server
NAS Identifier: gate
Enable HTTPS login: yes
HTTPS server name: gate.corpX.un
SSL/TLS Certificate: wild
Services/Captive Portal/corpX/Allowed IP Addresses
192.168.X.10
==== Status/System Logs/System/General ====
* Просмотр журналов (Time - порядок сортировки или Filter по слову moved)
===== Самописный вариант =====
* Captive Portal Using PHP and iptables Firewall on Linux ([[http://aryo.info/labs/captive-portal-using-php-and-iptables.html]])
* Using iptables and PHP to create a captive portal ([[http://www.andybev.com/index.php/Using_iptables_and_PHP_to_create_a_captive_portal]])
==== Linux(Ubuntu) ====
root@gate:~# cat nat.sh
iptables -t nat --flush
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.X.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.X.1
iptables -t nat -I PREROUTING -i eth0 -s 192.168.X.10 -j ACCEPT
conntrack -F
==== FreeBSD ====
gate# cat /etc/pf.conf
rdr on em0 proto tcp from 192.168.X/24 to any port 80 -> 127.0.0.1 port 80
nat on em1 from 192.168.X/24 to any -> 172.16.1.X
==== Apache ====
# cat index.php
Address of your computer: