2010年7月3日

重編核心加入netfilter patch

apt-get install kernel-package

apt-get install linux-source-2.6.18
apt-get install libncurses5-dev
cd /usr/src
tar xvf linux-source-2.6.18.tar.gz
cd /usr/src/linux-source-2.6.18
make menuconfig

/usr/src/linux-source-2.6.18# patch -p1 < kernel-2.6.18-2.6.19-layer7-2.9.patch
patching file include/linux/netfilter_ipv4/ip_conntrack.h
patching file include/linux/netfilter_ipv4/ipt_layer7.h
patching file net/ipv4/netfilter/Kconfig
patching file net/ipv4/netfilter/Makefile
Hunk #1 succeeded at 64 (offset 1 line).
patching file net/ipv4/netfilter/ip_conntrack_core.c
Hunk #1 succeeded at 338 (offset 1 line).
patching file net/ipv4/netfilter/ip_conntrack_standalone.c
Hunk #1 succeeded at 193 (offset 1 line).
patching file net/ipv4/netfilter/ipt_layer7.c
patching file net/ipv4/netfilter/regexp/regexp.c
patching file net/ipv4/netfilter/regexp/regexp.h
patching file net/ipv4/netfilter/regexp/regmagic.h
patching file net/ipv4/netfilter/regexp/regsub.c

make oldconfig (如果之前已經有編譯過 kernel source, 需先執行 make mrproper)
make menuconfig


make bzImage (kernel 2.4 需先執行 make dep)
make modules
make modules_install
make install

iptables

chmod +x ./extensions/.layer7-test
iptables -t mangle -A PREROUTING -m layer7 --l7proto yahoo -j DROP

沒有留言:

張貼留言