Dnscrypt on dd-wrt

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Tue Nov 08, 2016 4:33    Post subject: Reply with quote
I know some are still reading this thread, so for posterity's sake I thought I would post an update with my current configuration. I've changed a couple of current things and also have IPv6 enabled with corresponding listeners and DNSCrypt configuration. However, I haven't been able to completely validate that yet, but if I force my laptop to use the IPv6 gateway address as the resolver, I get resolutions back:
Code:
root@R7000:~# nvram get DD_BOARD
Netgear R7000
root@R7000:~# nvram get os_version
30840M
root@R7000:~# dnscrypt-proxy -V
dnscrypt-proxy 1.7.0
root@R7000:~# nvram get wan_dns
208.67.220.220 208.67.222.222 208.67.222.220
root@R7000:~# cat /tmp/resolv.dnsmasq
nameserver 208.67.220.220
nameserver 208.67.222.222
nameserver 208.67.222.220
root@R7000:~# cat /tmp/dnsmasq.conf
interface=br0,br1
resolv-file=/tmp/resolv.dnsmasq
strict-order
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-lease-max=24
dhcp-option=br0,3,192.168.1.1
dhcp-option=br1,3,192.168.20.1
dhcp-authoritative
... REDACTED CLIENT STATIC LEASE INFORMATION ...
stop-dns-rebind
# DNSCrypt configuration
dhcp-option=option6:dns-server,[::1]
server=::1#5353
server=127.0.0.53#5353
# Always resolve ntp.org even without DNSCrypt running
server=/ntp.org/208.67.222.222
# Additional options
addn-hosts=/opt/hosts
# IPv6 and RA configuration changes
dhcp-range=br0,::1000, ::3000, constructor:br0, ra-stateless, 4h
dhcp-range=br1,::1000, ::3000, constructor:br1, ra-stateless, 4h
ra-param=*,60,1800
enable-ra
quiet-ra
quiet-dhcp
quiet-dhcp6
root@R7000:~# netstat -an | grep 53
tcp        0      0 127.0.0.53:5353         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN
tcp        0      0 ::1:5353                :::*                    LISTEN
tcp        0      0 :::53                   :::*                    LISTEN
udp        0      0 0.0.0.0:53              0.0.0.0:*
udp        0      0 127.0.0.53:5353         0.0.0.0:*
udp        0      0 :::53                   :::*
udp        0      0 ::1:5353                :::*
root@R7000:~# ps | grep dnsc
 1820 root      1128 S    dnscrypt-proxy -a 127.0.0.53:5353 -L /opt/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv -R cisco -d
 1822 root      1128 S    dnscrypt-proxy -a [::1]:5353 -L /opt/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv -R cisco-ipv6 -d

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
Sponsor
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Nov 08, 2016 17:45    Post subject: Reply with quote
HalfBit, I have dnscrypt-proxy working on a spare R7000 with build 30815. I'm having problems auto starting dnscrypt-proxy after reboot how have you auto started it?

TIA!

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Tue Nov 08, 2016 19:48    Post subject: Reply with quote
mac913 wrote:
HalfBit, I have dnscrypt-proxy working on a spare R7000 with build 30815. I'm having problems auto starting dnscrypt-proxy after reboot how have you auto started it?

TIA!

I formatted my USB drive attached to the router, made an opt and jffs partition, then put the following script in /jffs/etc/config/ and called it dnscrypt-proxy.startup.

Code:
#!/bin/sh

FULL_PROG="/opt/usr/sbin/dnscrypt-proxy"
PROG="dnscrypt-proxy"
CURRENT_YR=`date "+%Y"`
ADDRESS=
PORT=
RESOLVER=
RESOLVER_LIST="/opt/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv"
EPHEMERAL_KEYS=0
CLIENT_KEY=
DAEMONIZE=1

start_instance() {
   instance=$FULL_PROG" -a "$ADDRESS":"$PORT" -L "$RESOLVER_LIST" -R "$RESOLVER
   if [ $ephemeral_keys -eq 1 ]; then instance=$instance" -E "
   fi
   if [ -n "$CLIENT_KEY" ]; then instance=$instance" -K "$CLIENT_KEY
   fi
   if [ $DAEMONIZE -eq 1 ]; then instance=$instance" -d"
   fi
   `$instance`
}

dnscrypt_instance_1() {
   echo "Configuring Instance 1"
   ADDRESS="127.0.0.53"
   PORT="5353"
   RESOLVER="cisco"
   #EPHEMERAL_KEYS=1
   #CLIENT_KEY=
   #DAEMONIZE=1
   echo "Starting Instance 1"
   start_instance
}

dnscrypt_instance_2() {
   echo "Configuring Instance 2"
   ADDRESS="127.1.1.53"
   PORT="5353"
   RESOLVER="cisco"
   #EPHEMERAL_KEYS=1
   #CLIENT_KEY=
   #DAEMONIZE=1
   echo "Starting Instance 2"
   start_instance
}

dnscrypt_instance_3() {
   echo "Configuring Instance 3"
   ADDRESS="127.2.2.53"
   PORT="5353"
   RESOLVER="cisco"
   #EPHEMERAL_KEYS=1
   #CLIENT_KEY=
   #DAEMONIZE=1
   echo "Starting Instance 3"
   start_instance
}

dnscrypt_ipv6_instance() {
   echo "Configuring ipv6 Instance"
   ADDRESS="[::1]"
   PORT="5353"
   RESOLVER="cisco-ipv6"
   #EPHEMERAL_KEYS=1
   #CLIENT_KEY=
   #DAEMONIZE=1
   echo "Starting ipv6 Instance"
   start_instance
}

main () {
   if [ "$CURRENT_YR" == "1969" ]; then
      sleep 120
   fi
   `killall dnscrypt-proxy`
   dnscrypt_instance_1
   #dnscrypt_instance_2
   #dnscrypt_instance_3
   dnscrypt_ipv6_instance
   exit 0
}

# Starts script
main
exit 0


In my experience, running more than one IPv4 and one IPv6 instance understandably craters my R7000. I wouldn't run more than one or two at most unless you have a more powerful CPU etc.

Thinking about it now, there's really no reason to run multiple instances as my br0 network interface and br1 guest network interface both use the same instance. I think my thought was to have one for each going to different resolvers. I guess that could be a use case but not for me.

The check for the current year of 1969 is because DNSCrypt checks the date on the certificate received from the DNS server and flags it as not valid when the date hasn't been set yet. You can ignore that validation, but, as an InfoSec professional, I choose not to do so.

Also, this script is pretty quick and dirty, so if anyone has any suggestions to simplify or clean up, let me know.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Sat Nov 12, 2016 23:23    Post subject: Reply with quote
HalfBit Thanks on your code to auto start DNSCrypt-Proxy works great.

The past 3 days I been working on having DNSCrypy-Proxy and 2 OpenVPN Clients operating on one R7000 this will cut down my router count from 4 to 2. I'm still on build 30815.

One thing I noticed when using DNSCrypt was the high CPU usage. So I did some searhcing on the web and the DNSCrypt-Proxy doesn't do any caching but is possible with Unbound. On the DD-WRT Basic Setup page you can enable Unbound by selecting 'Recursive DNS Resolving'. The default Unbound configuration doesn't work with DNSCrypt-Proxy and needed modifing. I created a unbound.wanup script in the /jffs/etc/config directory....



#!/bin/sh
#Using DNSCrypt in combination with a DNS cache
#by adding the script to the unbound.conf file
#https://dnscrypt.org/

killall unbound

echo "server:" > /tmp/unbound2.conf
echo "verbosity: 1" >> /tmp/unbound2.conf
echo "interface: 0.0.0.0" >> /tmp/unbound2.conf
echo "interface: ::0" >> /tmp/unbound2.conf
echo "outgoing-range: 60" >> /tmp/unbound2.conf
echo "outgoing-num-tcp: 1" >> /tmp/unbound2.conf
echo "incoming-num-tcp: 1" >> /tmp/unbound2.conf
echo "msg-buffer-size: 8192" >> /tmp/unbound2.conf
echo "msg-cache-size: 100k" >> /tmp/unbound2.conf
echo "msg-cache-slabs: 1" >> /tmp/unbound2.conf
echo "num-queries-per-thread: 30" >> /tmp/unbound2.conf
echo "rrset-cache-size: 100k" >> /tmp/unbound2.conf
echo "rrset-cache-slabs: 1" >> /tmp/unbound2.conf
echo "infra-cache-slabs: 1" >> /tmp/unbound2.conf
echo "infra-cache-numhosts: 200" >> /tmp/unbound2.conf
echo "access-control: 0.0.0.0/0 allow" >> /tmp/unbound2.conf
echo "access-control: ::0/0 allow" >> /tmp/unbound2.conf
echo "username: \"\"" >> /tmp/unbound2.conf
echo "pidfile: \"/var/run/unbound.pid\"" >> /tmp/unbound2.conf
#echo "root-hints: \"/etc/unbound/named.cache\"" >> /tmp/unbound2.conf
echo "target-fetch-policy: \"2 1 0 0 0 0\"" >> /tmp/unbound2.conf
#echo "harden-short-bufsize: yes
#echo "harden-large-queries: yes
#echo "auto-trust-anchor-file: \"/etc/unbound/root.key\"" >> /tmp/unbound2.conf
echo "key-cache-size: 100k" >> /tmp/unbound2.conf
echo "key-cache-slabs: 1" >> /tmp/unbound2.conf
echo "neg-cache-size: 10k" >> /tmp/unbound2.conf
echo "do-not-query-localhost: no" >> /tmp/unbound2.conf
echo "forward-zone:" >> /tmp/unbound2.conf
echo " name: \".\"" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.53@5353" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.52@5353" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.51@5353" >> /tmp/unbound2.conf
sleep 1

unbound -c /tmp/unbound2.conf

exit 0


Change the forward-addr(s) to your DNSCrypt-Proxy addresses, I'm using 3 instances if you are using one instance remove the other 2 lines of code. By running Unbound with DNSCrypt-Proxy I notice no big cpu usage and mostly nil. And to test that Unbound is going through DNSCrypt-Proxy just 'killall dnscrypt-proxy' and go to a site that isn't cached and you should get webpage errors.

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Sun Nov 13, 2016 3:58    Post subject: Reply with quote
I've never been able to get Unbound working. Do you just enable the Recursive DNS checkbox and run this script? Whenever I enable Unbound, I lose DNS completely.

Also, when I try your script, I get the following error:
Quote:
killall: unbound: no process killed
[1479009135] unbound[26367:0] error: can't bind socket: Address in use for 0.0.0.0
[1479009135] unbound[26367:0] fatal error: could not open ports

Any ideas?

Edit:
Nevermind. I did just what I asked and it worked! Check the box, save and apply changes, and run the script. When I got the error, I had not checked the box yet.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Nov 15, 2016 4:35    Post subject: Reply with quote
I've been a lot of configuration changes to my new setup with rebooting and noticed unbound wasn't starting with the new unbound2.conf file on wanup. Maybe my script was starting up before unbond started??? In any case I add a 2 sec delay at startup... Just in case anyone else the same issue.


#!/bin/sh
#Using DNSCrypt in combination with a DNS cache
#by adding the script to the unbound.conf file
#https://dnscrypt.org/

sleep 2

killall unbound

echo "server:" > /tmp/unbound2.conf
echo "verbosity: 1" >> /tmp/unbound2.conf
echo "interface: 0.0.0.0" >> /tmp/unbound2.conf
echo "interface: ::0" >> /tmp/unbound2.conf
echo "outgoing-range: 60" >> /tmp/unbound2.conf
echo "outgoing-num-tcp: 1" >> /tmp/unbound2.conf
echo "incoming-num-tcp: 1" >> /tmp/unbound2.conf
echo "msg-buffer-size: 8192" >> /tmp/unbound2.conf
echo "msg-cache-size: 100k" >> /tmp/unbound2.conf
echo "msg-cache-slabs: 1" >> /tmp/unbound2.conf
echo "num-queries-per-thread: 30" >> /tmp/unbound2.conf
echo "rrset-cache-size: 100k" >> /tmp/unbound2.conf
echo "rrset-cache-slabs: 1" >> /tmp/unbound2.conf
echo "infra-cache-slabs: 1" >> /tmp/unbound2.conf
echo "infra-cache-numhosts: 200" >> /tmp/unbound2.conf
echo "access-control: 0.0.0.0/0 allow" >> /tmp/unbound2.conf
echo "access-control: ::0/0 allow" >> /tmp/unbound2.conf
echo "username: \"\"" >> /tmp/unbound2.conf
echo "pidfile: \"/var/run/unbound.pid\"" >> /tmp/unbound2.conf
#echo "root-hints: \"/etc/unbound/named.cache\"" >> /tmp/unbound2.conf
echo "target-fetch-policy: \"2 1 0 0 0 0\"" >> /tmp/unbound2.conf
#echo "harden-short-bufsize: yes
#echo "harden-large-queries: yes
#echo "auto-trust-anchor-file: \"/etc/unbound/root.key\"" >> /tmp/unbound2.conf
echo "key-cache-size: 100k" >> /tmp/unbound2.conf
echo "key-cache-slabs: 1" >> /tmp/unbound2.conf
echo "neg-cache-size: 10k" >> /tmp/unbound2.conf
echo "do-not-query-localhost: no" >> /tmp/unbound2.conf
echo "forward-zone:" >> /tmp/unbound2.conf
echo " name: \".\"" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.53@5353" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.52@5353" >> /tmp/unbound2.conf
echo " forward-addr: 127.0.0.51@5353" >> /tmp/unbound2.conf
sleep 1

unbound -c /tmp/unbound2.conf

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Tue Nov 15, 2016 5:35    Post subject: Reply with quote
I've still been experimenting with Unbound on my router. I just wrote the conf file on the opt drive instead of to tmp every time, and my wanup script is pretty short. I've been trying to find the right amount of time to delay the script to get unbound to start up with my custom conf file, so far 20 seconds isn't long enough.
Code:
#!/bin/sh
#Using DNSCrypt in combination with a DNS cache
#by adding the script to the unbound.conf file
#https://dnscrypt.org/

sleep 30

killall unbound

sleep 1

unbound -c /opt/unbound/unbound-opt.conf

exit 0


I did get three instances of dnscrypt running without cratering my r7000 though! That was cool as I can tell that I get different responses based on the instance that is hit for the DNS query. More to come.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy


Last edited by HalfBit on Wed Nov 16, 2016 4:21; edited 1 time in total
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Tue Nov 15, 2016 6:18    Post subject: Reply with quote
There must be a bug with startup and wanup script control as it seems to cause other delays when the scripts take too long to complete. I found that adding long sleep times things don't get better and seem to run into more timing issues. What do you think?
_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Tue Nov 22, 2016 6:08    Post subject: Reply with quote
mac913 wrote:
There must be a bug with startup and wanup script control as it seems to cause other delays when the scripts take too long to complete. I found that adding long sleep times things don't get better and seem to run into more timing issues. What do you think?

I'm at a loss for the startup scripts. I've not been able to get them to consistently work. At one point, I was seeing the .wanup scripts execute 2-3 times after a reboot.

I'm trying to get YAMon3, DNSCrypt, and Unbound with custom conf file all started after a reboot. So far only DNSCrypt is starting consistently.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
<Kong>
DD-WRT Guru


Joined: 15 Dec 2010
Posts: 4339
Location: Germany

PostPosted: Tue Nov 22, 2016 6:30    Post subject: Reply with quote
HalfBit wrote:
mac913 wrote:
There must be a bug with startup and wanup script control as it seems to cause other delays when the scripts take too long to complete. I found that adding long sleep times things don't get better and seem to run into more timing issues. What do you think?

I'm at a loss for the startup scripts. I've not been able to get them to consistently work. At one point, I was seeing the .wanup scripts execute 2-3 times after a reboot.

I'm trying to get YAMon3, DNSCrypt, and Unbound with custom conf file all started after a reboot. So far only DNSCrypt is starting consistently.


Unbound is restarted when time changes, after ntp client ran, thus it does not really work using wan up script.

_________________
KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Tue Nov 22, 2016 7:59    Post subject: Reply with quote
honestly I really don't see the point of running unbound + dnscrypt. the way unbound is being run in this thread with auto-trust-anchor-file commented out disables dnssec and if memory serves only one dnscrypt server in north america supports dnssec anyways. Having a catchall forwarding zone turns unbound into a caching dns forwarder and not a dns resolver.

dnsmasq is a caching dns forwarder and is already being used for dhcp so there really isn't any reason in running unbound other than to say i did it.

A lot of the config seems overly complicated and over engineered as well.

all you really need is one instance of dnscrypt listening on ipv4 localhost on an alternative port

Code:
dnscrypt-proxy -R cisco -a 127.0.0.1:5353 -L /jffs/dnscrypt-resolvers.csv -d


and add two lines to the dnsmasq config + the ntp server line

Code:
no-resolv
server=127.0.0.1#5353


first line disables the default ddwrt resolve file statement and the second tells it to forward to the listening dnscrypt port on localhost

dnsmasq will now listen on both ipv4 + ipv6 ports and forward both ipv4+ipv6 queries via ipv4 localhost then on to opendns via ipv4 which will then resolv both ipv4 + ipv6 queries.

doing it this way also allows you to setup your guest networks using dnsmasq the same way you always have.

Anyway my 2 cents


*** another option in lieu of setting a static address for ntp server is to run ntpclient ip_of_favored_ntp_server prior to calling dnscrypt if time is an issue
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Wed Nov 23, 2016 2:53    Post subject: Reply with quote
<Kong> wrote:
HalfBit wrote:
mac913 wrote:
There must be a bug with startup and wanup script control as it seems to cause other delays when the scripts take too long to complete. I found that adding long sleep times things don't get better and seem to run into more timing issues. What do you think?

I'm at a loss for the startup scripts. I've not been able to get them to consistently work. At one point, I was seeing the .wanup scripts execute 2-3 times after a reboot.

I'm trying to get YAMon3, DNSCrypt, and Unbound with custom conf file all started after a reboot. So far only DNSCrypt is starting consistently.


Unbound is restarted when time changes, after ntp client ran, thus it does not really work using wan up script.


Could a custom config radio button and field be implemented in the GUI? That is probably the best solution, right?

Well, I guess it is more complicated than that. It would be best to have a hybrid scenario where it pulls the static lease information from the GUI, as well as some of the default, then has an "additional options" box like DNSMasq. A radio button for DNSSEC enablement would be good to, but then that opens the door up for more and more.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Wed Nov 23, 2016 2:59    Post subject: Reply with quote
JAMESMTL wrote:
honestly I really don't see the point of running unbound + dnscrypt. the way unbound is being run in this thread with auto-trust-anchor-file commented out disables dnssec and if memory serves only one dnscrypt server in north america supports dnssec anyways. Having a catchall forwarding zone turns unbound into a caching dns forwarder and not a dns resolver.

dnsmasq is a caching dns forwarder and is already being used for dhcp so there really isn't any reason in running unbound other than to say i did it.

A lot of the config seems overly complicated and over engineered as well.

all you really need is one instance of dnscrypt listening on ipv4 localhost on an alternative port

Code:
dnscrypt-proxy -R cisco -a 127.0.0.1:5353 -L /jffs/dnscrypt-resolvers.csv -d


and add two lines to the dnsmasq config + the ntp server line

Code:
no-resolv
server=127.0.0.1#5353


first line disables the default ddwrt resolve file statement and the second tells it to forward to the listening dnscrypt port on localhost

dnsmasq will now listen on both ipv4 + ipv6 ports and forward both ipv4+ipv6 queries via ipv4 localhost then on to opendns via ipv4 which will then resolv both ipv4 + ipv6 queries.

doing it this way also allows you to setup your guest networks using dnsmasq the same way you always have.

Anyway my 2 cents


*** another option in lieu of setting a static address for ntp server is to run ntpclient ip_of_favored_ntp_server prior to calling dnscrypt if time is an issue


Your logic is sound. I am still learning Linux/DD-WRT and understanding how things work. I am sure that things could be done better or simpler.

The reason why I am only running DNSCrypt is because we use OpenDNS which does not support DNSSEC--I wish they did. If it weren't for the filtering provided by OpenDNS, I would just use Unbound with DNSSEC and call it a day.

For now I implemented DNSCrypt because 1) OpenDNS supports it, 2) I wanted to learn how to do it, and 3) understand what all the hype was about with it.

But hey, now it works not only with DNSMasq, but Unbound as well, I understand what needs to be done for both.

Speaking of Unbound, in testing, I also tinkered with the default config file, and other custom files pointing to Google DNS (which supports DNSSEC) and checked the results on various DNS, and DNSSEC testing sites to see and understand the results.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
JAMESMTL
DD-WRT Guru


Joined: 13 Mar 2014
Posts: 856
Location: Montreal, QC

PostPosted: Wed Nov 23, 2016 3:23    Post subject: Reply with quote
note if using google dns as your resolver, there is no need to enable dnssec as google does the dnssec validation before replying to the query

Code:
dig www.dnssec-failed.org @8.8.8.8

; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.dnssec-failed.org @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 6451
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.dnssec-failed.org.         IN      A

;; Query time: 72 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Nov 22 22:13:08 EST 2016
;; MSG SIZE  rcvd: 50


vs a dns response via opendns

Code:
dig www.dnssec-failed.org @208.67.222.222

; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.dnssec-failed.org @208.67.222.222
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55820
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.dnssec-failed.org.         IN      A

;; ANSWER SECTION:
www.dnssec-failed.org.  7200    IN      A       69.252.193.191
www.dnssec-failed.org.  7200    IN      A       68.87.109.242

;; Query time: 66 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Tue Nov 22 22:14:01 EST 2016
;; MSG SIZE  rcvd: 82
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Wed Nov 23, 2016 3:55    Post subject: Reply with quote
JAMESMTL wrote:
note if using google dns as your resolver, there is no need to enable dnssec as google does the dnssec validation before replying to the query

Good point. I read that in another thread, and was going to edit my post, but you beat me to it.

_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next Display posts from previous:    Page 6 of 8
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum