[GH-ISSUE #3381] feat: keep domain and wildcard split-tunneling rules current during an active VPN session #3240

Open
opened 2026-11-07 17:58:02 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @makkoar on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3381

Feature request

I want to enter a domain once and have it continue following the selected split-tunneling policy when its IP addresses change, without editing the list or reconnecting the VPN. I also want rules such as *.example.com for subdomains.

A domain should remain the rule's identity. Addresses resolved when it was added or at connection time must not become a permanent substitute for that rule.

My immediate use case is Windows with WireGuard/AmneziaWG, in both sites-only and all-sites-except-listed modes.

Expected behavior

  • An exact rule such as example.com follows changes to that hostname's DNS addresses during an active session.
  • A wildcard rule such as *.example.com matches real queried subdomains, including nested ones, without enumerating them in advance.
  • Proposed wildcard semantics: match api.example.com and a.b.example.com, not example.com, notexample.com or example.com.evil.test. Add the apex separately when needed.
  • Handle multiple addresses and CNAME chains, and keep mappings/routes current with DNS lifetime and network changes.
  • Establish the selected routing policy before the application uses a newly resolved address, without restarting the tunnel or disrupting unrelated connections.
  • Preserve literal IP/CIDR rules, local hosts mappings and import/export of the domain or mask itself.
  • Show resolution/application failures instead of silently presenting a stale rule as current.

A wildcard is a routing-rule pattern, not a request to resolve the literal hostname *.example.com. It also does not automatically include unrelated CDN domains used by a page.

Acceptance scenarios

  1. Add an exact domain whose DNS answer initially points to address A.
  2. Keep the VPN connected, change the answer to B, and let the previous DNS answer expire.
  3. A new connection to that domain must follow the same configured policy through B, without deleting/re-adding the rule or reconnecting.
  4. Add *.example.com, then request a previously unseen subdomain. The first connection after its DNS response must follow the wildcard rule.
  5. Repeat for both site-routing modes, multiple DNS answers, CNAME targets, temporary DNS failures, changed networks and rule removal.
  6. Verify that a shared address is not removed while another rule still needs it, and define safe handling of cached answers and existing connections.

These are acceptance requirements. The implementation PR below documents which scenarios are covered by isolated tests and which still require on-device verification.

Design constraints

A local DNS handler is a possible foundation, but simply periodically resolving known hostnames is insufficient for previously unseen wildcard subdomains.

DNS-to-IP routes also have a shared-IP limitation: unrelated hostnames on the same address cannot be distinguished by an ordinary IP route. The design must explicitly distinguish dynamic IP-based exclusions from strict per-domain connection routing; stronger isolation may need a domain-aware traffic path.

Applications using their own encrypted DNS can bypass a local DNS handler. Do not silently disable browser Secure DNS/DoH or intercept/decrypt HTTPS. Document supported DNS paths and any required opt-in configuration. IPv6 support or limitations must also be explicit, rather than letting AAAA traffic silently ignore the rule.

DNS updates must respect the chosen direct/tunnel resolver policy and must not introduce unintended DNS leaks.

  • #1217 asks the same underlying question about changed IPs in Windows exclusions.
  • #1423 is the broader site-split-tunneling feature tracker; its DNS-refresh discussion overlaps this request.
  • #3376 / #3380 address normalization and refresh before connection/reconnection. They do not implement continuous live updates or wildcard discovery.
  • Project tracker: #3378.

Verification note: the first CTest domain-suite run failed; subsequent standalone and full-suite runs passed without code changes. The initial failure remains unexplained; see #3383.

Implementation: #3383 adds an opt-in domain-aware path for Windows WireGuard/AmneziaWG. It uses the bundled core locally; no Xray server or key is required, and browser Secure DNS settings are not changed. The PR is rebased onto release 5.1.0.6. A refreshed combined client/service/installer build and five isolated test suites passed. Real TUN activation, WFP/kill-switch behavior, network transitions and disconnect cleanup still require on-device acceptance; the PR describes these limits explicitly.

Originally created by @makkoar on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3381 ## Feature request I want to enter a domain once and have it continue following the selected split-tunneling policy when its IP addresses change, without editing the list or reconnecting the VPN. I also want rules such as `*.example.com` for subdomains. A domain should remain the rule's identity. Addresses resolved when it was added or at connection time must not become a permanent substitute for that rule. My immediate use case is Windows with WireGuard/AmneziaWG, in both sites-only and all-sites-except-listed modes. ## Expected behavior - An exact rule such as `example.com` follows changes to that hostname's DNS addresses during an active session. - A wildcard rule such as `*.example.com` matches real queried subdomains, including nested ones, without enumerating them in advance. - Proposed wildcard semantics: match `api.example.com` and `a.b.example.com`, not `example.com`, `notexample.com` or `example.com.evil.test`. Add the apex separately when needed. - Handle multiple addresses and CNAME chains, and keep mappings/routes current with DNS lifetime and network changes. - Establish the selected routing policy before the application uses a newly resolved address, without restarting the tunnel or disrupting unrelated connections. - Preserve literal IP/CIDR rules, local hosts mappings and import/export of the domain or mask itself. - Show resolution/application failures instead of silently presenting a stale rule as current. A wildcard is a routing-rule pattern, not a request to resolve the literal hostname `*.example.com`. It also does not automatically include unrelated CDN domains used by a page. ## Acceptance scenarios 1. Add an exact domain whose DNS answer initially points to address A. 2. Keep the VPN connected, change the answer to B, and let the previous DNS answer expire. 3. A new connection to that domain must follow the same configured policy through B, without deleting/re-adding the rule or reconnecting. 4. Add `*.example.com`, then request a previously unseen subdomain. The first connection after its DNS response must follow the wildcard rule. 5. Repeat for both site-routing modes, multiple DNS answers, CNAME targets, temporary DNS failures, changed networks and rule removal. 6. Verify that a shared address is not removed while another rule still needs it, and define safe handling of cached answers and existing connections. These are acceptance requirements. The implementation PR below documents which scenarios are covered by isolated tests and which still require on-device verification. ## Design constraints A local DNS handler is a possible foundation, but simply periodically resolving known hostnames is insufficient for previously unseen wildcard subdomains. DNS-to-IP routes also have a shared-IP limitation: unrelated hostnames on the same address cannot be distinguished by an ordinary IP route. The design must explicitly distinguish dynamic IP-based exclusions from strict per-domain connection routing; stronger isolation may need a domain-aware traffic path. Applications using their own encrypted DNS can bypass a local DNS handler. Do not silently disable browser Secure DNS/DoH or intercept/decrypt HTTPS. Document supported DNS paths and any required opt-in configuration. IPv6 support or limitations must also be explicit, rather than letting AAAA traffic silently ignore the rule. DNS updates must respect the chosen direct/tunnel resolver policy and must not introduce unintended DNS leaks. ## Related work - #1217 asks the same underlying question about changed IPs in Windows exclusions. - #1423 is the broader site-split-tunneling feature tracker; its [DNS-refresh discussion](https://github.com/amnezia-vpn/amnezia-client/issues/1423#issuecomment-5131614693) overlaps this request. - #3376 / #3380 address normalization and refresh before connection/reconnection. They do not implement continuous live updates or wildcard discovery. - Project tracker: #3378. Verification note: the first CTest domain-suite run failed; subsequent standalone and full-suite runs passed without code changes. The initial failure remains unexplained; see #3383. Implementation: #3383 adds an opt-in domain-aware path for Windows WireGuard/AmneziaWG. It uses the bundled core locally; no Xray server or key is required, and browser Secure DNS settings are not changed. The PR is rebased onto release `5.1.0.6`. A refreshed combined client/service/installer build and five isolated test suites passed. Real TUN activation, WFP/kill-switch behavior, network transitions and disconnect cleanup still require on-device acceptance; the PR describes these limits explicitly.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3240
No description provided.