LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-16-2006, 03:26 PM   #1
billgist90018
LQ Newbie
 
Registered: Jan 2006
Location: Los Angeles, CA
Distribution: Red Hat Enterprise Linux 5
Posts: 2

Rep: Reputation: 0
iptables rules conflict with downloading LinuxShield virus defs


I'm running Red Hat Linux ES v4
I'm running McAfee LinuxShield 1.2.0 SP1

Currently as a workaround, I use the following script
iptables --flush INPUT
/opt/NAI/LinuxShield/bin/nails task --run 1
/etc/init.d/iptables restart active


This disables my INPUT iptables rules long enough to download the virus defs, and then it puts the rules back in place.

I can live with this workaround if I have to. But I thought I'd ask for assistance in case you all have a better solution.

At the end I've pasted in the script I use to generate my iptables rules, and below that I've paste in the output of the iptables -L command.

If I leave out the commands that flushes the input rules I get the following error message in the LinuxShield UI
/pub/antivirus/datfiles/4.x/update.ini: fetch failed

failed to fetch ./update.ini,
no virus definition file updates available,
no virus scanning engine updates available


I posted a problem report with McAfee and the tech there
told me to use "active ftp" and that does cause the update
request to go out on port 20, which I have opened up
in the iptables rules. And with that rule in place I can
leave my OUTPUT iptables rules in place. Unfortunately the data comes back on a randomly chosen port in the range 1025 thru 65535. According to the tech at McAfee
"the rule to accept any traffic on an ESTABLISHED connection is not functioning properly" And he suggested I post a question here.

Thanks for your help.

Here's the script that I use to generate the iptables rules

#reset and save as the inactive state
iptables --flush
/etc/init.d/iptables save inactive

#inbound rules - implemented
iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 3306 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 55443 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 65443 -j ACCEPT
iptables -A INPUT -i eth1 -p icmp -m icmp -j ACCEPT
iptables -A INPUT -i eth1 -j DROP

#Forwarding Rule
iptables -A FORWARD -o eth1 -j DROP

#outbound rules
iptables --flush OUTPUT
iptables -A OUTPUT -o eth1 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 20 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 21 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 42 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 53 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 143 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 137 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 138 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 139 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp --dport 65443 -j ACCEPT
iptables -A OUTPUT -o eth1 -p icmp -m icmp -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp -m tcp -j DROP

#command to save ruleset so it activates on reboot
/etc/init.d/iptables save active


And here's the output of the iptables -L command.

[root@msia-ww2 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:55443
ACCEPT tcp -- anywhere anywhere tcp dpt:65443
ACCEPT icmp -- anywhere anywhere icmp any
DROP all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:nameserver
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:netbios-ns
ACCEPT tcp -- anywhere anywhere tcp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere tcp dpt:65443
ACCEPT icmp -- anywhere anywhere icmp any
DROP tcp -- anywhere anywhere tcp
 
Old 01-16-2006, 08:11 PM   #2
billgist90018
LQ Newbie
 
Registered: Jan 2006
Location: Los Angeles, CA
Distribution: Red Hat Enterprise Linux 5
Posts: 2

Original Poster
Rep: Reputation: 0
Red Hat tech support supplied this answer that worked

The problem that you face with active FTP connection is that the connection is initiated by the FTP server.


For active FTP connections, the FTP server initiates the data connection from port 20. So it means that the firewall should have a mechanism to track a active FTP session and allow transfers accordingly.



Edit the file /etc/sysconfig/iptables-config and add the line
IPTABLES_MODULES="ip_conntrack_ftp"
Then restart iptables.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM
iptables rules puding Linux - Networking 2 08-09-2004 10:46 PM
iptables rules Fatz Linux - Security 1 08-05-2004 06:04 AM
iptables rules chrisfirestar Linux - Security 2 10-29-2003 02:30 AM
iptables rules Darin Linux - Security 1 01-23-2003 04:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration