-
Notifications
You must be signed in to change notification settings - Fork 22
Setting up dnsmasq with secureoperator
Since secureoperator does no caching of its own, it's recommended that you set up a caching DNS server like dnsmasq on your local network, which responds from its own cache and forwards uncached requests to secureoperator for lookup.
This document assumes that you:
- are setting up dnsmasq and secureoperator on the same machine
- have already installed the dnsmasq package as apropriate for your operating system
- are installing on a Linux system
- are using [systemd][]
This isn't the only way to do this (you could use Docker, for example) however these instructions should easily adapt to other environments.
- Download the latest release of secureoperator for your environment, and place it at
/usr/local/bin/secure-operator
. Ensure it is executable (chmod +x secure-operator
) - Create a systemd unit file to run secureoperator on startup. Save this file as
/etc/systemd/system/secure-operator.service
and ensure it is executable (chmod +x secure-operator.service
)
[Unit]
Description=Secure Operator
After=network.target
[Service]
Type=simple
# start secureoperator on port 54, rather than the standard DNS port. dnsmasq will run on 53 and
# forward to this server.
ExecStart=/usr/local/bin/secure-operator -level warn -listen 0.0.0.0:54 -dns-servers "8.8.8.8,8.8.4.4"
[Install]
WantedBy=multi-user.target
- Run
systemctl daemon-reload
to reload the unit files - Run
systemctl start secure-operator.service
- If secureoperator starts successfully, enable the service with
systemctl enable secure-operator.service
; it will now run at startup.
Make a DNS request directly at secureoperator to ensure it's working; with the dig
command:
dig @localhost -p 54 google.com
You should see a response which includes the A
records for google.com
.
dnsmasq has a lot of configuration options; you should refer to its man
page for information on each; however, you a minimal configuration should only require a few tweaks.
- Edit
/etc/dnsmasq.conf
, ensure the following lines are set as follows:
# stops dnsmasq from reading resolv.conf
no-resolv
# add your secureoperator server as the upstream dns server
server=127.0.0.1#54
# set how many entries you wish to have cached; you can tweak
# this setting depending on how much memory your sytem has
# available
cache-size=500
- Alter the dnsmasq unit file to depend on secureoperator;
/etc/systemd/system/dnsmasq.service
; add the following to the[Unit]
section. Ensure these are new additions; don't replace any of the existingAfter
orRequires
directives:
After=secure-operator.service
Requires=secure-operator.service
- Start dnsmasq with
systemctl start dnsmasq.service
- If it starts correctly, enable it at startup with
systemctl enable dnsmasq.service
Make a DNS request directly at secureoperator to ensure it's working; with the dig
command:
dig @localhost google.com
You should see a response which includes the A
records for google.com
.