0

我有一个这样的测试:

我的环境:

操作系统:Debian 8

A:172.20.0.1 (gateway  suricata v3.2 )

B:172.20.0.2  (App Server)

C:172.20.0.3  (Client)

我的网络:

client(C)  ----> gateway suricata A (ids)  -----> AppServer B

我的 suricata 构建信息:

wget https://github.com/inliniac/suricata/archive/suricata-3.2.zip
unar suricata-3.2.zip
cd suricata-3.2
git clone https://github.com/OISF/libhtp.git
./configure --enable-nfqueue --enable-pfring --enable-hiredis --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make install
make install-conf
make install-rules

并且只加载一个测试规则:

alert http any any -> any any (msg:"http test"; content:"GET";) #no.1
alert tcp any any -> any any (msg:"tcp test"; content:"GET";) #no.2
alert tcp any any -> any any (msg:"tcp http test"; content:"GET";http_method;) #no.3

A:172.20.0.1(网关 suricata)操作系统信息:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -F
iptables -F
iptables -A FORWARD -j ACCEPT

客户端发送请求为

 'http://172.20.0.2/test'

跟踪 fast.log。仅匹配#no.2 规则

我尝试使用 iptables 打开 nat,例如:

iptables -t nat -A POSTROUTING -j MASQUERADE

而这次 #no.1 #no.2 #no.3 规则匹配

但是,打开nat,appserver没有得到正确的客户端ip

地址。

现在,我想使用 7 层协议的一些参数,如 http_uri、http_method 等。nat 必须关闭。

我要正确的方法~~谢谢!

4

1 回答 1

0

我找到了一种方法:

iptables -A INPUT -i eth0 -p tcp -m tcp --sport 80 -j TEE --gateway 172.20.8.147
iptables -A OUTPUT -o eth0 -p tcp -m tcp --dport 80 -j TEE --gateway 172.20.8.147

NAT太糟糕了,

话题关闭

于 2016-12-13T10:04:20.103 回答