diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0c627983f0..9ca64790b6 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -301,7 +301,7 @@ services: volumes: - ./app:/usr/src/code/app - ./src:/usr/src/code/src - dns: # Stand-in public resolver for the domain-verification tests (Proxy APIs) + dns: image: alpinelinux/unbound:latest@sha256:8d2611fe8fcbd8e26b6f88e2eb0c3b803368195d50cfa0c30fdfaa5087076709 container_name: appwrite-dns restart: unless-stopped @@ -310,11 +310,9 @@ services: options: max-file: "5" max-size: 10m - # The image entrypoint writes its own config; this fixture supplies one. entrypoint: ["unbound", "-d", "-c", "/mnt/resources/unbound.conf"] networks: appwrite: - # _APP_DNS points at this address. ipv4_address: 172.16.238.100 volumes: - ./tests/resources/dns:/mnt/resources:ro diff --git a/tests/resources/dns/forward.conf b/tests/resources/dns/forward.conf index 55bcf0b586..e3c44c8c4c 100644 --- a/tests/resources/dns/forward.conf +++ b/tests/resources/dns/forward.conf @@ -1,9 +1,4 @@ -# Everything outside the fake zones goes to Docker's embedded DNS, so compose -# service names resolve, with a public resolver as fallback for external names. - server: - # 127.0.0.11 is loopback inside this container; unbound refuses loopback - # upstreams unless told otherwise. do-not-query-localhost: no forward-zone: diff --git a/tests/resources/dns/unbound.conf b/tests/resources/dns/unbound.conf index 7bb079904f..21122b0e63 100644 --- a/tests/resources/dns/unbound.conf +++ b/tests/resources/dns/unbound.conf @@ -1,33 +1,12 @@ -# A stand-in for the public recursive resolver, used by the Proxy DNS -# verification tests to verify customer domains. Mirrors deploy/dns-mock in -# appwrite-labs/cloud. -# -# Unbound rather than CoreDNS because a recursive resolver is what the app -# thinks it is talking to: overrides are one `local-data` line per record -# (every RR type, no regex templates), and forwarding is the server's own job -# rather than a catch-all bolted inside an authoritative zone. -# -# zones.conf - the fake public zones. -# forward.conf - where every other query goes. - server: interface: 0.0.0.0 port: 53 do-ip6: no access-control: 0.0.0.0/0 allow - # Test fixture: log what was asked, and never cache a stale answer between - # test cases. verbosity: 1 log-queries: yes cache-max-ttl: 60 cache-min-ttl: 0 - # No `private-address` entries: the fake zones answer with reserved addresses - # on purpose, and the forwarder resolves compose service names to private - # IPs. Configuring any private range here would strip both as rebinding - # attacks. - # - # No DNSSEC either: the fake zones are unsigned, and validating the upstream - # chain would only add a network dependency to a fixture. val-permissive-mode: yes include: "/mnt/resources/zones.conf" diff --git a/tests/resources/dns/zones.conf b/tests/resources/dns/zones.conf index 5a9882ec87..7a1a8787ac 100644 --- a/tests/resources/dns/zones.conf +++ b/tests/resources/dns/zones.conf @@ -1,23 +1,7 @@ -# Fake public zones for the Proxy DNS verification tests. One line per record, -# so a case is added by adding the record it needs. -# -# Each test run prefixes its fixture hostnames with a unique label, so every -# fixture is a `redirect` zone: any name under it answers with the zone's own -# records. `static` zones answer only exact names; anything else under them is -# NXDOMAIN without a network round trip. -# -# Every zone that can answer negatively carries an SOA. utopia-php/dns rejects -# an authoritative negative answer (NXDOMAIN or NODATA) without an SOA in the -# authority section, and unbound only adds one when the zone defines it. CNAME -# zones cannot hold an SOA (a CNAME may not coexist with other data) and do not -# need one: every query type gets the CNAME, and the negative answer comes from -# the chased target's zone. - local-zone: "webapp.com." static local-data: "webapp.com. 60 IN SOA ns.webapp.com. hostmaster.webapp.com. 1 3600 600 86400 60" local-data: "webapp.com. 60 IN A 203.0.0.1" -# CNAME fixtures pointing at the configured platform targets. local-zone: "stage.webapp.com." redirect local-data: "stage.webapp.com. 60 IN CNAME cname.localhost." @@ -27,16 +11,13 @@ local-data: "stage-site.webapp.com. 60 IN CNAME sites.localhost." local-zone: "stage-function.webapp.com." redirect local-data: "stage-function.webapp.com. 60 IN CNAME cname.localhost." -# Verification must reject a CNAME pointing somewhere else. local-zone: "stage-wrong-cname.webapp.com." redirect local-data: "stage-wrong-cname.webapp.com. 60 IN CNAME cname-wrong.localhost." -# An A record matching the expected target. local-zone: "correct-a.webapp.com." redirect local-data: "correct-a.webapp.com. 60 IN SOA ns.webapp.com. hostmaster.webapp.com. 1 3600 600 86400 60" local-data: "correct-a.webapp.com. 60 IN A 203.0.0.1" -# CAA pair: one issuer the platform is not allowed to use, one it is. local-zone: "stage-wrong-caa.webapp.com." redirect local-data: "stage-wrong-caa.webapp.com. 60 IN SOA ns.webapp.com. hostmaster.webapp.com. 1 3600 600 86400 60" local-data: "stage-wrong-caa.webapp.com. 60 IN A 203.0.0.1" @@ -47,18 +28,10 @@ local-data: "stage-correct-caa.webapp.com. 60 IN SOA ns.webapp.com. hostmaster.w local-data: "stage-correct-caa.webapp.com. 60 IN A 203.0.0.1" local-data: 'stage-correct-caa.webapp.com. 60 IN CAA 0 issue "digicert.com"' -# An A record that does not match the expected target. local-zone: "wrong-a-webapp.com." redirect local-data: "wrong-a-webapp.com. 60 IN SOA ns.wrong-a-webapp.com. hostmaster.wrong-a-webapp.com. 1 3600 600 86400 60" local-data: "wrong-a-webapp.com. 60 IN A 203.0.0.5" -# The platform targets the fixtures point at live under localhost. When a -# fixture answers with a CNAME, unbound chases the target through its resolver -# path, which skips local-zone data and would otherwise ask the forwarder. The -# runner's Docker DNS answers any *.localhost with 127.0.0.1 and ::1, and ::1 -# is _APP_DOMAIN_TARGET_AAAA, so a wrong CNAME would verify. An auth-zone is -# consulted by that path: the empty zone makes every target NXDOMAIN with an -# SOA, locally. auth-zone: name: "localhost." zonefile: "/mnt/resources/localhost.zone"