host-npf.conf revision 1.9
11.9Ssevan# $NetBSD: host-npf.conf,v 1.9 2019/04/15 22:38:48 sevan Exp $ 21.2Sspz# 31.9Ssevan# Simple ruleset for a host with (i.e., not routing) two interfaces, 41.9Ssevan# ethernet and wifi. 51.1Sspz# 61.9Ssevan# DHCP (v4 and v6), SLAAC, ICMPv6, ICMP echo requests, traceroute, mDNS traffic 71.9Ssevan# are permitted, inbound, on either interface. 81.9Ssevan# 91.9Ssevan# SSH to the host is allowed in via the ethernet interface. 101.9Ssevan# blacklistd(8) is used to prevent SSH bruteforce attempts. 111.9Ssevan# 121.9Ssevan# No specific rules for the wifi interface. 131.9Ssevan# 141.9Ssevan# All traffic from the host is permitted, outbound, on either interface. 151.1Sspz# 161.4Srmind 171.1Sspz$wired_if = "wm0" 181.9Ssevan$wifi_if = "iwn0" 191.9Ssevan$wired_addrs= ifaddrs(wm0) 201.9Ssevan$wifi_addrs = ifaddrs(iwn0) 211.1Sspz 221.9Ssevanalg "icmp" 231.1Sspz 241.1Sspzprocedure "log" { 251.9Ssevan log: npflog0 261.1Sspz} 271.1Sspz 281.5Sspzgroup "wired" on $wired_if { 291.9Ssevan# Placeholder for blacklistd (configuration separate) to add blocked hosts 301.9Ssevanruleset "blacklistd" 311.1Sspz 321.9Ssevan# Allow SSH on wired interface 331.9Ssevanpass in on $wired_if proto tcp to $wired_addrs port ssh apply "log" 341.1Sspz 351.1Sspz} 361.1Sspz 371.5Sspzgroup "wifi" on $wifi_if { 381.9Ssevan 391.1Sspz} 401.1Sspz 411.5Sspzgroup default { 421.9Ssevan# Default deny, otherwise last matching rule wins 431.9Ssevanblock all apply "log" 441.9Ssevan 451.9Ssevan# Don't block loopback 461.9Ssevanpass on lo0 all 471.9Ssevan 481.9Ssevan# Allow incoming DHCP server responses 491.9Ssevanpass in family inet4 proto udp from any port bootps to any port bootpc 501.9Ssevanpass in family inet6 proto udp from any to any port "dhcpv6-client" 511.9Ssevan 521.9Ssevan# Allow IPv6 ICMP 531.9Ssevanpass family inet6 proto ipv6-icmp all 541.9Ssevan 551.9Ssevan# Allow incoming IPv4 pings 561.9Ssevanpass in family inet4 proto icmp icmp-type echo all 571.9Ssevan 581.9Ssevan# Allow being tracerouted 591.9Ssevanpass in proto udp to any port 33434-33600 601.9Ssevan 611.9Ssevan# Allow incoming mDNS traffic from neighbours 621.9Ssevanpass in proto udp to any port mdns 631.9Ssevan 641.9Ssevan# Allow all outbound traffic 651.9Ssevanpass stateful out all 661.1Sspz} 67