LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-22-2006, 08:55 AM   #1
threepwood
LQ Newbie
 
Registered: Dec 2006
Posts: 5

Rep: Reputation: 0
Question problems between DNS & iptable


Hello to all,

I have a small problem.
I would like to reassure two DNS machines (a primary and a secondary) with iptables

By default I block everything, but even with rules for the port 53, it blocks the queries needing to resolve via the primary, and the secondary does not manage to transfer the zones of the primary …

DNS are on public ip, but to simplify, we are going to say that:

The primary DNS is: 192.168.0.10
The secondary DNS is: 192.168.0.20

Here are iptables rules(sliders) which I have at present:

Quote:
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT

iptables -A INPUT -i lo --source 127.0.0.1 --destination 127.0.0.1 -j ACCEPT
Thus with these rules, I have quite a lot of problems (resolutions, transfersof zones)
I found these rules on a forum, that seems to be interesting but as I do not know there not iptable, I ignore if it is what I miss or not.
For information here is all the same what I found (not tested):

Quote:
#iptables -A INPUT -p tcp -s 192.168.0.20/255.255.255.255 --sport 1024:65535 -d 192.168.0.10 -dport 53 -m state state NEW,ESTABLISHED -j ACCEPT
#iptables -A OUTPUT -p tcp -s 192.168.0.10/255.255.255.255 --sport 53:65535 -d 192.168.0.20 -dport 1024:65535 -m state state ESTABLISHED -j ACCEPT
If somebody can help me

Thank you

PS: server are under Linux Mandrake

Threepwood
 
Old 12-23-2006, 10:02 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by threepwood
Hello to all,

I have a small problem.
I would like to reassure two DNS machines (a primary and a secondary) with iptables

By default I block everything, but even with rules for the port 53, it blocks the queries needing to resolve via the primary, and the secondary does not manage to transfer the zones of the primary …

DNS are on public ip, but to simplify, we are going to say that:

The primary DNS is: 192.168.0.10
The secondary DNS is: 192.168.0.20

Here are iptables rules(sliders) which I have at present:

iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT

iptables -A INPUT -i lo --source 127.0.0.1 --destination 127.0.0.1 -j ACCEPT

Thus with these rules, I have quite a lot of problems (resolutions, transfersof zones)
I found these rules on a forum, that seems to be interesting but as I do not know there not iptable, I ignore if it is what I miss or not.
For information here is all the same what I found (not tested):


If somebody can help me

Thank you

PS: server are under Linux Mandrake

Threepwood
basically, what you wanna do in this case is add a couple LOG rules to the end of your chains so as to see what packets are getting filtered... then with that info you can proceed to take the appropriate measures, whatever they are...

on a side note, you seem to have forgotten your OUTPUT rule for the loopback interface...

here's what adding the LOG rules would go like:
Code:
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT

iptables -A INPUT -i lo --source 127.0.0.1 --destination 127.0.0.1 -j ACCEPT

iptables -A INPUT -j LOG --log-prefix "INPUT DROP: "
iptables -A OUTPUT -j LOG --log-prefix "OUTPUT DROP: "
BTW, are you sure your server isn't supposed to be allowed to initiate some type of outgoing connection?? cuz what you have there basically prevents it from doing so...


Quote:
#iptables -A INPUT -p tcp -s 192.168.0.20/255.255.255.255 --sport 1024:65535 -d 192.168.0.10 -dport 53 -m state state NEW,ESTABLISHED -j ACCEPT
#iptables -A OUTPUT -p tcp -s 192.168.0.10/255.255.255.255 --sport 53:65535 -d 192.168.0.20 -dport 1024:65535 -m state state ESTABLISHED -j ACCEPT
these rules are crap... ignore them...
 
  


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
IPTable Problems (Port Forwarding)... Arch3Angel Linux - Security 3 12-04-2004 04:56 PM
about DNS & other amitabhmca Linux - Newbie 1 01-24-2004 03:28 AM
Problems With Apache & Virtual Hosting Using Dynamic DNS moetjojo Linux - Networking 7 12-02-2002 04:51 AM
IPTable Policies Concerning DNS... Help. SpookMonkey Linux - Networking 2 05-15-2002 01:32 PM
FYI: O'Reilly, DNS&BIND & Sendmail unSpawn Linux - Networking 3 06-06-2001 08:20 AM

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

All times are GMT -5. The time now is 04:10 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