blocky: iOS ignores `customDNS` responses when Extended DNS Errors (EDE) are enabled

I am testing out Blocky on my home network. Fairly straight forward setup, basically just using default config modified to suit my environment. I do use the customdns feature for local reverse proxy. All is well except on my iphone. When trying to hit my internal web apps. I get a “blocked by null” error using by chrome and safari on the iphone. I tested same sites using PC, Android Phones, and even an ipad(to rule out an iOS issue of some kind). Same sites are all working on any other device except my iphone. I also have technitium setup on my network as I was testing both out to see which I preferred. If I switch the iphone over to technitium the problem seems to go away and I can browse my internal apps without issue. So it’s not specifically the iphone or blocky causing the issue, seems to be a combination of the two.

I also tried paring down the config to just the basics i.e. removing the blocking/whitelist section etc. No change.

Here’s my block config(redacted my domain name and ip’s):

upstreams:
  groups:
    default:
      - tcp-tls:1.1.1.1:853
      - tcp-tls:1.0.0.1:853
  strategy: parallel_best
  timeout: 2s

startVerifyUpstream: true

connectIPVersion: dual

customDNS:
  customTTL: 1h
  filterUnmappedTypes: true
  mapping:
    example.com: 192.168.x.201

blocking:
  blackLists:
    ads:
      - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
      - http://sysctl.org/cameleon/hosts
      - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
    special:
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts
  whiteLists:
    ads:
      - /etc/blocky/whitelist.txt
  clientGroupsBlock:
    default:
      - ads
      - special
  blockType: nxDomain
  blockTTL: 1m
  loading:
    refreshPeriod: 24h
    downloads:
      timeout: 60s
      attempts: 5
      cooldown: 10s
    concurrency: 16
    strategy: failOnError
    maxErrorsPerSource: 5

caching:
  minTime: 5m
  maxTime: 30m
  maxItemsCount: 0
  prefetching: true
  prefetchExpires: 2h
  prefetchThreshold: 5
  prefetchMaxItemsCount: 0
  cacheTimeNegative: 30m

clientLookup:
  upstream: 192.168.x.1
  singleNameOrder:
    - 2
    - 1

prometheus:
  enable: true
  path: /metrics

minTlsServeVersion: 1.3

bootstrapDns:
  - tcp+udp:1.1.1.1
  - https://1.1.1.1/dns-query

ports:
  dns: 53
  tls: 853
  https: 443
  http: 4000

log:
  level: debug
  format: text
  timestamp: true
  privacy: false

ede:
  enable: true

specialUseDomains:
  rfc6762-appendixG: true

Here is what comes in the log, which looks ok:

[2023-11-25 15:24:42] INFO queryLog: query resolved answer= client_ip=192.168.x.143 client_names=192.168.x.143 duration_ms=0 hostname=blocky1 question_name=unifi.example.com. question_type=HTTPS response_code=NOERROR response_reason=CUSTOM DNS response_type=CUSTOMDNS

Here is error message browser shows on iphone:

Safari can't open the page "unifi.example.com" because it was blocked by "(null)"

Hoping someone smarter than me can help me out.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 57

Most upvoted comments

EDIT: I’ll wait for someone else to confirm the branch fixes the issue before making a PR.

@ThinkChaos Thanks for the fix! I built a docker image based on your branch and was successfully able to resolve the customDNS domains in question on my Apple devices while having ede: enabled: true (although there were some strange hiccups first on my iPad. But they went away after a another restart of the blocky containers, perhaps a caching issue; seems to be stable now).

So the bug is more on iOS’ side. If anyone has access to report a bug there that would be welcome, but let’s just say I’m not holding my breath on it being fixed.

Apple has a “Feedback” tool on all their platforms that’s pretty much a bug tracker. I’ve logged a bug there, but I’m not confident they’ll even notice or fix it. There’s a bunch of threads on the Apple Dev Forums where people complain about Apple ignoring bug reports for years. If somebody lucks out and finds an email for an Apple Engineer, especially one on the iOS/iPadOS core team (probably dealing with networking stuff), that might be a quicker way to get things sorted.

I can reproduce with ede: enable: true!
Thanks for persisting and finding that. I’m sorry I missed that originally because it’s in the config posted in the issue…

Looking into actually fixing this 😃

Tested with iOS 17.2 Blocky v0.23

To test, clear the blocky cache. Clear the iPad cache (toggle airplane mode off and on with a 10s gap) Then use a domain that points to an rfc1918 address without a trailing slashdot

HTTPS/SVCB filtered vs not filtered - no difference Single stack vs dual stack - no difference (tested with both ipv4 and ipv6) ede enabled vs ede disabled - Bingo! This was it.

It’s a little disappointing that I can’t use ede error codes if I want to be able to fully use my iPad, at least for now. But it’s nice to pin down a cause.

I started adding a config option to choose whether blocky adds EDE information if the query succeeded but noticed that we currently return “Forged Answer” for custom DNS entries.
Here’s how the RFC defines that:

For policy reasons (legal obligation or malware filtering, for instance), an answer was forged. Note that this should be used when an answer is still provided, not when failure codes are returned instead. See Blocked (15), Censored (16), and Filtered (17) for use when returning other response codes.

I think there’s some ambiguity here: blocky cannot say for sure if the data was forged since it doesn’t know if it’s replacing a real domain or just behaving more like an authoritative DNS server would.
And I think maybe iOS is interpreting that specific error code as “the server is hiding the real IP from you” and showing it as blocked. I didn’t have time to test that theory though.

EDIT: either way, I think there’s an iOS bug because the RFC says:

EDE information is unauthenticated information, unless secured by a form of secured DNS transaction […] As such, EDE content should be treated only as diagnostic information and MUST NOT alter DNS protocol processing.

And here disabling EDE does change iOS’ behavior.

Anyways just wanted to provide a quick update, whatever the solution is I want to have at least a workaround in the next release 😃

Since it’s most likely not a bug in blocky a workaround to compensate for a bug in a different software should be considered an enhancement.

Found the bug!

The EDE resolver adds the extra information even if the query was a success, but EDE is Extended DNS Errors. And iOS assumes that the response is an error, even though the rest of the data says it’s not, which is fair enough.
I’m not sure what the by (null) thing is, but still leaning towards it being an iOS bug.

Please give my fix/ios branch a shot and let me know if that works for you. It’s based on v0.23 with two minor changes. The one of interest here is https://github.com/ThinkChaos/blocky/commit/71993086d401f2924fde2ff3afa8b0dd7aceffb4.

Since blocky 0.23 or iOS 17.3, the problem no longer exists in my environment.

I had forgotten to check it after the blocky 0.23 update. But after the iOS 17.3 update and with both on the latest version, I checked the behavior again.

So I built a copy of blocky using @ThinkChaos commit. It unfortunately doesn’t fix the issue on the iphone, still getting the (null) error. However, the output in the dns utility looks the same for Technitium and Blocky now. Flags are the same and they are both returning MX and TXT records. But still something that doesn’t jive with the iphone. 😕

Did you maybe invert the two screenshots? Because the flags I got match the ones from the Technitium screenshot.

Yeah woops I did reverse the descriptions somehow. Good catch. Sorry bout that. I fixed it for future inquiries.

Here’s a custom blocky build: v0.23 with a patch to set the authoritative flag for customDNS responses. Please try it out to see if blocky and technitium now match, and more importantly if the issue is fixed 😃 blocky.gz

EDIT: here’s the commit I used if your curious or would like to build it yourself ThinkChaos@aeb47d9

Great. I will give it a try when I have a moment. Thanks!!

Any news on this issue? So far, for me the issue remains and applies for different Apple devices (iPhone 15 Pro/iOS 17.3, iPhone 13 Mini/iOS 17.2.1, and iPad Mini 6/iPadOS 17.0).

I discovered that there is a short moment directly after rebooting the device when it successfully resolves local domains. Then the used domain remains to work for some time until it goes back to the (null) error page.

The mentioned hacks with adding dots or slashes to the domain didn’t work for me, unfortunately.

As I’m running blocky in k3s, I cut off http/s access to the pods via the service to try if it could be related to iOS’s DNS Type 65 behaviour - no luck here either.

Still same for me. None of the “tricks” worked in my case either. Always get the (null) error on my iPhone.

I did run a DNS utility on my iphone to compare the differences when running Blocky vs Technitium DNS(which is working on iphone.) The only difference I noticed was the “flags” here’s a couple screenshots, both hitting the same internal domain.

This is running blocky:

image

This is running technitium:

image

Not sure if it is helpful but definitely a difference.

Here is a description of the flags:

Flags: AA = Authoritative Answer TC = Truncation RD = Recursion Desired (set in a query and copied into the response if recursion is supported) RA = Recursion Available (if set, denotes recursive query support is available) AD = Authenticated Data (for DNSSEC only; indicates that the data was authenticated) CD = Checking Disabled (DNSSEC only; disables checking at the receiving server)

The difference is the AA flag which appears on Blocky but not Technitium. Not sure whether that would make a difference though.

Update 2: I figured out something that works! Instead of using mydomain.xyz in the address bar, if I use mydomain.xyz/. it works flawlessly

Nice find! Does mydomain.xyz/ (without the period) work @h3mmy?

Only after getting the site to load with a dot first. All subsequent access is fine until some time has passed.

Rebooting the blocky container and my iPhone then did the trick for domains of that custom/conditional group that I haven’t tried before on my phone. However the one domain I tried before reconfiguring and rebooting still delivered the (null) error. So, I assume it’s local caching on the iPhone which keeps displaying that error and hopefully it will sort itself out once iPhone’s caches are flushed.

Interesting, thanks for chiming in. Weird thing on my end, if I simply switch DNS to my Technitium setup, the pages in question come right up so I am thinking it’s not a caching issue on the phone. It is indeed a bit of an odd issue. I may try spinning up a fresh Blocky install to see it if changes anything. Just gotta carve out some time to do it. 😃

Edit: Spun up a new instance, no change still getting the “null” error screen