LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-09-2007, 07:10 PM   #1
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137
Blog Entries: 1

Rep: Reputation: 17
Firewalled too much..


Apparently I've firewalled myself enough not to be able to resolve domain names. Not sure why though, but heres the settings:

[root@radio276 ~]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
LOG all -- anywhere anywhere LOG level debug prefix `BANDWIDTH_IN:'
ACCEPT all -- localhost.localdomain localhost.localdomain
DROP 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:http
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:smtps
ACCEPT tcp -- anywhere anywhere tcp dpt:submission
ACCEPT tcp -- anywhere anywhere tcp dpt:qmqp
ACCEPT tcp -- anywhere anywhere tcp dpt:imaps
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3s
ACCEPT tcp -- anywhere anywhere tcp dpt:atmtcp
DROP tcp -- !localhost.localdomain anywhere tcp dpt:mysql
ACCEPT tcp -- anywhere anywhere tcp dpt:irdmi
DROP tcp -- anywhere anywhere tcp dpt:pcsync-https
ACCEPT tcp -- anywhere anywhere tcp dpt:ndmp

Chain FORWARD (policy ACCEPT)
target prot opt source destination
LOG all -- anywhere anywhere LOG level debug prefix `BANDWIDTH_OUT:'
LOG all -- anywhere anywhere LOG level debug prefix `BANDWIDTH_IN:'

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
LOG all -- anywhere anywhere LOG level debug prefix `BANDWIDTH_OUT:'
 
Old 03-09-2007, 07:52 PM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
DNS uses port 53. I never really liked reading Iptable from that view, to me its much more complicated that looking at the actual rules.
 
Old 03-09-2007, 08:04 PM   #3
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
Opening port 53 doesn't seem to help
 
Old 03-09-2007, 09:07 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You'll need to open UDP port 53 for DNS.
 
Old 03-09-2007, 09:12 PM   #5
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
I did. I figured it was UDP not TCP.
 
Old 03-09-2007, 10:40 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Does that mean it's working now? If not, are your rules something like the following for UDP port 53?
Code:
iptables -t filter -A OUTPUT -p UDP --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -t filter -A INPUT  -p UDP --sport 53 -m state --state ESTABLISHED     -j ACCEPT
 
Old 03-09-2007, 10:47 PM   #7
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
ESTABLISHED helped a bit, now it hangs at making an http connection
 
Old 03-09-2007, 10:59 PM   #8
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
Applied the same idea to http/https/ftp. That fixed that. Any other common protocols I should add?
 
Old 03-10-2007, 06:57 AM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by jmoschetti45
Applied the same idea to http/https/ftp. That fixed that. Any other common protocols I should add?
are you referring to the ESTABLISHED rule?? if so, i'd recommend you just add a rule like this:
Code:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
to the top of your INPUT chain and you won't have to worry about making RELATED,ESTABLISHED rules for particular services (they would only need rules for packets of state NEW)... for example:
Code:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p TCP --dport 22 -m state --state NEW -j ACCEPT
iptables -A INPUT -p TCP --dport 80 -m state --state NEW -j ACCEPT
iptables -A INPUT -p TCP --dport 443 -m state --state NEW -j ACCEPT
# Etc, etc, etc...

Last edited by win32sux; 03-10-2007 at 07:05 AM.
 
Old 03-10-2007, 04:48 PM   #10
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
Thanks! Seems to be working fine now.
 
Old 03-13-2007, 07:49 PM   #11
jmoschetti45
Member
 
Registered: Oct 2004
Location: Michigan
Distribution: Debian Squeeze (2.6.32-5)
Posts: 137

Original Poster
Blog Entries: 1

Rep: Reputation: 17
Whats a good port range to allow for passive ftp?
 
Old 03-14-2007, 01:58 AM   #12
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by jmoschetti45
Whats a good port range to allow for passive ftp?
thankfully, there is no need to open a port range for this (unlike back in the ipchains days), because it would be a security weakness... you only need port 21 to send packets of state NEW to ACCEPT, the rest is handled by the RELATED,ESTABLISHED rule at the top of the chain... ftp connection tracking will allow netfilter to inspect the tcp packets and detect which random port is being used for the passive ftp connection, hence no need for netfilter to have prior knowledge or opened port ranges... if your kernel doesn't have ftp conntrack support built-in then load the module/helper on your own:
Code:
/sbin/modprobe ip_conntrack_ftp

Last edited by win32sux; 03-14-2007 at 04:49 AM.
 
  


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
Bittorrent On Linux - Firewalled? Descent_Fan Linux - Software 2 06-06-2006 11:04 AM
gtk-gnutella - Firewalled or not? kjp_72 Linux - Software 1 08-25-2004 12:41 AM
IRC from a firewalled network andrew001 Linux - Networking 0 08-09-2003 08:18 PM
GTK-Gnutella Knows I'm Firewalled Crashed_Again Linux - Software 4 03-08-2003 05:22 PM
NFS between firewalled machines altawolf Linux - Networking 2 12-02-2002 06:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:09 AM.

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