Build a location-aware firewall for your wireless users using linux, netfilter, ipset and (cisco) wireless lan controllers.
Very much a WIP and not much documentation yet.
Use-case: only allowing specific classrooms (containing AP's) to specific servers (e.g. because of licensing issues).
Locafw connects to your wireless lan controllers, asks information about accesspoints and client.
In the locafw config file you specify which destination addresses can be accessed by the clients on the specified accesspoints.
Using this information locafw creates an [ipset](http://ipset.netfilter.org/) set, which you can use on your firewall.
Go 1.6+ is required. Make sure you have [Go](https://golang.org/doc/install) properly installed, including setting up your [GOPATH] (https://golang.org/doc/code.html#GOPATH)
go get github.com/42wim/locafw
You should now have locafw binary in the bin directory:
$ ls bin/
1) Copy the locafw.yaml.sample to locafw.yaml in the same directory as the locafw binary.
2) Edit locafw.yaml with the settings for your environment. See below for more config information.
3) Now you can run locafw
* http://localhost:8888/ip - returns a JSON array of all AP's with clients and foreach AP and array of IP addresses
* http://localhost:8888/ipset - returns a generated ipset set, can be used with ```ipset -! restore```
* http://localhost:8888/realod - reloads the configuration file
locafw looks for locafw.yaml in current directory. (use -conf to specify another file)
Look at locafw.yaml.sample for an example
listen: ":8888" #ip and port to listen on
#list of your cisco WLC's, need public commmunity and snmp v2c
#ipset configuration, name of the set and TTL of the entries
#ACLs, name is the name of your AP's (can be a regexp)
#dstip are the destination addresses that are allowed to be accessed from the specified AP
- name: lwap-buildingA-1
- name: "lwap-buildingB-*"
```iptables -I FORWARD -m set --match-set locafw src,dst -j ACCEPT```
```ipset create locafw hash:net,net family inet hashsize 2048 maxelem 65536 timeout 1800```