Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables & DCC Problem

Reply
Thread Tools Display Modes

Iptables & DCC Problem

 
 
Imitheos
Guest
Posts: n/a

 
      09-04-2004, 06:17 PM
Hello.

I have a linux firewall with 2.6 kernel and iptables.
I have read many posts and sites but every post says to enable the
conntrack/nat modules or to set xchat properly.

I have RELATED connections enabled and while FTP works (both active and
passive) DCC does not work.

I am posting any firewall rules i think may be relevant.

echo "1" > /proc/sys/net/ipv4/ip_dynaddr
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 20480 > /proc/sys/net/ipv4/netfilter/ip_conntrack_max
for i in /proc/sys/net/ipv4/conf/*/; do


echo 1 > $i/rp_filter
echo 1 > $i/log_martians
done (Have tried with rp_filter=0 too)

/sbin/modprobe ip_conntrack_ftp ports=21
/sbin/modprobe ip_conntrack_irc ports=6667,6669,7000
/sbin/modprobe ip_nat_ftp ports=21
/sbin/modprobe ip_nat_irc ports=6667,6669,7000
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -t filter -F
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
$IPTABLES -t filter -X
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP
$IPTABLES -N fw_tcp
$IPTABLES -N fw_udp
$IPTABLES -N fw_icmp

$IPTABLES -A INPUT -i $LO_IF -j ACCEPT
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
(INPUT SERVICES PORTS rules)

$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

$IPTABLES -A FORWARD -p tcp -j fw_tcp
$IPTABLES -A FORWARD -p udp -j fw_udp
$IPTABLES -A FORWARD -p icmp -j fw_icmp
$IPTABLES -A FORWARD -p tcp -j REJECT --reject-with tcp-reset
$IPTABLES -A FORWARD -j REJECT

# FTP
$IPTABLES -A fw_tcp -p tcp --dport 20:21 -j ACCEPT
$IPTABLES -A fw_tcp -p tcp --dport 6667 -j ACCEPT
$IPTABLES -A fw_tcp -p tcp --dport 6667 -m state --state RELATED -j ACCEPT
$IPTABLES -A fw_tcp -p tcp --dport 6669 -j ACCEPT
$IPTABLES -A fw_tcp -p tcp --dport 7000 -j ACCEPT
(OTHER PORTS rules)


I don't know why ftp works and dcc doesn't.
My test machine has 192.168.0.202 ip.
My nat gw with the above setup has 192.168.0.2 ip.
As i said i tried all the combinations in X-Chat and i can't make it
work. The only thing i can get is that with some setups in Xchat i get
"DCC Forged"


I am sorry for the long post.
I will wait for your opinion.

Thank you for your time.
 
Reply With Quote
 
 
 
 
Jose Maria Lopez Hernandez
Guest
Posts: n/a

 
      09-06-2004, 03:34 PM
Imitheos wrote:
> Hello.
>
> I have a linux firewall with 2.6 kernel and iptables.
> I have read many posts and sites but every post says to enable the
> conntrack/nat modules or to set xchat properly.
>
> I have RELATED connections enabled and while FTP works (both active and
> passive) DCC does not work.
>
> I am posting any firewall rules i think may be relevant.
>
> echo "1" > /proc/sys/net/ipv4/ip_dynaddr
> echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
> echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
> echo 20480 > /proc/sys/net/ipv4/netfilter/ip_conntrack_max
> for i in /proc/sys/net/ipv4/conf/*/; do
>
> echo 1 > $i/rp_filter
> echo 1 > $i/log_martians
> done (Have tried with rp_filter=0 too)
>
> /sbin/modprobe ip_conntrack_ftp ports=21
> /sbin/modprobe ip_conntrack_irc ports=6667,6669,7000
> /sbin/modprobe ip_nat_ftp ports=21
> /sbin/modprobe ip_nat_irc ports=6667,6669,7000


I think you shouldn't put the ports= in the modprobe,
the defaults are correct and maybe the problem is there.

> $IPTABLES -t nat -F
> $IPTABLES -t mangle -F
> $IPTABLES -t filter -F
> $IPTABLES -t nat -X
> $IPTABLES -t mangle -X
> $IPTABLES -t filter -X
> $IPTABLES -P INPUT DROP
> $IPTABLES -P OUTPUT ACCEPT
> $IPTABLES -P FORWARD DROP
> $IPTABLES -N fw_tcp
> $IPTABLES -N fw_udp
> $IPTABLES -N fw_icmp
>
> $IPTABLES -A INPUT -i $LO_IF -j ACCEPT
> $IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> (INPUT SERVICES PORTS rules)
>
> $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
>
> $IPTABLES -A FORWARD -p tcp -j fw_tcp
> $IPTABLES -A FORWARD -p udp -j fw_udp
> $IPTABLES -A FORWARD -p icmp -j fw_icmp
> $IPTABLES -A FORWARD -p tcp -j REJECT --reject-with tcp-reset
> $IPTABLES -A FORWARD -j REJECT
>
> # FTP
> $IPTABLES -A fw_tcp -p tcp --dport 20:21 -j ACCEPT
> $IPTABLES -A fw_tcp -p tcp --dport 6667 -j ACCEPT
> $IPTABLES -A fw_tcp -p tcp --dport 6667 -m state --state RELATED -j ACCEPT


I think this last rule it's not necessary, because the ones with
ESTABLISHED and RELATED are before this and they do the same job.

> $IPTABLES -A fw_tcp -p tcp --dport 6669 -j ACCEPT
> $IPTABLES -A fw_tcp -p tcp --dport 7000 -j ACCEPT
> (OTHER PORTS rules)
>
>
> I don't know why ftp works and dcc doesn't.
> My test machine has 192.168.0.202 ip.
> My nat gw with the above setup has 192.168.0.2 ip.
> As i said i tried all the combinations in X-Chat and i can't make it
> work. The only thing i can get is that with some setups in Xchat i get
> "DCC Forged"


Your script seem right, so you should make logs and see what's
happening. I think the problem it's that Netfilter can't see
the DCC connections as RELATED, maybe because the ports you
specify are not the ones it tries to use.

>
>
> I am sorry for the long post.
> I will wait for your opinion.
>
> Thank you for your time.



--

Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
(E-Mail Removed)
bgSEC Seguridad y Consultoria de Sistemas Informaticos
http://www.bgsec.com
ESPAÑA

The only people for me are the mad ones -- the ones who are mad to live,
mad to talk, mad to be saved, desirous of everything at the same time,
the ones who never yawn or say a commonplace thing, but burn, burn, burn
like fabulous yellow Roman candles.
-- Jack Kerouac, "On the Road"
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2.6.20 iptables nat Problem? Doug Mitton Linux Networking 7 02-08-2007 07:11 PM
iptables ftp problem johnny bobby bee Linux Networking 7 05-13-2005 10:30 AM
iptables problem Jozza Linux Networking 0 02-02-2005 12:03 PM
Iptables problem Carsten Keller Linux Networking 1 10-07-2003 11:36 AM
FTP problem with IPTABLES Karl Bickmore Linux Networking 3 07-12-2003 03:01 PM



1 2 3 4 5 6 7 8 9 10 11