0

I have created a captive portal with iptables

I use what many people seem to use : Users can request DNS, packet marked as 99. 99 means no internet else the user does have access.

When a user visits a page when visiting for example stack overflow. The user gets the disclaimer. He/she clicks on okay. What happened is that the server executes the following rules :

`sudo /sbin/iptables -t mangle -I captivePortal 1 -m mac --mac-source {$mac} -j RETURN`;
    `sudo /sbin/iptables -t mangle -I captivePortal 1 -s {$_SERVER['REMOTE_ADDR']} -j RETURN`;

What i have tried:

Used sinatra stand alone with thin. Render template with erb. When the user reloads after authenticating they get the disclaimer when visiting the initial domain. When the visit another they dont get the disclaimer page.

Set up apache2 with php, rewritten all in php. added meta tags to prevent caching in the browser but same result. original domain redirects to disclaimer always but other sites are okay.

What i want to achieve

Users need to click accept on disclaimer before they can use WIFI.

Reloading apache2 or restarting Sinatra does fix this problem, but that is not a proper solution on a low end alix board.

1 Answer 1

0

Found out that after inserting the mac address into iptables i needed to use conntrack.

/usr/sbin/conntrack -L \
|grep $1 \
|grep ESTAB \
|grep 'dport=80' \
|awk \
    "{ system(\"conntrack -D --orig-src $1 --orig-dst \" \
        substr(\$6,5) \" -p tcp --orig-port-src \" substr(\$7,7) \" \
        --orig-port-dst 80\"); }"

http://aryo.info/labs/captive-portal-using-php-and-iptables.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .