========================== VirtualHost ======================
6.配置Pf防火墙:
# > /etc/pf.conf
# vi /etc/pf.conf
========================== pf.conf ======================
ext_if = "{ rl0 }"
noroute = "{ 127.0.0.1/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8, 255.255.255.255/32 }"
ports = "{ 20, 21, 22 }"
web = "{127.0.0.1}"
set block-policy return
set optimization aggressive
set skip on lo0
scrub in all
rdr on $ext_if proto tcp from any to $ext_if port 80 -> $web port 80
rdr on $ext_if proto tcp from any to $ext_if port 443 -> $web port 443
###to disenable antispoof
antispoof for $ext_if inet
block all
block return
block in quick on $ext_if os NMAP
block in quick on $ext_if from $noroute to any
block out quick on $ext_if from any to $noroute
###enable synproxy for web
pass in on $ext_if proto tcp from any to $web port {80,443} flags S/SA synproxy state
pass quick on $loop all
pass in on $ext_if proto {tcp,udp} from any to any port $ports keep state
pass in quick proto tcp from any to any port 55000 >/dev/null 2>&1; then
ifconfig pflog0 up
pflogd ${pflogd_flags}
fi
if [ -f /etc/pf.conf ]; then
/sbin/pfctl -e -F all -f /etc/pf.conf
fi
;;
stop)
/sbin/pfctl -d -F all
/usr/bin/pkill pflogd
/sbin/ifconfig pflog0 down
;;
*)
echo "$0 start | stop"
;;
esac
exit 0
========================== pf.sh ======================
# chmod 550 /etc/rc.d/pf.sh
# vi /etc/rc.local
if [ -f /etc/pf.conf ]; then
/etc/rc.d/pf.sh start
fi
禁用系统自定义的PF规则
# vi /etc/rc.conf
pf=NO
安装PF工具:
# pkg_add -v pfstat-1.7.tgz
# pkg_add -v pftop-0.4.tgz
安装流量检测工具:
# pkg_add -v ifstat-1.1.tgz
附录:
利用OB的源代码修改APACHE的最大连接数和版本号的方法
# cd /usr/src/usr.sbin/httpd
# vi src/include/httpd.h
==============================================
#ifndef HARD_SERVER_LIMIT
#define HARD_SERVER_LIMIT 1024
#endif
#define SERVER_BASEVENDOR "GOD Group"
#define SERVER_BASEPRODUCT "GOD_SITE"
#define SERVER_BASEREVISION "34.06.32"
==============================================
编译安装:
# make -f Makefile.bsd-wrapper obj
# make -f Makefile.bsd-wrapper cleandir
# make -f Makefile.bsd-wrapper depend
# make -f Makefile.bsd-wrapper
# make -f Makefile.bsd-wrapper install
重新启动HTTPD:
# apachectl restart