Giter VIP home page Giter VIP logo

mageddo / dns-proxy-server Goto Github PK

View Code? Open in Web Editor NEW
752.0 14.0 77.0 18.71 MB

Solve your DNS hosts from your docker containers, then from your local configuration, then from internet

Home Page: http://mageddo.github.io/dns-proxy-server/

License: Apache License 2.0

JavaScript 1.10% HTML 0.08% Shell 0.21% CSS 0.02% Dockerfile 0.01% Java 98.57%
dns docker-dns dns-server dns-proxy-server service-discovery

dns-proxy-server's Introduction

CI help me to keep DPS up to date

Main features

DPS is a lightweight end user (Developers, Server Administrators) DNS server tool which make it easy to develop in systems where one hostname can solve to different IPs based on the configured environment, so you can:

  • Solve hostnames from local configuration database
  • Solve hostnames from docker containers using docker hostname option or HOSTNAMES env
  • Solve hostnames from a list of configured remote DNS servers(as a proxy) if no answer of two above
  • Solve hostnames using wildcards
  • Graphic interface to Create/List/Update/Delete A/CNAME records
  • Solve host machine IP using host.docker hostname
  • Access container by its container name / service name
  • Specify from which network solve container IP

Checkout the full list of features with examples

Basic running it

You can run DPS as native binary downloading the latest binaries releases or via docker looking at Dockerhub images.

Basic running it on Linux or Mac

sudo ./dns-proxy-server

Then you can solve from pre-configured entries (conf/config.json):

$ ping dps-sample.dev
PING dps-sample.dev (192.168.0.254) 56(84) bytes of data.

Also solve Docker containers:

$ docker run --rm --hostname nginx.dev nginx

$ ping nginx.dev
PING nginx.dev (172.17.0.4) 56(84) bytes of data.
64 bytes from 172.17.0.4 (172.17.0.4): icmp_seq=1 ttl=64 time=0.043 ms
64 bytes from 172.17.0.4 (172.17.0.4): icmp_seq=2 ttl=64 time=0.022 ms

See complete running it documentation for running on Mac, Windows, Docker, etc. also check the samples to learn by pratice.

Documents

Versioning and Releasing

Please be aware of how DPS controls the releases so you can use the most recent features and updates or prefer to choose the more stable and old builds.

Donation

Help me to keep DPS up to date

Via PayPal

Or via QR code

dns-proxy-server's People

Contributors

addshore avatar ajenbo avatar dependabot[bot] avatar dvarrazzo avatar imartinezortiz avatar josielrocha avatar mageddo avatar mrubli avatar simjost avatar thisisqasim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dns-proxy-server's Issues

Choose another aproach to set dns-proxy-server as default DNS

The Problem

Today when you run the DNS Proxy Server with docker he overwrites your /etc/resolv.conf what will force you to edit this file or re-plug the network cable(When using DHCP) when stop the DNS proxy server to get internet working again.

The Objective:

Find a way to register this DNS in linux via some standard(both npm and docker) command then when this server stops let linux recover to default (DHCP or DNSMASQ) DNS server.

Getting Warn when starting the service

When the service is started the console show the message

Starting service…
Error response from daemon: No such container: dns-proxy-server
Error response from daemon: No such container: &
Service started

The service works but the text No such... is not desired

DNS Resolution is very slow for container names -- >10 seconds

I'm testing out your DNS Proxy Server but it appears to be very slow for docker container hostname resolution. I can resolve Internet hostnames in an instant but container hostname resolution takes over 10 seconds before I start getting replies to my ping requests.

I'm on Ubuntu 16.04.4 LTS if that matters.

Let me know what I can provide to help track down the issue.

Add Windows Support

I think add support to MAC OSX may not be hard to do, anyway as Docker is supported by all platforms then makes sense for DPS do it as well

Can't make it work properly (Got recursion not available)

Great package, I'm very exited to use it during development, I followed the installation process but unfortunately I can't make it work properly.

I'm on debian and using Docker version 17.12.0-ce, build c97c6d6, docker-compose version 1.17.1 and DPS Version: 2.9.1.

There are few things I've done for debugging, here follows the steps from the beginning:

Steps to reproduce the behavior:

  1. Installed and started DPS as service with: ref
docker run --hostname dns.mageddo --name dns-proxy-server -p 5380:5380 \
  --restart=unless-stopped -d \
  -v /opt/dns-proxy-server/conf:/app/conf \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /etc/resolv.conf:/etc/resolv.conf \
  defreitas/dns-proxy-server
  1. Added the hostname and started a container using docker-compose:
version: '3'
services:
  db:
    image: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
  wordpress:
    image: wordpress
    restart: always
    hostname: testing.local
    depends_on:
      - db
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: wordpress
  1. Tested if the whole thing was working:
$ nslookup testing.local
Server:		8.8.8.8
Address:	8.8.8.8#53

** server can't find testing.local: NXDOMAIN

Noticed it wasn't using the DPS container as DNS server, after inspecting the host resolv.conf file I see it hasn't been updated:

$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

I've opened the bash inside DPS and checked the respective resolv.conf file:

$ docker exec dns-proxy-server cat /etc/resolv.conf
nameserver 172.17.0.2 # dps-entry

So the resolv.conf file doesn't get automatically updated, I've updated manually adding nameserver 172.17.0.2 # dps-entry and tried again:

$ nslookup google.com
Server:		172.17.0.2
Address:	172.17.0.2#53

Non-authoritative answer:
Name:	google.com
Address: 216.58.205.110
Name:	google.com
Address: 2a00:1450:4002:808::200e

Now it's working fine with the internet, let's try the docker containers:

$ nslookup testing.local
;; Got recursion not available from 172.17.0.2, trying next server
Server:		8.8.8.8
Address:	8.8.8.8#53

** server can't find testing.local: NXDOMAIN

And the respective logs from dns-proxy-server:

2018/12/04 10:44:23 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=begin, reqId=45607, questions=1, question=testing.local., type=TypeA
2018/12/04 10:44:23 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=begin, solver=proxy.SystemDnsSolver
2018/12/04 10:44:23 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=not-resolved, solver=proxy.SystemDnsSolver, err=host not found
2018/12/04 10:44:23 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=begin, solver=proxy.DockerDnsSolver
2018/12/04 10:44:23 DEBUG f=docker.go:31 pkg=github.com/mageddo/dns-proxy-server/proxy.DockerDnsSolver m=doSolve uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 solver=docker, status=solved-key, question=testing.local., hostname=testing.local, ip=172.23.0.4
2018/12/04 10:44:23 DEBUG f=dns.go:63 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=answer-found, solver=proxy.DockerDnsSolver, length=1
2018/12/04 10:44:23 DEBUG f=defaults.go:15 pkg=main m=handleQuestion uuid=2AAF6BD4-EDEF-12ED-FDE0-E3BF6FAB92A7 status=resolved, solver=proxy.DockerDnsSolver, length=1, answer=testing.local.	0	IN	A	172.23.0.4

I hope this help to figure out what's the problem, thanks in advance.

Containers not unregistering from DNS if it is removed

Reproduction

  • start a container docker start <container> or docker run image
  • remove the container docker rm <container>
  • check registered containers curl -X GET http://dns.mageddo/containers
  • the container is at the list yet

Error when running with weave

I am trying to run dns-proxy-server to provide hostname access to services running locally on a weave network via nginx. On startup, I get the following error:

2018/05/24 12:19:12 ERROR f=docker.go:147 pkg=github.com/mageddo/dns-proxy-server/events/docker m=putHostnames no network found to /weave

My docker-compose file looks like:

version: '3'
services:
  nginx:
    image: nginx:latest
    container_name: reverse-proxy
    environment:
      - APP_DOMAIN
      - APP_PORT
      - AUTH_PORT
      - WEAVE_DOMAIN
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/startup.sh:/startup.sh
      - ./nginx/sites-available:/etc/nginx/conf.d/sites-available
    command: ./startup.sh
    depends_on:
      - app.harmonize

  dns-reverse-proxy:
    image: defreitas/dns-proxy-server:latest
    container_name: dns-proxy-server
    hostname: .${APP_DOMAIN}
    ports:
      - "5380:5380"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - public

  app.harmonize:
    build:
      context: ../../harmonize/
      args:
        - NODE_ENV=development
    image: harmonize/harmonize:latest
    container_name: app.${WEAVE_DOMAIN}
    hostname: app.${WEAVE_DOMAIN}
    dns: ${WEAVE_DNS}
    dns_search: ${WEAVE_DOMAIN}
    restart: always
    environment:
      - reschedule=on-node-failure
    ports:
      - "${APP_PORT}:3000"
      - "9615:9615"
      - "9229:9229"
    volumes:
      - ${HARMONIZLY_ROOT}/harmonize:/usr/local/src/app

  # auth.harmonize:
  #   build:
  #     context: ../../auth/
  #     args:
  #       - NODE_ENV=development
  #   image: harmonize/auth:latest
  #   container_name: "auth.${WEAVE_DOMAIN}"
  #   hostname: "auth.${WEAVE_DOMAIN}"
  #   dns: ${WEAVE_DNS}
  #   dns_search: ${WEAVE_DOMAIN}
  #   restart: always
  #   environment:
  #     - reschedule=on-node-failure
  #   ports:
  #     - "${AUTH_PORT}:3000"
  #     - "9616:9615"
  #     - "9230:9229"
  #   volumes:
  #     - "${HARMONIZLY_ROOT}/auth:/usr/local/src/app"
networks:
  public:
    driver: bridge
  default:
    external:
      name: weave

To Reproduce
Steps to reproduce the behavior:

  1. Install weave
  2. Start weave (weave launch, eval $(weave env)
  3. Start dns-proxy-server

Expected behavior
I would expect that dns_proxy_server starts without error and allows resolution to the running services

Specs:

  • OS: macOS 10.13.3
  • Docker Version: 18.05.0-ce-mac66 (24545)
  • DPS Version: latest
  • Please attach DPS Log file
    dns.txt

Implement cache

Some hosts are slow to respond your IP so is interesting to implement a cache API.

For begin it not needle hosts limits and time to invalidate, it will be discoursed in the future

Log can be did using a better approach

The problem

Below reference links show that:

  • Every file/struct/function create your own log instance is not a good approach (as well it may cause concurrency problems), is better to just call a package function to log what you want
  • Save context in a struct is not a good approach
  • Just Println and debug are needle
  • Create a context with request is is not a log responsibility

Solution

  • Refactor go-logging API, eg.
    • Just call proxy go native log package and add Debug level
    • Use zap log tool and create an interface to overlap it
  • Create a context package to set and recover values from Context
  • Remove all logger instances and just reference it to a static function call

References

CNAME Support

It would be great if user would have the ability to create CNAME entries

Problem running on Ubuntu desktop

It runs just fine on Ubuntu Server but thats not a suitable development environment.

When running on a Ubuntu Desktop its unable to start on port 53.

developer@Dev:~/Code/DnsServer$ sudo node app.js { Error: bind EADDRINUSE 0.0.0.0:53 at Object.exports._errnoException (util.js:1036:11) at exports._exceptionWithHostPort (util.js:1059:20) at dgram.js:221:18 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:592:11) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'bind', address: '0.0.0.0', port: 53 }

Listing processes on port 53 shows nothing:
lsof -i tcp:53

How have you setup your development environment?

DNS resolution from inside of container

Whenever i start dns-proxy-server with command provided, dns resolution from inside of other containers stops immediately. What can i do here?

UPD: repeating same in clean virtualbox machine i can not reproduce it, however new problem raises:
i can not resolve container A hostname from inside of container B

UPD2: adding this line to /etc/default/docker and restarting docker service changed things, now i am able to resolve docker hostnames, but not external (internet) hostnames like google.
DOCKER_OPTS="--dns 172.2.0.10 --dns 8.8.8.8
Where 172.2.0.10 is ip of image with dns-proxy-server.

External hosts use

Will starting up the docker instance with --network host cause any issues with communicating with the docker services I am wanting to have other hosts not on the docker server to use the dns instance.

or should it be --network bridge?

Reduce configuration load/save calls

Today every time that server need to solve a name in local host it load this config from disk then overwrite the disk configuration. it is not performative and not necessary, a cache can be used for that.

Any way to disable logs from terminal?

First, thanks for all!

I'm using this image in my docker-compose file and when not running in detach mode, I see a lot of logs in the screen.

Is there any way to disable logs?

EDIT

I'm running in detach mode and using docker logs command to inspect my containers. A good solution for now.

Getting count is not defined randomly

After some test I've discover that the cache has a problem:

If you merge two questions answers in the same answer you will got ReferenceError: count is not defined (more details below) so I have fixed it

m=resolveDnsLocally, status=begin, question=accounts.youtube.com
m=resolveDnsLocally, status=notFound, question=accounts.youtube.com
m=solve, from=json
m=resolveDnsLocally, status=begin, question=accounts.youtube.com
m=resolveDnsLocally, status=notFound, question=accounts.youtube.com
m=solve, from=remote
m=proxy, status=begin, questionName= accounts.youtube.com , type= 1
m=proxy, status=resolvedFromCache, host=accounts.youtube.com, cacheSize=168, qtd=27
m=doAnswer, host=accounts.youtube.com, answer=27, authority=4, additional=4
m=parallel, status=questions done, action=sending answers, msg=success
ReferenceError: count is not defined
    at writeTruncate (/opt/docker-dns-server/node_modules/native-dns-packet/packet.js:223:22)
    at Function.Packet.write (/opt/docker-dns-server/node_modules/native-dns-packet/packet.js:416:19)
    at Packet.send (/opt/docker-dns-server/node_modules/native-dns/lib/packet.js:43:16)
    at /opt/docker-dns-server/app.js:85:12
    at /opt/docker-dns-server/node_modules/async/lib/async.js:726:13
    at /opt/docker-dns-server/node_modules/async/lib/async.js:52:16
    at done (/opt/docker-dns-server/node_modules/async/lib/async.js:241:17)
    at /opt/docker-dns-server/node_modules/async/lib/async.js:44:16
    at /opt/docker-dns-server/node_modules/async/lib/async.js:723:17
    at /opt/docker-dns-server/node_modules/async/lib/async.js:167:37
m=request, questions= 1
m=solve, requestFrom= 172.17.0.1 , for= daisy.ubuntu.com , type= A
m=solve, from=containers
m=resolveDnsLocally, status=begin, question=daisy.ubuntu.com
m=resolveDnsLocally, status=notFound, question=daisy.ubuntu.com
m=solve, from=json
m=resolveDnsLocally, status=begin, question=daisy.ubuntu.com
m=resolveDnsLocally, status=notFound, question=daisy.ubuntu.com
m=solve, from=remote

Resolving container using an address from a specific network.

The DNS server picks an IP address arbitrarily from one of two connected networks in docker compose.

To Reproduce
Steps to reproduce the behavior:

  1. Start proxy container using docker-compose.
  2. Start other container using docker-compose with two external networks.
  3. Attempt to ping the container using its host name.
  4. I can ping it, but it proxy resolves the IP address using the wrong network, (network1 instead of network2)

Expected behavior
I want it to resolve the IP using a network of choice, or override it in the web interface.
If it was resolving using an IP in network1, I want it to resolve with an IP in network2.
Example:
ping containername.{domain} (172.40.200.3) becomes (172.10.0.2)

Specs:

  • OS: Manjaro, kernel 4.19.0-1MANJARO
  • Docker Version: 18.06.1-ce
  • DPS Version: 2.7.0

Does not work when using on OSX

The resolv.conf is not used for DNS resolution on OSX.

#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
search domain.com
nameserver 0.0.0.5
nameserver 0.0.0.6
nameserver 192.168.1.1

I haven't found a way to get this working :(

Edit: nevermind -- The requirements on the readme show linux.

slow ping (ERROR f=dns.go:54 pkg=main m=handleQuestion)

It is probably the same error like in #68

I use your image for my daily local development (thank you!)

Since the last release (2.13.1) i've got constantly timeouts while trying to access local services via its container names.

$ nslookup mysql
;; Warning: ID mismatch: expected ID 26379, got 25257
;; Warning: ID mismatch: expected ID 26379, got 12160
;; Warning: ID mismatch: expected ID 26379, got 34480


$ ping mysql -c 3
PING mysql (172.18.0.6) 56(84) bytes of data.
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=1 ttl=64 time=0.098 ms
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=2 ttl=64 time=0.084 ms
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=3 ttl=64 time=0.057 ms

--- mysql ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 11016ms
rtt min/avg/max/mdev = 0.057/0.079/0.098/0.019 ms

$ docker logs dns
...
2019/04/11 18:30:22 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:30:22 INFO f=remote.go:66 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=88D4850B-54D3-B621-B714-72974DAC924C status=bad-code, name=mysql.home., rcode=3, err=status=invalid-answer-name, name=mysql.home., rcode=3
2019/04/11 18:30:22 INFO f=remote.go:67 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=88D4850B-54D3-B621-B714-72974DAC924C status=complete, name=mysql.home., res=3, err=status=invalid-answer-name, name=mysql.home., rcode=3
2019/04/11 18:30:22 ERROR f=dns.go:54 pkg=main m=handleQuestion uuid=88D4850B-54D3-B621-B714-72974DAC924C status=not-resolved, question={Name:mysql.home. Qtype:28 Qclass:1}%!(EXTRA *errors.errorString=status=invalid-answer-name, name=mysql.home., rcode=3)
2019/04/11 18:30:22 INFO f=remote.go:66 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=8C9904BF-CA58-5F85-D303-D2A9AD7DE22F status=bad-code, name=mysql.home., rcode=3, err=status=invalid-answer-name, name=mysql.home., rcode=3
2019/04/11 18:30:22 INFO f=remote.go:67 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=8C9904BF-CA58-5F85-D303-D2A9AD7DE22F status=complete, name=mysql.home., res=3, err=status=invalid-answer-name, name=mysql.home., rcode=3
2019/04/11 18:30:22 ERROR f=dns.go:54 pkg=main m=handleQuestion uuid=8C9904BF-CA58-5F85-D303-D2A9AD7DE22F status=not-resolved, question={Name:mysql.home. Qtype:1 Qclass:1}%!(EXTRA *errors.errorString=status=invalid-answer-name, name=mysql.home., rcode=3)
2019/04/11 18:30:23 INFO f=asm_amd64.s:1334 pkg=runtime m=goexit  status=updating-resolv.conf
2019/04/11 18:30:23 INFO f=resolvconf.go:127 pkg=github.com/mageddo/dns-proxy-server/resolvconf m=SetCurrentDNSServerToMachine status=begin, ip=172.18.0.2, err=<nil>
2019/04/11 18:30:23 INFO f=resolvconf.go:55 pkg=github.com/mageddo/dns-proxy-server/resolvconf m=ProcessResolvconf status=begin
2019/04/11 18:30:23 INFO f=scan.go:87 pkg=github.com/mageddo/dns-proxy-server/resolvconf m=ProcessResolvconf status=open-conf-file, file=/etc/resolv.conf
2019/04/11 18:30:23 INFO f=set-machine-dns-server.go:17 pkg=github.com/mageddo/dns-proxy-server/resolvconf.(*setMachineDNSServerHandler) m=process status=found-dns-proxy-entry
2019/04/11 18:30:23 INFO f=resolvconf.go:93 pkg=github.com/mageddo/dns-proxy-server/resolvconf m=ProcessResolvconf status=success, buffLength=777
2019/04/11 18:30:27 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
...

In the previous release (2.10.4) it worked like a charm:

$ nslookup mysql
Server:		172.18.0.2
Address:	172.18.0.2#53

Non-authoritative answer:
*** Can't find mysql.home: No answer



$ ping mysql -c 3
PING mysql (172.18.0.6) 56(84) bytes of data.
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=1 ttl=64 time=0.127 ms
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=2 ttl=64 time=0.066 ms
64 bytes from 172.18.0.6 (172.18.0.6): icmp_seq=3 ttl=64 time=0.063 ms

--- mysql ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2022ms
rtt min/avg/max/mdev = 0.063/0.085/0.127/0.030 ms

$ docker logs dns
...
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=begin, reqId=26668, questions=1, question=mysql.home., type=TypeAAAA
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=begin, reqId=61468, questions=1, question=mysql.home., type=TypeA
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=begin, solver=proxy.SystemDnsSolver
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=begin, solver=proxy.SystemDnsSolver
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=not-resolved, solver=proxy.SystemDnsSolver, err=host not found
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=not-resolved, solver=proxy.SystemDnsSolver, err=host not found
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=begin, solver=proxy.DockerDnsSolver
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=begin, solver=proxy.DockerDnsSolver
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=not-resolved, solver=proxy.DockerDnsSolver, err=hostname not found mysql.home
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=not-resolved, solver=proxy.DockerDnsSolver, err=hostname not found mysql.home
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=begin, solver=*proxy.CacheDnsSolver
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=begin, solver=*proxy.CacheDnsSolver
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC solver=local, status=hot-load, hostname=mysql.home
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 solver=local, status=hot-load, hostname=mysql.home
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 solver=local, status=hot-load, hostname=.mysql.home
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC solver=local, status=hot-load, hostname=.mysql.home
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 solver=local, status=hot-load, hostname=.home
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 DEBUG f=local.go:41 pkg=github.com/mageddo/dns-proxy-server/proxy.localDnsSolver m=solveHostname uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC solver=local, status=hot-load, hostname=.home
2019/04/11 18:35:53 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/11 18:35:53 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=not-resolved, solver=*proxy.CacheDnsSolver, err=hostname not found mysql.home
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=begin, solver=*proxy.CacheDnsSolver
2019/04/11 18:35:53 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/11 18:35:53 DEBUG f=remote.go:32 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 solver=remote, name=mysql.home., qtype=28
2019/04/11 18:35:53 DEBUG f=dns.go:52 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=not-resolved, solver=*proxy.CacheDnsSolver, err=hostname not found mysql.home
2019/04/11 18:35:53 DEBUG f=dns.go:56 pkg=main m=handleQuestion uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC status=begin, solver=*proxy.CacheDnsSolver
2019/04/11 18:35:53 DEBUG f=remote.go:32 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=D81258A3-DC1F-5BCD-7978-C2662B34F0EC solver=remote, name=mysql.home., qtype=1
2019/04/11 18:35:53 INFO f=remote.go:66 pkg=github.com/mageddo/dns-proxy-server/proxy.remoteDnsSolver m=Solve uuid=063B77E7-2892-2B84-7B49-B4F8CF1BC0F0 status=bad-code, name=mysql.home., rcode=3, err=status=inva
...
  • by the way dig seems to work in both versions

App get fatal error if container inspect fails

At this line in this snippet of code

cInspection, err := cli.ContainerInspect(ctx, event.ID)
  if err != nil {
    logger.Errorf("status=inspect-error, container=%s, err=%v", cInspection.Name, err)

If the inspection get a error the application will get nil pointer when try to log the container name

Taks

💡 Fix the nil pointer
💡 add continue statement to start the next iteration

🆗

Compose not supported with latest docker

According to this answer and #70, DPS seem to have worked for containers started from docker compose.
Tried with docker version 18.03 and id din't work.

I used the compose file from SO answer.

version: '3'
services:
  redis:
    image: redis:2.8
    hostname: redis.dev.intranet
  elasticsearch:
    image: elasticsearch:2.2
    hostname: elasticsearch.dev.intranet

Started DPS with docker run --rm --hostname dns.mageddo --na....

Then

> docker stack deploy -c compose.yaml dps_stack
Creating network dps_stack_default
Creating service dps_stack_elasticsearch
Creating service dps_stack_redis

> nslookup redis.dev.intranet
Server:         172.17.0.2
Address:        172.17.0.2#53

Non-authoritative answer:
Name:   redis.dev.intranet
Address: 10.0.0.4

> ping redis.dev.intranet
PING redis.dev.intranet (10.0.0.4) 56(84) bytes of data.
2 packets transmitted, 0 received, 100% packet loss, time 1007ms

Tried with docker run instead of compose and DPS correctly uses '172.17..' network.

Specs:

  • OS: inux liviu 4.13.0-45-generic #50~16.04.1-Ubuntu SMP
  • Docker Version: 18.03.1-ce, build 9ee9f40
  • DPS Version: 2.5.4
  • Logs: dps_stack.log

DPS loading config.json multiple times to execute one single action

For some reason DPS logs say it is loading config.json multiple times to solve a unique DNS record.

What is expected
DPS load config.json the mininum of times as possible

What is happening

It seems DPS is loading config.json multiple times

Steps to reproduce

$ nslookup google.com

log.txt

019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success
2019/04/04 06:13:11 INFO f=local.go:34 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration status=begin, confPath=/app/conf/config.json
2019/04/04 06:13:11 INFO f=local.go:37 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=openingFile
2019/04/04 06:13:11 INFO f=local.go:65 pkg=github.com/mageddo/dns-proxy-server/events/local m=LoadConfiguration  status=success```

Manual Configuration: multiple environments

Context
When you use DPS local storage you can register many hostname records referring a custom IP, that way you can use hostnames instead of static IPs then change the IPs when it comes necessary in one place. It have nothing with docker, just DPS working like a DNS with advanced settings

Use case Proposal
It would be nice if you can register many environments so you can register multiple IPs for the same hostname then you can point to a different IP by switching the environment.

Example

Let's say you own acme.com and is coding on that, you probably want to access acme.com pointing to your local machine instead of production, so you would use Dev environment that has a 127.0.0.1 entry at acme.com.

If you are testing QA then you swap to QA environment.

Then to default/prod when want to see it in prod, this environment probably have no entries so DPS will solve to the real IP

Requirements

  • Using GUI user can create/delete/update as many environments as wanted
  • User can choose what the active environment
  • Every environment has it's own hostnames entries

postfix could not resolve dns.

On the first deployment, docker assigns a NAT IP, eg: 10.10.10.2 which is appended on /etc/resolv.conf
When we restart the dns-proxy-server, docker somethings assign different NAT IP, eg 10.10.10.3.
Postfix (In host) usually on restart, copy the /etc/resolv.conf to /var/spool/postfix/etc/resolv.conf
the value set in /var/spool/postfix/etc/resolv.conf is IP: 10.10.10.3.

Hence, I have to restart postfix every time when the IP assigned to dns-proxy-server change.
Is there any way to automate this behaviour.

Thanks.

Server does not handle unquallified domains well in some conditions

The core issue here is when A) /etc/resolv.conf specifies DNS search domains and B) I request an unqualified hostname owned by a container, dns-proxy-server queries the nameservers before resolving the hostname to the container.

  1. My network has DNS search domains
  2. I need to use custom, internal name servers
  3. These name servers respond very slowly to requests for domains that don't exist
  4. When I nslookup example-app., I get a prompt response
  5. When I nslookup example-app, the server appends the search domain, queries the name servers, and waits for those queries to fail before it returns the appropriate response

config:

{
    "remoteDnsServers": [
        [10,2,3,4],
        [10,2,3,5]
    ]
}

/etc/resolv.conf:

# Generated by NetworkManager
search ExampleDomain.local exampledomain.local
# nameserver 10.2.3.4 # dps-comment
# nameserver 10.2.3.5 # dps-comment
nameserver 172.17.0.7 # dps-entry

nslookup example-app.:

% nslookup example-app.
Server:         172.17.0.7
Address:        172.17.0.7#53

Non-authoritative answer:
Name:   example-app
Address: 172.17.0.4

Logs:

dns-proxy-server    | 17-12-04 21:07:01.256 DEB id=39, m=handleQuestion status=begin, reqId=59670, questions=1, question=example-app., type=TypeA
dns-proxy-server    | 17-12-04 21:07:01.256 DEB id=39, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:07:01.256 DEB id=39, m=Solve solver=docker, status=solved-key, solver=docker, hostname=example-app, ip=172.17.0.4
dns-proxy-server    | 17-12-04 21:07:01.256 DEB id=39, m=handleQuestion status=answer-found, solver=*proxy.DockerDnsSolver, length=1
dns-proxy-server    | 17-12-04 21:07:01.256 DEB id=39, m=handleQuestion status=resolved, solver=*proxy.DockerDnsSolver, alength=1, answer=example-app.     0       IN      A       172.17.0.4

nslookup example-app:

% nslookup example-app
;; connection timed out; trying next origin
;; connection timed out; trying next origin
Server:         172.17.0.7
Address:        172.17.0.7#53

Non-authoritative answer:
Name:   example-app
Address: 172.17.0.4

Logs:

dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=42, m=handleQuestion status=begin, reqId=58655, questions=1, question=example-app.ExampleDomain.local., type=TypeA
dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=42, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=42, m=handleQuestion status=not-resolved, solver=*proxy.DockerDnsSolver, err=hostname not found example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=42, m=handleQuestion status=begin, solver=*proxy.localDnsSolver
dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=1, m=ContainsKey status=notfound, key=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:10:57.032 DEB id=1, m=Solve solver=local, status=hot-load, hostname=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:10:57.032 INF id=42, m=LoadConfiguration status=begin, confPath=/app/conf/config.json
dns-proxy-server    | 17-12-04 21:10:57.032 INF id=42, m=LoadConfiguration status=openingFile
dns-proxy-server    | 17-12-04 21:10:57.033 INF id=42, m=LoadConfiguration status=success
dns-proxy-server    | 17-12-04 21:10:57.033 DEB id=42, m=handleQuestion status=not-resolved, solver=*proxy.localDnsSolver, err=original env
dns-proxy-server    | 17-12-04 21:10:57.033 DEB id=42, m=handleQuestion status=begin, solver=*proxy.remoteDnsSolver
dns-proxy-server    | 17-12-04 21:10:57.033 DEB id=42, m=Solve solver=remote, status=servers-from-cache
dns-proxy-server    | 17-12-04 21:10:57.033 DEB id=42, m=Solve status=format-server, server=10.20.30.9
dns-proxy-server    | 17-12-04 21:10:57.033 INF id=42, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:10:57.033 DEB id=42, m=Solve status=format-server, server=10.20.30.18
dns-proxy-server    | 17-12-04 21:10:57.034 INF id=42, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:10:57.034 DEB id=42, m=handleQuestion status=not-resolved, solver=*proxy.remoteDnsSolver, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=43, m=handleQuestion status=begin, reqId=58655, questions=1, question=example-app.ExampleDomain.local., type=TypeA
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=43, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=43, m=handleQuestion status=not-resolved, solver=*proxy.DockerDnsSolver, err=hostname not found example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=43, m=handleQuestion status=begin, solver=*proxy.localDnsSolver
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=1, m=ContainsKey status=notfound, key=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:02.032 DEB id=1, m=Solve solver=local, status=hot-load, hostname=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:02.032 INF id=43, m=LoadConfiguration status=begin, confPath=/app/conf/config.json
dns-proxy-server    | 17-12-04 21:11:02.033 INF id=43, m=LoadConfiguration status=openingFile
dns-proxy-server    | 17-12-04 21:11:02.033 INF id=43, m=LoadConfiguration status=success
dns-proxy-server    | 17-12-04 21:11:02.033 DEB id=43, m=handleQuestion status=not-resolved, solver=*proxy.localDnsSolver, err=original env
dns-proxy-server    | 17-12-04 21:11:02.033 DEB id=43, m=handleQuestion status=begin, solver=*proxy.remoteDnsSolver
dns-proxy-server    | 17-12-04 21:11:02.033 DEB id=43, m=Solve solver=remote, status=servers-from-cache
dns-proxy-server    | 17-12-04 21:11:02.033 DEB id=43, m=Solve status=format-server, server=10.20.30.9
dns-proxy-server    | 17-12-04 21:11:02.033 INF id=43, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:02.033 DEB id=43, m=Solve status=format-server, server=10.20.30.18
dns-proxy-server    | 17-12-04 21:11:02.034 INF id=43, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:02.034 DEB id=43, m=handleQuestion status=not-resolved, solver=*proxy.remoteDnsSolver, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=44, m=handleQuestion status=begin, reqId=58655, questions=1, question=example-app.ExampleDomain.local., type=TypeA
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=44, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=44, m=handleQuestion status=not-resolved, solver=*proxy.DockerDnsSolver, err=hostname not found example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=44, m=handleQuestion status=begin, solver=*proxy.localDnsSolver
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=1, m=ContainsKey status=notfound, key=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:07.032 DEB id=1, m=Solve solver=local, status=hot-load, hostname=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:07.033 INF id=44, m=LoadConfiguration status=begin, confPath=/app/conf/config.json
dns-proxy-server    | 17-12-04 21:11:07.033 INF id=44, m=LoadConfiguration status=openingFile
dns-proxy-server    | 17-12-04 21:11:07.033 INF id=44, m=LoadConfiguration status=success
dns-proxy-server    | 17-12-04 21:11:07.033 DEB id=44, m=handleQuestion status=not-resolved, solver=*proxy.localDnsSolver, err=original env
dns-proxy-server    | 17-12-04 21:11:07.033 DEB id=44, m=handleQuestion status=begin, solver=*proxy.remoteDnsSolver
dns-proxy-server    | 17-12-04 21:11:07.033 DEB id=44, m=Solve solver=remote, status=servers-from-cache
dns-proxy-server    | 17-12-04 21:11:07.033 DEB id=44, m=Solve status=format-server, server=10.20.30.9
dns-proxy-server    | 17-12-04 21:11:07.034 INF id=44, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:07.034 DEB id=44, m=Solve status=format-server, server=10.20.30.18
dns-proxy-server    | 17-12-04 21:11:07.035 INF id=44, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:07.035 DEB id=44, m=handleQuestion status=not-resolved, solver=*proxy.remoteDnsSolver, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=begin, reqId=41200, questions=1, question=example-app.ExampleDomain.local., type=TypeA
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=not-resolved, solver=*proxy.DockerDnsSolver, err=hostname not found example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=begin, solver=*proxy.localDnsSolver
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=1, m=ContainsKey status=notfound, key=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=1, m=Solve solver=local, status=hot-load, hostname=example-app.ExampleDomain.local
dns-proxy-server    | 17-12-04 21:11:12.033 INF id=45, m=LoadConfiguration status=begin, confPath=/app/conf/config.json
dns-proxy-server    | 17-12-04 21:11:12.033 INF id=45, m=LoadConfiguration status=openingFile
dns-proxy-server    | 17-12-04 21:11:12.033 INF id=45, m=LoadConfiguration status=success
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=not-resolved, solver=*proxy.localDnsSolver, err=original env
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=handleQuestion status=begin, solver=*proxy.remoteDnsSolver
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=Solve solver=remote, status=servers-from-cache
dns-proxy-server    | 17-12-04 21:11:12.033 DEB id=45, m=Solve status=format-server, server=10.20.30.9
dns-proxy-server    | 17-12-04 21:11:12.034 INF id=45, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:12.034 DEB id=45, m=Solve status=format-server, server=10.20.30.18
dns-proxy-server    | 17-12-04 21:11:12.036 INF id=45, m=Solve status=bad-code, name=example-app.ExampleDomain.local., rcode=3, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:12.036 DEB id=45, m=handleQuestion status=not-resolved, solver=*proxy.remoteDnsSolver, err=status=invalid-answer-name, name=example-app.ExampleDomain.local., rcode=3
dns-proxy-server    | 17-12-04 21:11:17.033 DEB id=46, m=handleQuestion status=begin, reqId=37728, questions=1, question=example-app., type=TypeA
dns-proxy-server    | 17-12-04 21:11:17.033 DEB id=46, m=handleQuestion status=begin, solver=*proxy.DockerDnsSolver
dns-proxy-server    | 17-12-04 21:11:17.033 DEB id=46, m=Solve solver=docker, status=solved-key, solver=docker, hostname=example-app, ip=172.17.0.4
dns-proxy-server    | 17-12-04 21:11:17.033 DEB id=46, m=handleQuestion status=answer-found, solver=*proxy.DockerDnsSolver, length=1
dns-proxy-server    | 17-12-04 21:11:17.033 DEB id=46, m=handleQuestion status=resolved, solver=*proxy.DockerDnsSolver, alength=1, answer=example-app.     0       IN      A       172.17.0.4

Hostname for the host machine IP

Hi,

I'm using dns-proxy-server for a docker app development. I need to resolve the host machine IP by hostname. I know how to achieve it using host.docker, but I'm using a connector that I can't modify which is using my hostname.

So, is there any way to resolve my hostname to 127.0.1.1? Linking the dns proxy server to /etc/hosts or something like that.

Maybe it can be already achieved, but I can't do it reading the docs, http://mageddo.github.io/dns-proxy-server/ :S

Thanks!!

Hostname for the host machine IP

Docker host have an IP, that way you can reference the host machine, this IP can change though, so it would be great if DPS has some hostname entry to dynamically reference the host IP. Something like host.docker that way users can solve hostname IP in a dynamic way.

Inside docker container you can recover host IP by just running bellow command

ip r | awk '/default/{print $3}'

it also works with docker swarm ingres network

DPS Must respect server TTLs

Context
Today when DPS will proxy to a remote server it's don't cache the result locally then server TTL is not respected, for that reason sometimes DPS is receiving DOS from the server cause the high number of requests for the same question to the server.

Requirements

  • DPS must in somehow cache remote server calls and only invalidate that cache when TTL expires

No way to specify upstream/remote DNS server port

I'd like to include the Consul DNS server as one of the remote name servers, but it looks like it only accepts the IP address as an array of numbers. Ideally we should be able to include the port in the remote dns server settings. Honestly I'd prefer to be able to just configure it as "remoteDnsServers": ["172.16.33.33:8600"], which means you'd need to parse the port out because it looks like the parameters you pass into your function to add the host is the ip address and then the port as a separate parameter.

Wildcard support

I have a docker container whith nginx and wordpress and use dns-proxy-server to resolve this as testdomain.dev.

I have configured nginx:

server {
    listen       80;
    server_name  *.testdomain.dev;
    ...
}

and try this too:

    listen       80  default_server;

How can I configure to use *.testdomain.dev?

Support for Wildcard DNS in multilevel

Wildcard works, but only for one level.
If i set hostname ".localhost" it resolve "test.localhost" and do not resolve "test2.test.localhost".
I think it should work for.

DNS missing HOSTNAMES env from neighbors container

Hello.

We have issue:
if some containers started later than dns-proxy (for example longstart database), dns is not learning their HOSTNAMES variable (detected missing in proxy log)

We fix it over force-restart dns-proxy container in the end.

Tell me please how often dns-proxy have refresh HOSTNAMES vars from neighbor? Maybe possible to add parameter for it (reduce to 1 min for example)?

Update documentation: How to use on Windows

I wanted to use this on Windows 10 as an alternative to editing my HOSTS file. I was able to get this working using Docker CE for Windows w/ Linux containers, but I had to use this docker run command to get it to work (it took me about an hour to figure this out). The only other thing I had to do was change my network adapter setting by making 127.0.0.1 the DNS server.

docker run --name dns-proxy-server -p 5380:5380 -p 53:53/udp -v /var/run/docker.sock:/var/run/docker.sock defreitas/dns-proxy-server

Please consider adding this to the documentation. Thanks!

dns resolve during image build

dns-proxy-log.txt
Hi,

I am using docker eclipse tooling to connect with the remote docker instance using TLS.
The docker build RUN could not resolve dns for command "apt-get install package".
Here is the error shown by dns-proxy-server

�[36m18-04-03 06:42:00.016 DEB �[0mid=53, m=handleQuestion status=not-resolved, solver=proxy.DockerDnsSolver, err=hostname not found opqobwuqbukhds
�[36m18-04-03 06:42:00.016 DEB �[0mid=54, m=handleQuestion status=not-resolved, solver=proxy.DockerDnsSolver, err=hostname not found jqwjuxddshtl

Any workaround. If I stop the dns-proxy-server, docker build could resolve the DNS.

I have attached the complete log.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.