Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow (or guide on configuring) binding to several DNS names #43

Open
JonTheNiceGuy opened this issue Sep 23, 2023 · 1 comment
Open

Comments

@JonTheNiceGuy
Copy link

I want to resolve the AWS naming convention from my local machine. These addresses are in the format:

ip-192-0-2-1.ex-ampl-1.compute.internal

For example, ip-192-0-2-1.eu-west-1.compute.internal and ip-192-0-2-1.us-east-1.compute.internal

These both resolve to 192.0.2.1 (surprise! :) )

I have created my backend.conf for the region I mostly use (eu-west-1) as follows:

[main]
# main domain
domain=eu-west-1.compute.internal

# default ttl
ttl=432000

# default IP address for non-wildcard entries
ipaddress=127.0.0.1

# Indicates whether this response is authoritative, this is for DNSSEC.
auth=1

# Scopebits indicates how many bits from the subnet provided in the question.
bits=0

# SOA
[soa]
# serial number
id=1
# Hostmaster email address
[email protected]
# Name server
ns=ns1.compute.internal

# nameservers
[nameservers]
ns1.nip.io.example=127.0.0.1
ns2.nip.io.example=127.0.0.1

I've then configured dnsmasq on my network to forward eu-west-1.compute.internal to the docker container running this software, but I'd love to have it either respond to multiple domain names (e.g. ip-192-0-2-1.eu-west-1.compute.internal and ip-192-0-2-1.us-west-1.compute.internal) or respond to any DNS name matching a regex (e.g. .*.compute.internal)

Any thoughts? Happy to try to cobble together some code, if that'd help :)

@vanillajonathan
Copy link
Collaborator

I don't know but if you look at

nip.io/nipio/backend.py

Lines 241 to 247 in c1532cd

if (qtype == "A" or qtype == "ANY") and qname.endswith(self.domain):
if qname == self.domain:
self.handle_self(self.domain)
elif qname in self.name_servers:
self.handle_nameservers(qname)
else:
self.handle_subdomains(qname)

It looks like you might be able to insert an elif clause there to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants