Debian – Securing dnsmasq – interface(s)

debiandnsmasqSecurity

Im preparing to deploy about a thousand fanless machines running Debian. Each machine has 3 interfaces (eth0, eth1 and uap0). In many cases these machines will sit between a cable modem and a home router / network so I need to be transparent between eth0 and eth1. To this end I have setup dnsmasq in hopes of routing traffic and providing addresses.

My DNSMASQ.CONF file is fairly simple. Mostly all I've added were the lines:

interface=eth1
interface=uap0
no-dhcp-interface=uap0

In hopes of securing the machine I'm trying to lock down any ports available on eth0. Using nmap -v -p1-65535 <hostname> I see that ports 22, 53, 80 and 111 are answering on eth0. 22 and 80 I understand (ssh and httpd). What concerns me is port 53. lsof -i :53 shows that dnsmasq is answering there.

Why? Do I need to add iptables entries to block this? Will it still work if I do this?

Best Answer

Port 53 is used for DNS. It depends on your needs if you need it, or not.

You can configure dnsmasq to provide some outside (ISPs)DNS server to DHCP clients, and then you can disable DNS relaying on your box. If not, make sure to enable DNS relaying only for internal network.