我的pf规则
2009-05-13 07:10:34来源:未知 阅读 ()
wan_if="re1" //内网
lo_if="lo0"
icmp_types="echoreq"//允许PING
table {$lan_if,$wan_if}
table {127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8} //私有地址,防止IP欺骗
table {10.129.29.201, 10.129.29.202, 10.129.29.203}//吧台,只允许访问办公网
table //临时屏蔽地址,配合portsentry使用防止恶意扫描
table file "/etc/chinanet"//电信IP段,做缓存
# 网络参数选项,根据自己情况设.
set timeout {interval 3,frag 5}
set timeout {tcp.first 20,tcp.opening 10,tcp.established 600}
set timeout {tcp.closing 10,tcp.finwait 10,tcp.closed 10}
set timeout {udp.first 10,udp.single 10,udp.multiple 60}
set timeout {icmp.first 5,icmp.error 5}
set timeout {other.first 10,other.single 10,other.multiple 30}
set timeout {adaptive.start 0,adaptive.end 0}
set limit {src-nodes 40000,states 40000,frags 10000}
set loginterface $wan_if
set optimization aggressive
set block-policy drop
set require-order yes
set fingerprints "/etc/pf.os"
set skip on $lo_if
# scrub
scrub in all
# set altq
# set altq
altq on $wan_if bandwidth 200Mb cbq queue {other, ssh, ping}
queue ping bandwidth 100Kb priority 1
queue other bandwidth 80% priority 3 cbq(default,red)
queue ssh bandwidth 10% priority 7 cbq(ecn,borrow)
altq on $lan_if bandwidth 160Mb cbq qlimit 200 queue {lanq}
queue lanq bandwidth 90% priority 5 cbq(default,red)
# nat
rdr on {$lan_if} proto tcp from to any -> *.*.*.* port 8080//*.*.*.*为办公网地址
no nat on $lan_if from to any
rdr on {$lan_if} proto tcp from $lan_if:network to port 80 -> $lo_if port 8080
rdr on {$wan_if} proto tcp from any to $wan_if port {22,23,3389} -> $lo_if port 3389
rdr on {$wan_if,$lan_if} proto tcp from any to $wan_if port 2222 -> $lo_if port 22
nat on $wan_if from $lan_if:network to any -> ($wan_if)
# default block
block all
pass out quick all keep state
pass quick on lo0 all keep state
block in quick from to any
antispoof quick for {$wan_if,$lan_if}
# rules
block in quick on $wan_if from to any
block out quick on $wan_if from any to
pass in quick on $lan_if from $lan_if:network to ! keep state
pass in log quick proto tcp from any to $lo_if port 8080 flags S/SA synproxy state (source-track rule, max-src-nodes 800, max-src-states 60, tcp.established 60, tcp.closing 5) queue ssh
pass in log quick proto tcp from any to $lo_if port 22 flags S/SA synproxy state (max 10, source-track rule, max-src-nodes 5, max-src-states 3, tcp.established 300, tcp.closing 5) queue ssh
pass in quick inet proto icmp from any to icmp-type $icmp_types keep state queue ping
pass in log quick proto tcp from any to $lo_if port 3389 flags S/SA synproxy state (max 5, source-track rule, max-src-nodes 5, max-src-states 1, tcp.established 3, tcp.closing 1) queue ping
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- 为Bash shell定义Home, Del, Insert热键 2009-05-13
- FreeBSD 内建的防火墙指令ipfw英译汉 2009-05-13
- OpenBSD 3.x 防火墙 PF配置新手指南 2009-05-13
- PF防火墙详解 2009-05-13
- FreeBSD setenv make.conf 2009-05-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash