I have shorewall configured. Took a bit of learning, as I am doing things with it I have not done before. Tom (shorewall developer) was a great help.
Assumption: One interface: eth0
I am running shorewall 4.2.4-5, 4.2.6-3 is available from
http://www.invoca.ch/pub/packages/shorewall/4.2/
You want shorewall and shorewall-perl. I have not worked on shorewall6 yet. I would recommend that the current shorewall be maintained in the Amahi repo and not make the user figure out how to get the current stable version...
After installing, there is potential need to edit /etc/shorewall/shorewall.conf (all but macros are in /etc/shorewall). For IPv6 support, you need to change DISABLE_IPV6 to No. Otherwise, you can leave this unchanged.
Next you need your interfaces file (I tried to align things up for nice visuals, but it is not working):
Code: Select all
#ZONE INTERFACE BROADCAST OPTIONS
- eth0 detect dhcp
Then the zones file:
Code: Select all
#ZONE TYPE OPTIONS IN OUT
# OPTIONS OPTIONS
fw firewall
Pub IPv4
Int:Pub IPv4
Loc:Int IPv4
These zones will make more sense once you see the hosts file:
Code: Select all
#ZONE HOST(S) OPTIONS
Loc eth0:192.168.1.0/24 routeback
Int eth0:192.168.0.0/16
Pub eth0:0.0.0.0/0
Loc, Int, and Pub are 'nested zones' I include Int to allow for those that have other networks. Note that the line Loc is the ONLY line in all of this that is specific to an install.
Now you need the policy file:
Code: Select all
#SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:
# LEVEL BURST MASK
all fw DROP info
fw all DROP info
all all DROP
This last policy is a catch all. As your Amahi box should not be doing routing.
We are almost ready for rules. First I will show you the 3 macros I use. Macros are in /usr/share/shorewall:
macro.SMB:
Code: Select all
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - udp 135,445
PARAM - - udp 137:139
PARAM - - udp 1024: 137
PARAM - - tcp 135,139,445
macro.VNC
Code: Select all
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 5900:5909
macro.Web
Code: Select all
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
# PORT(S) PORT(S) LIMIT GROUP
PARAM - - tcp 80 # HTTP (plaintext)
PARAM - - tcp 443 # HTTPS (over SSL)
Now for the actual rules:
Code: Select all
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME
# PORT PORT(S) DEST LIMIT GROUP
#SECTION ESTABLISHED
#SECTION RELATED
SECTION NEW
ACCEPT all all icmp
ACCEPT Loc fw udp domain
ACCEPT Int fw tcp rpcbind,ntp,http,ipp,rpasswd,nfs,daap
ACCEPT Int fw tcp ssh - - 3/min
ACCEPT Int fw tcp 10000 # webmin
Web(ACCEPT) Int fw
SMB(ACCEPT) Int fw
VNC(ACCEPT) Int fw
#ACCEPT Pub fw
#ACCEPT fw Loc
#ACCEPT fw Int
SMB(ACCEPT) fw Int
ACCEPT fw Pub udp domain
ACCEPT fw Pub tcp ntp
Web(ACCEPT) fw Pub
I some commented rules groupings for place holders as we figure out what else is needed. I have not tested everything, but SMB seems to work! I am accessing shares from my Centos laptop from a subnet in zone Int by putting in Nautlius SMB://192.168.1.myamahi Well you get the idea!
PLEASE look these rules over; have I missed any protocol?
Having Amahi as a gateway with two interfaces will take a lot more....