113f6
![]() |
|
|
|
|
|||||||
| Firewalls IPFW, PF, IPF (but not limited) related discussion |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi
Background: I have four machines (one desktop, three laptops) on a home LAN network. The desktop and one of the laptops (FreeBSD 9) are patched in to my home router via ethernet. The remaining laptops connect to the internet wirelessly. The laptop with FreeBSD 9 installed is acting as a public webserver using port forwarding and NAT. Hence I can access my webserver both locally and via the public internet. On my FreeBSD 9 laptop machine and in file: /etc/rc.conf Code:
ifconfig_re0="inet 192.168.0.5 netmask 255.255.255.0" default_router="192.168.0.1" I'm experimenting with firewalls since my webserver is now publicly accessible from the internet. My first attempt with PF failed. From: http://www.freebsd.org/doc/en_US.ISO...walls-ipf.html Quote:
I thought this sounded a little more realistic: Quote:
http://home.nuug.no/~peter/pf/en/lon...l.html#PREFACE my /etc/pf.conf would look like: Code:
block all
tcp_services = "{ ssh, smtp, domain, www, pop3, auth, pop3s }"
udp_services = "{ domain }"
pass out proto tcp to port $tcp_services
pass proto udp to port $udp_services
I will have a second attempt of course, but could use a little advice on a simple ruleset (easiest to implement for a novice eg. PF or IPF) for a single machine home webserver connected to a router with port forwarding and public internet access. Thanks in advance. Last edited by DutchDaemon; April 15th, 2012 at 02:25. |
|
#2
|
|||
|
|||
|
OK
looking at some of the posts on this forum. I've decided to plump for PF. I've # cp /usr/share/examples/pf/pf.conf /etc/pf.confMy pf.conf file now looks like: Code:
#ext_if="ext0"
#int_if="int0"
#table <spamd-white> persist
#set skip on lo
#scrub in
#nat-anchor "ftp-proxy/*"
#rdr-anchor "ftp-proxy/*"
#nat on $ext_if from !($ext_if) -> ($ext_if:0)
#rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
#no rdr on $ext_if proto tcp from <spamd-white> to any port smtp
#rdr pass on $ext_if proto tcp from any to any port smtp \
# -> 127.0.0.1 port spamd
#anchor "ftp-proxy/*"
#block in
#pass out
#pass quick on $int_if no state
#antispoof quick for { lo $int_if}
#pass in on $ext_if proto tcp to {$ext_if} port ssh
#pass in log on $ext_if proto tcp to {$ext_if} port smtp
#pass out log on $ext_if proto tcp from {$ext_if} to port smtp
#pass in on $ext_if inet proto icmp from any to {$ext_if} icmp-type { unreach, redir, timex }
i.e. Code:
#ext_if="re0" #int_if="re0" Last edited by DutchDaemon; April 15th, 2012 at 02:26. |
|
#3
|
|||
|
|||
|
I'll keep reading with http://www.openbsd.org/faq/pf/filter.html
So far I have a basic ruleset: Code:
# Pass traffic in on dc0 from the local network, 192.168.0.0/24, # to the OpenBSD machine's IP address 192.168.0.1. Also, pass the # return traffic out on dc0. pass in on dc0 from 192.168.0.0/24 to 192.168.0.1 pass out on dc0 from 192.168.0.1 to 192.168.0.0/24 # Pass TCP traffic in on fxp0 to the web server running on the # OpenBSD machine. The interface name, fxp0, is used as the # destination address so that packets will only match this rule if # they're destined for the OpenBSD machine. pass in on fxp0 proto tcp from any to fxp0 port www |
|
#4
|
|||
|
|||
|
Quote:
A small description of the topology of your network will be helpful... Regards. |
|
#5
|
||||
|
||||
|
A really simple ruleset to protect one host and allow ssh and web.
Code:
set skip on lo0 block all # We allow everything to go out pass out from any to any keep state # incoming rules # ssh pass in proto tcp from any to any port 22 keep state # web pass in proto tcp from any to any port 80 keep state
__________________
Senior UNIX Engineer at Unix Support Nederland Experience is something you don't get until just after you need it. |
| The Following User Says Thank You to SirDice For This Useful Post: | ||
c00kie (April 16th, 2012) | ||
|
#6
|
|||
|
|||
|
Quote:
It's a very simple home network. I've ommitted the other computers on the LAN for brevity. The FreeBSD box is on all the time and in /etc/rc.conf I've ensured the macine has a static ip address with the following: Code:
ifconfig_re0="inet 192.168.0.5 netmask 255.255.255.0" Code:
ifconfig_re0="DHCP" Last edited by DutchDaemon; April 16th, 2012 at 15:29. |
|
#7
|
|||
|
|||
|
Quote:
|
![]() |
| Tags |
| firewall, ip address, lan, router, webserver |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Home server on FreeBSD | pkubaj | System Hardware | 12 | February 15th, 2012 09:58 |
| [Solved] Not able to access home page (www.freebsd.org) | Rax | General | 8 | March 6th, 2011 18:49 |
| WebServer With FreeBSD ... Exist a guide? | rokpa92 | Web & Network Services | 14 | November 25th, 2010 12:56 |
| Folding@home SMP2 in FreeBSD 32 bit | Ralph_Ellis | Howtos & FAQs (Moderated) | 7 | September 24th, 2010 06:25 |
| I don't want to configure my own firewall. I want a good firewall.What can I do? | drp | Firewalls | 11 | July 26th, 2010 21:07 |