Home | History | Annotate | Line # | Download | only in npf
soho_gw-npf.conf revision 1.1
      1  1.1  spz # $NetBSD: soho_gw-npf.conf,v 1.1 2012/08/21 06:54:39 spz Exp $
      2  1.1  spz #
      3  1.1  spz # SOHO border
      4  1.1  spz #
      5  1.1  spz # This is a natting border gateway/webserver/mailserver/nameserver
      6  1.1  spz #
      7  1.1  spz $ext_if = "wm0"
      8  1.1  spz $int_if = "wm1"
      9  1.1  spz 
     10  1.1  spz table <1> type hash file "/etc/npf_blacklist"
     11  1.1  spz # for NAT
     12  1.1  spz table <2> type tree dynamic
     13  1.1  spz 
     14  1.1  spz $services_tcp = { http, https, smtp, domain, 6000, 9022 }
     15  1.1  spz $services_udp = { domain, ntp, 6000 }
     16  1.1  spz $localnet = { 198.51.100.0/24 }
     17  1.1  spz 
     18  1.1  spz # NAT outgoing to the address of the external interface
     19  1.1  spz # Note: if $ext_if has multiple IP addresses (e.g. IPv6 as well),
     20  1.1  spz # then the translation address has to be specified explicitly.
     21  1.1  spz map $ext_if dynamic 198.51.100.0/24 -> $ext_if
     22  1.1  spz 
     23  1.1  spz # NAT traffic arriving on port 9022 of the external interface address
     24  1.1  spz # to host 198.51.100.2 port 22
     25  1.1  spz map $ext_if dynamic 198.51.100.2 port 22 <- $ext_if 9022
     26  1.1  spz 
     27  1.1  spz procedure "log" {
     28  1.1  spz 	log: npflog0
     29  1.1  spz }
     30  1.1  spz 
     31  1.1  spz procedure "rid" {
     32  1.1  spz 	normalise: "random-id"
     33  1.1  spz }
     34  1.1  spz 
     35  1.1  spz group (name "external", interface $ext_if) {
     36  1.1  spz 	pass stateful out final from $ext_if apply "rid"
     37  1.1  spz 
     38  1.1  spz 	block in final from <1>
     39  1.1  spz 	pass stateful in final family inet proto tcp to $ext_if port ssh \
     40  1.1  spz 		apply "log"
     41  1.1  spz 	pass stateful in final proto tcp to $ext_if port $services_tcp
     42  1.1  spz 	pass stateful in final proto udp to $ext_if port $services_udp
     43  1.1  spz 
     44  1.1  spz 	# Passive FTP
     45  1.1  spz 	pass stateful in final proto tcp to $ext_if port 49151-65535
     46  1.1  spz 	# Traceroute
     47  1.1  spz 	pass stateful in final proto udp to $ext_if port 33434-33600
     48  1.1  spz }
     49  1.1  spz 
     50  1.1  spz group (name "internal", interface $int_if) {
     51  1.1  spz 	block in all
     52  1.1  spz 	pass in final from <2>
     53  1.1  spz 	pass out final all
     54  1.1  spz }
     55  1.1  spz 
     56  1.1  spz group (default) {
     57  1.1  spz 	pass final on lo0 all
     58  1.1  spz 	block all
     59  1.1  spz }
     60  1.1  spz 
     61