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 04-03-2011, 11:30 AM   #1
user100
Member
 
Registered: Aug 2010
Posts: 64

Rep: Reputation: 0
block dns host name resolve


Hi,

How can I best block dns host name resolving?

So that no app or whatever from inside my network can connect or forward outside my network by use of a free dns service like for example no-ip, freedns or something alike?

I guess one way is to block the ip addresses it would connect to in order to resolve a hostname. But any alternatives? Anyway to block it without using or knowing those ip addresses specifically?

And by using linux iptables.


Thanks.
 
Old 04-03-2011, 12:37 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Maybe allow only the DNS servers you want? For example:
Code:
iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -d 8.8.8.8 -j ACCEPT
iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -j REJECT
This can easily be expanded to allow more DNS servers as well as TCP queries. For example:
Code:
iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -d 8.8.8.8 -j ACCEPT
iptables -A FORWARD -p TCP -i eth0 -o eth1 --dport 53 -d 8.8.8.8 -j ACCEPT

iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -d 8.8.4.4 -j ACCEPT
iptables -A FORWARD -p TCP -i eth0 -o eth1 --dport 53 -d 8.8.4.4 -j ACCEPT

iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -j REJECT
iptables -A FORWARD -p TCP -i eth0 -o eth1 --dport 53 -j REJECT
That said, if your DNS daemon is running on your LAN then you could just block all outbound port 53 traffic, like:
Code:
iptables -A FORWARD -p UDP -i eth0 -o eth1 --dport 53 -j REJECT
iptables -A FORWARD -p TCP -i eth0 -o eth1 --dport 53 -j REJECT

Last edited by win32sux; 04-03-2011 at 12:41 PM.
 
Old 04-03-2011, 05:45 PM   #3
user100
Member
 
Registered: Aug 2010
Posts: 64

Original Poster
Rep: Reputation: 0
Thanks for your reply.

The problem however is that the daemon/app could use any port and not necessarily connect to an ip address I know.
It would most likely not use port 53 though. It could be any port.
 
Old 04-04-2011, 05:02 AM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
It sounds like you are in need of a proxy application. There are some commercial ones that are designed specifically for restricting traffic, such as Bluecoat. Squid being your most common open source alternative.

Fair warning, though, even if you open up plain http on port 80 and nothing else, there is no way to absolutely prevent them from "jail breaking" your proxy/firewall restrictions.
 
  


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
dns client cannot resolve on dns server jtvillegas Linux - Software 3 03-12-2016 03:30 PM
DNS issues, all illegitimate DNS queries resolve to me!??! fast-reflexes Linux - Networking 3 08-17-2010 06:38 AM
host resolve via dns shan_nathan Linux - Server 2 10-01-2008 12:18 AM
dns need zone file to resolve virtual host ? cool47 Linux - Networking 7 05-13-2008 05:39 PM
DNS can't resolve gmail.com but can resolve everything else? TongueTied Linux - Networking 2 01-24-2006 03:39 AM

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

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