[GH-ISSUE #245] Support regex or mid-level subdomain wildcard DNS #97

Closed
opened 2026-02-26 04:34:02 +03:00 by kerem · 3 comments
Owner

Originally created by @outdooracorn on GitHub (Jul 10, 2022).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/245

Originally assigned to: @mageddo on GitHub.

What is expected

Be able to provide a HOSTNAMES=subdomain.*.domain.tld env variable to a container on a network with a DPS container and have DPS match subdomain.some.domain.tld, subdomain.other.domain.tld, subdomain.mid-level.domain.tld, subdomain.subdomain.domain.tld, for example.

Alternatively, you could support regex. For example:

  • HOSTNAMES=subdomain\..*\.domain.tld to match questions that start with subdomain. and end with .domain.tld
  • HOSTNAMES=subdomain\.[a-z]+-test.tld to match questions that start with subdomain. and where the domain starts with alpha chars and ends in -test

Currently, I only need the former option but the regex option would be more flexible (and maybe easier to implement?).

What is Happening

DPS isn't able to parse mid-level wildcards or regex. Logs report Not solver for the question {URL}.

Changes (Optional)

Originally created by @outdooracorn on GitHub (Jul 10, 2022). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/245 Originally assigned to: @mageddo on GitHub. ### What is expected Be able to provide a `HOSTNAMES=subdomain.*.domain.tld` env variable to a container on a network with a DPS container and have DPS match `subdomain.some.domain.tld`, `subdomain.other.domain.tld`, `subdomain.mid-level.domain.tld`, `subdomain.subdomain.domain.tld`, for example. Alternatively, you could support regex. For example: - `HOSTNAMES=subdomain\..*\.domain.tld` to match questions that start with `subdomain.` and end with `.domain.tld` - `HOSTNAMES=subdomain\.[a-z]+-test.tld` to match questions that start with `subdomain.` and where the domain starts with alpha chars and ends in `-test` Currently, I only need the former option but the regex option would be more flexible (and maybe easier to implement?). ### What is Happening DPS isn't able to parse mid-level wildcards or regex. Logs report `Not solver for the question {URL}`. ### Changes (Optional)
kerem 2026-02-26 04:34:02 +03:00
Author
Owner

@mageddo commented on GitHub (Mar 2, 2023):

Hey, I agree regex would be a better option. It would be a nice feature, not sure how many people need it, I'm working on better MAC OS and Windows compatibility right now but able to implement that on sequence, Do you still need it?

If you still need it and the feature is simple to implement as I'm thinking, the I may put it first priority.

<!-- gh-comment-id:1452140497 --> @mageddo commented on GitHub (Mar 2, 2023): Hey, I agree regex would be a better option. It would be a nice feature, not sure how many people need it, I'm working on better MAC OS and Windows compatibility right now but able to implement that on sequence, Do you still need it? If you still need it and the feature is simple to implement as I'm thinking, the I may put it first priority.
Author
Owner

@outdooracorn commented on GitHub (Mar 9, 2023):

Hey, yes this would still be a useful feature for a project I contribute to. Thanks for taking a look 🙂

<!-- gh-comment-id:1462502866 --> @outdooracorn commented on GitHub (Mar 9, 2023): Hey, yes this would still be a useful feature for a project I contribute to. Thanks for taking a look 🙂
Author
Owner

@mageddo commented on GitHub (Mar 19, 2023):

EDIT

Release notes:

3.14.0

  • Support for regex on localdb solver and docker container hostname and HOSTNAMES env

Hey @outdooracorn I'm proposing the support for regex on snapshot 3.14.1-snapshot , can you give it a try and give a feedback? See the examples below:

Running a container

$ docker run --rm --name nginx1 --hostname '/batata\.[a-z]+\.com/' -e 'HOSTNAMES=/\d+\.acme.com/,/sub.acme.com/' nginx

Solving

$ nslookup -po=8053 batata.whatever.com 127.0.0.1
Server:		127.0.0.1
Address:	127.0.0.1#8053

Non-authoritative answer:
Name:	batata.whatever.com
Address: 172.17.0.4

$ nslookup -po=8053 xpto.acme.com 127.0.0.1
Server:		127.0.0.1
Address:	127.0.0.1#8053

** server can't find xpto.acme.com: NXDOMAIN

$ nslookup -po=8053 123.acme.com 127.0.0.1
Server:		127.0.0.1
Address:	127.0.0.1#8053

Non-authoritative answer:
Name:	123.acme.com
Address: 172.17.0.4


$ nslookup -po=8053 sub.acme.com 127.0.0.1
Server:		127.0.0.1
Address:	127.0.0.1#8053

Non-authoritative answer:
Name:	sub.acme.com
Address: 172.17.0.4

<!-- gh-comment-id:1475038250 --> @mageddo commented on GitHub (Mar 19, 2023): ### EDIT Release notes: > ## 3.14.0 > * Support for regex on localdb solver and docker container hostname and HOSTNAMES env Hey @outdooracorn I'm proposing the support for regex on snapshot `3.14.1-snapshot` , can you give it a try and give a feedback? See the examples below: * ~~Be aware of the cache https://github.com/mageddo/dns-proxy-server/issues/376~~ `Fixed on 3.14.1-snapshot` * There is a [button][1] on the GUI to clear the cache Running a container ```bash $ docker run --rm --name nginx1 --hostname '/batata\.[a-z]+\.com/' -e 'HOSTNAMES=/\d+\.acme.com/,/sub.acme.com/' nginx ``` Solving ``` $ nslookup -po=8053 batata.whatever.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1#8053 Non-authoritative answer: Name: batata.whatever.com Address: 172.17.0.4 $ nslookup -po=8053 xpto.acme.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1#8053 ** server can't find xpto.acme.com: NXDOMAIN $ nslookup -po=8053 123.acme.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1#8053 Non-authoritative answer: Name: 123.acme.com Address: 172.17.0.4 $ nslookup -po=8053 sub.acme.com 127.0.0.1 Server: 127.0.0.1 Address: 127.0.0.1#8053 Non-authoritative answer: Name: sub.acme.com Address: 172.17.0.4 ``` [1]: https://user-images.githubusercontent.com/5281356/226152024-6e36318c-9ffb-4f16-9acf-99b853363b68.png
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#97
No description provided.