From 3da127914c19fd1a286b9adb93b89dbab0e40b6f Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Mon, 28 Oct 2024 10:13:35 +0530 Subject: [PATCH] default port changed to 10053, docs updated --- .env => .env.example | 4 ---- .gitignore | 4 ++++ README.md | 34 +++++++++++++++++----------------- SECURITY.md | 4 ++-- docker-compose.yml | 6 +++--- docs/assets/md/docker.md | 12 ++++++------ kubernetes/README.md | 8 ++++---- pkg/config/config_test.go | 4 ++-- scripts/install.sh | 2 +- 9 files changed, 39 insertions(+), 39 deletions(-) rename .env => .env.example (95%) diff --git a/.env b/.env.example similarity index 95% rename from .env rename to .env.example index c0f41b5..fcc5ba2 100644 --- a/.env +++ b/.env.example @@ -4,10 +4,6 @@ DNS_PORT=10053 # Relay Configuration DNS_RELAY_SERVERS=8.8.8.8,1.1.1.1 -# API Configuration -DNS_API_PORT=8080 # Port for ACME HTTP API -DNS_API_TOKEN=1234 - # TTL Configuration (in seconds) DNS_DEFAULT_TTL=60 diff --git a/.gitignore b/.gitignore index 555c2fa..caaf3de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ nanodns .DS_Store + +.env +.env.local +!.env.example \ No newline at end of file diff --git a/README.md b/README.md index 6602130..ba31786 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ chmod +x nanodns-darwin-arm64 | Variable | Description | Default | Example | |----------|-------------|---------|---------| -| DNS_PORT | UDP port for DNS server | 53 | 5353 | +| DNS_PORT | UDP port for DNS server | 53 | 10053 | | DNS_RELAY_SERVERS | Comma-separated upstream DNS servers | - | 8.8.8.8:53,1.1.1.1:53 | | A_xxx | A Record Details | - | - | | CNAME_xxx | CNAME Record Details | - | - | @@ -121,7 +121,7 @@ A_REC2=domain|service:servicename|ttl ``` Example: ``` -A_REC1=app.example.com|192.168.1.10|300 +A_REC1=app.example.com|10.10.0.1|300 A_REC2=api.example.com|service:webapp ``` @@ -164,10 +164,10 @@ TXT_REC2=_dmarc.example.com|v=DMARC1; p=reject; rua=mailto:dmarc@example.com ```bash docker run -d \ --name nanodns \ - -p 5353:5353/udp \ - -e DNS_PORT=5353 \ + -p 10053:10053/udp \ + -e DNS_PORT=10053 \ -e DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 \ # Optional relay configuration - -e "A_REC1=app.example.com|192.168.1.10|300" \ + -e "A_REC1=app.example.com|10.10.0.1|300" \ -e "A_REC2=api.example.com|service:webapp" \ -e "TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all" \ ghcr.io/mguptahub/nanodns:latest @@ -182,15 +182,15 @@ services: image: ghcr.io/mguptahub/nanodns:latest environment: # DNS Server Configuration - - DNS_PORT=5353 # Optional, defaults to 53 + - DNS_PORT=10053 # Optional, defaults to 53 - DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 # Optional relay servers # Local Records - A_REC1=app.example.com|service:webapp - - A_REC2=api.example.com|192.168.1.10|300 + - A_REC2=api.example.com|10.10.0.5|300 - TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all ports: - - "${DNS_PORT:-5353}:${DNS_PORT:-5353}/udp" + - "${DNS_PORT:-10053}:${DNS_PORT:-10053}/udp" networks: - app_network @@ -207,9 +207,9 @@ For detailed instructions on deploying NanoDNS in Kubernetes, see our [Kubernete ```bash # Set environment variables -export DNS_PORT=5353 +export DNS_PORT=10053 export DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 -export A_REC1=app.example.com|192.168.1.10 +export A_REC1=app.example.com|10.10.0.7 export TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all # Run the server @@ -220,26 +220,26 @@ export TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all ```bash # Test local records -dig @localhost -p 5353 app.example.com A +dig @localhost -p 10053 app.example.com A # Test relay resolution (for non-local domains) -dig @localhost -p 5353 google.com A +dig @localhost -p 10053 google.com A # Test other record types -dig @localhost -p 5353 www.example.com CNAME -dig @localhost -p 5353 example.com MX -dig @localhost -p 5353 example.com TXT +dig @localhost -p 10053 www.example.com CNAME +dig @localhost -p 10053 example.com MX +dig @localhost -p 10053 example.com TXT ``` ## Common Issues and Solutions 1. Port 53 already in use (common on macOS and Linux): - - Use a different port by setting `DNS_PORT=5353` or another available port + - Use a different port by setting `DNS_PORT=10053` or another available port - Update your client configurations to use the custom port 2. Permission denied when using port 53: - Use a port number above 1024 to avoid requiring root privileges - - Set `DNS_PORT=5353` or another high-numbered port + - Set `DNS_PORT=10053` or another high-numbered port 3. DNS Relay Issues: - Verify upstream DNS servers are accessible diff --git a/SECURITY.md b/SECURITY.md index bb566ff..95923f3 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -152,7 +152,7 @@ Verify the authenticity of releases: 1. **Local Development** ```bash # Use non-privileged ports - export DNS_PORT=5353 + export DNS_PORT=10053 # Keep environment files secure chmod 600 .env @@ -191,7 +191,7 @@ Verify the authenticity of releases: - no-new-privileges:true read_only: true environment: - - DNS_PORT=5353 + - DNS_PORT=10053 ``` 2. **Kubernetes** diff --git a/docker-compose.yml b/docker-compose.yml index c0f2d8e..d8fce82 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,11 +4,11 @@ services: dns: build: . environment: - - DNS_PORT=5353 + - DNS_PORT=10053 # A Records (domain|ip[|ttl]) - A_REC1=app.example.com|service:webapp - A_REC2=api.example.com|service:api|120 - - A_REC3=static.example.com|192.168.1.10|300 + - A_REC3=static.example.com|10.10.0.1|300 # CNAME Records (domain|target[|ttl]) - CNAME_REC1=www.example.com|app.example.com @@ -22,7 +22,7 @@ services: - TXT_REC2=_dmarc.example.com|v=DMARC1; p=reject; rua=mailto:dmarc@example.com|3600 - TXT_REC3=_acme-challenge.example.com|validation-token-here|60 ports: - - "5353:5353/udp" + - "10053:10053/udp" networks: - app_network diff --git a/docs/assets/md/docker.md b/docs/assets/md/docker.md index 00e5269..727385c 100644 --- a/docs/assets/md/docker.md +++ b/docs/assets/md/docker.md @@ -4,10 +4,10 @@ ```bash docker run -d \ --name nanodns \ - -p 5353:5353/udp \ - -e DNS_PORT=5353 \ + -p 10053:10053/udp \ + -e DNS_PORT=10053 \ -e DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 \ - -e "A_REC1=app.example.com|192.168.1.10|300" \ + -e "A_REC1=app.example.com|10.10.0.1|300" \ -e "TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all" \ ghcr.io/mguptahub/nanodns:latest ``` @@ -20,15 +20,15 @@ services: dns: image: ghcr.io/mguptahub/nanodns:latest environment: - - DNS_PORT=5353 # Optional, defaults to 53 + - DNS_PORT=10053 # Optional, defaults to 53 - DNS_RELAY_SERVERS=8.8.8.8:53,1.1.1.1:53 # A Records - A_REC1=app.example.com|service:webapp - - A_REC2=api.example.com|192.168.1.10|300 + - A_REC2=api.example.com|10.10.0.10|300 # TXT Records - TXT_REC1=example.com|v=spf1 include:_spf.example.com ~all ports: - - "${DNS_PORT:-5353}:${DNS_PORT:-5353}/udp" # Uses DNS_PORT if set, otherwise 5353 + - "${DNS_PORT:-10053}:${DNS_PORT:-10053}/udp" # Uses DNS_PORT if set, otherwise 10053 networks: - app_network diff --git a/kubernetes/README.md b/kubernetes/README.md index 953a0f0..d99196c 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -36,7 +36,7 @@ data: # A Records A_REC1: "app.example.com|service:frontend.default.svc.cluster.local" A_REC2: "api.example.com|service:backend.default.svc.cluster.local" - A_REC3: "static.example.com|192.168.1.10|300" + A_REC3: "static.example.com|10.10.0.1|300" # CNAME Records CNAME_REC1: "www.example.com|app.example.com|3600" @@ -156,7 +156,7 @@ data: DNS_RELAY_SERVERS: "8.8.8.8:53,1.1.1.1:53" # Custom port example - DNS_RELAY_SERVERS: "custom.dns.server:5353,8.8.8.8:53" + DNS_RELAY_SERVERS: "custom.dns.server:10053,8.8.8.8:53" ``` When using multiple servers: @@ -178,7 +178,7 @@ kubectl patch configmap nanodns-config --type merge -p ' { "data": { "A_REC1": "app.example.com|service:frontend.default.svc.cluster.local", - "A_REC2": "api.example.com|192.168.1.10|300" + "A_REC2": "api.example.com|10.10.0.2|300" } }' ``` @@ -202,7 +202,7 @@ kubectl rollout status deployment/nanodns A_REC1: "app.example.com|service:frontend.default.svc.cluster.local" # External IP with TTL -A_REC2: "api.example.com|192.168.1.10|300" +A_REC2: "api.example.com|25.35.45.55|300" # Simple internal IP A_REC3: "internal.example.com|10.0.0.50" diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 43a3ca9..ba4bea4 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -23,8 +23,8 @@ func TestGetDNSPort(t *testing.T) { }, { name: "custom port", - envValue: "5353", - want: "5353", + envValue: "10053", + want: "10053", }, } diff --git a/scripts/install.sh b/scripts/install.sh index 0598504..198790a 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -52,7 +52,7 @@ DNS_PORT=53 # DNS Records # Format: domain|value|ttl # Examples: -# A_REC1=app.local|192.168.1.10|300 +# A_REC1=app.local|10.10.0.3|300 # A_REC2=api.local|service:myservice # CNAME_REC1=www.local|app.local # MX_REC1=local|10|mail.local