fixed the way how are created the iptables rules in 'nginx' graph

This commit is contained in:
Jordi Sanfeliu 2013-01-25 11:37:36 +01:00
parent 6dd8c05598
commit 0ea82d636f
1 changed files with 3 additions and 4 deletions

View File

@ -84,9 +84,8 @@ sub nginx_init {
if($config->{os} eq "Linux") {
system("iptables -N nginx_IN 2>/dev/null");
system("iptables -I INPUT -p tcp --dport $nginx->{port} -j nginx_IN -c 0 0");
system("iptables -N nginx_OUT 2>/dev/null");
system("iptables -I OUTPUT -p tcp --sport $nginx->{port} -j nginx_OUT -c 0 0");
system("iptables -I INPUT -p tcp --sport 1024:65535 --dport $nginx->{port} -m state --state NEW,ESTABLISHED,RELATED -j nginx_IN -c 0 0");
system("iptables -I OUTPUT -p tcp --sport $nginx->{port} --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j nginx_IN -c 0 0");
}
if(grep {$_ eq $config->{os}} ("FreeBSD", "OpenBSD", "NetBSD")) {
system("ipfw delete $nginx->{rule} 2>/dev/null");
@ -152,7 +151,7 @@ sub nginx_update {
close(IN);
open(IN, "iptables -nxvL OUTPUT |");
while(<IN>) {
if(/ nginx_OUT /) {
if(/ nginx_IN /) {
(undef, $val) = split(' ', $_);
chomp($val);
$out = $val - ($config->{nginx_hist}->{'out'} || 0);