github.com/vitalvas/captive_redirect


Properties

Last built 10 months ago using go version go1.6.2 linux/amd64 and 102 seconds of time

Downloads
Filename
File Size
 
captive_redirect_master_darwin-386.zip
2.1MiB
captive_redirect_master_darwin-amd64.zip
2.3MiB
captive_redirect_master_linux-386.zip
2.1MiB
captive_redirect_master_linux-amd64.zip
2.3MiB
captive_redirect_master_linux-arm.zip
2.1MiB
captive_redirect_master_windows-386.zip
2.1MiB
captive_redirect_master_windows-amd64.zip
2.3MiB
Project-Readme for this version

Captive redirect

ENV Config

  • CAPTIVE_5555 - Where 5555 - port. Value - redirect path.
  • CAPTIVE_NOORIGIN - see code :)

Usage

Build and run

GOOS=linux GOARCH=amd64 go build -o /usr/local/sbin/captive_redirect main.go

Add to rc.local:

CAPTIVE_5555=http://my.example.com/no_money.cgi CAPTIVE_5556=http://acs.example.com/register.cgi /usr/local/sbin/captive_redirect &

IPTables

iptables -t nat -A PREROUTING -m set --match-set no_money src -p tcp --dport 80 -j REDIRECT --to-port 5555
iptables -t nat -A PREROUTING -m set --match-set guest src -p tcp --dport 80 -j REDIRECT --to-port 5556