Captive Portal

Capture WPA handshake then:

install tooling:

apt install apache2 libapache2-mod-php
apt install dnsmasq
apt install nftables
apt install hostapd

Networking setup:

# IP Bits
ip addr add 192.168.87.1/24 dev wlan0
ip link set wlan0 up

# DNS bits
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
nft 'add chain nat PREROUTING { type nat hook prerouting priority dstnat; policy accept; }'
nft add rule ip nat PREROUTING iifname "wlan0" udp dport 53 counter redirect to :53
nft 'add chain nat postrouting { type nat hook postrouting priority 100 ; }'
nft add rule ip nat postrouting oifname "eth0" ip daddr != 10.0.0.1/24 masquerade

DNSMasQ setup (dns.conf):

and execute:

HostAPD setup:

create hostapd.conf:

and execute:

Building the portal:

create 'index.php' in /var/www/html/portal:

Last updated