mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 01:46:18 -05:00
captive portal: never forward any record type for probe hosts
`address=` only synthesizes A/AAAA answers. iOS also asks for the HTTPS record type; dnsmasq forwarded that upstream, Apple's answer aliased to captive.g.aaplimg.com, and the phone fetched the genuine "Success" from Apple instead of the portal. Each probe host now also gets `local=`, so dnsmasq answers every type itself, and the CDN alias is a probe host too. Observed with dnsmasq query logging on a hotspot with an eth0 uplink. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
85c27b91df
commit
66151df6c6
2 changed files with 15 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ logger = logging.getLogger(__name__)
|
|||
# wildcard would break the hotspot's forwarding of everything else to the WROLPi's uplink.
|
||||
PROBE_HOSTS = (
|
||||
'captive.apple.com', # iOS / macOS
|
||||
'captive.g.aaplimg.com', # the CDN name captive.apple.com aliases to
|
||||
'connectivitycheck.gstatic.com', # Android
|
||||
'connectivitycheck.android.com', # Android (older)
|
||||
'www.msftconnecttest.com', # Windows 10+
|
||||
|
|
@ -88,8 +89,11 @@ def render_dnsmasq_config(ip: str) -> str:
|
|||
'# Captive portal: captive-portal probe hostnames resolve to this WROLPi.',
|
||||
'# Only these names are hijacked so the hotspot still forwards everything else.',
|
||||
]
|
||||
lines.extend(f'address=/{host}/{ip}' for host in PROBE_HOSTS)
|
||||
lines.append(f'address=/{FRIENDLY_NAME}/{ip}')
|
||||
for host in (*PROBE_HOSTS, FRIENDLY_NAME):
|
||||
# `address=` only answers A/AAAA. Phones also ask for the HTTPS record type, and a
|
||||
# forwarded answer leads them to the real host; `local=` never forwards any type.
|
||||
lines.append(f'local=/{host}/')
|
||||
lines.append(f'address=/{host}/{ip}')
|
||||
return '\n'.join(lines) + '\n'
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue