Relayed connection to exit node with aliases enabled sends DNS while tunnel isn't ready yet

Đang mở
#69 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
mobile, networking

Hướng nghiên cứu

Start by tracing how the Android client sets up DNS override and tunnel DNS while connecting through a relay; the issue does not name source files or tests. Use the provided reproduction steps with aliases enabled and force relay mode by blocking the handshake response. Done means the client connects through the relay and resolves the Pangolin domain without sending DNS through the tunnel before it is ready.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the Bug

When you attempt to connect to your Pangolin server while on a more restricted network, the direct WireGuard connection to the exit node might fail and requires you to use relay mode.

However, it seems to get stuck for me on the "registering" step. Looking closer at the logs it seems like the Pangolin client is trying to resolve the Pangolin domain through the tunnel, which isn't ready yet, causing the request to timeout and it never connects.

My phone is able to connect if I'm connected via mobile data, as then it manages to get a direct connection to the exit node. Strangely enough if I attempt to connect to the same exit node using the same DNS settings on my Macbook, which is on the same restricted network, it can connect via relay mode, indicating the server configuration is correct.

I also double checked if it wasn't an IPv4 vs IPv6 issue, but the restricted network I tested on doesn't have a public IPv6 address, so both my phone and Macbook connected via IPv4.

Entire log file: pangolin_cleaned.log
This log file is generated while my phone was connected to mobile data, with the Newt exit node having the iptables reproduce method enabled.

Some parts of this log have been replaced with the following dummy values:

  • Organization ID: example
  • Pangolin domain: pangolin.example.net
  • Pangolin server IP: 111.111.111.111
  • Exit node server IP: 222.222.222.222

Relevant logs snippet:

2026-11-18 19:37:15.124 [WARN] PangolinGo: olm: giving up on olm/wg/relay for site 3 (chain ed2dad0583be6711) after 10 attempts
2026-11-18 19:37:15.125 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:15.127 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:17.125 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:17.126 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:17.456 [DEBUG] PangolinGo: DNS query for pangolin.example.net. (type AAAA)
2026-11-18 19:37:17.457 [DEBUG] PangolinGo: No local record for pangolin.example.net., forwarding upstream to [10.70.0.20:53 10.70.0.20:53]
2026-11-18 19:37:17.457 [DEBUG] PangolinGo: DNS query for pangolin.example.net. (type A)
2026-11-18 19:37:17.457 [DEBUG] PangolinGo: wireguard: peer(o+Dd…Zgj0) - Sending handshake initiation
2026-11-18 19:37:17.457 [DEBUG] PangolinGo: No local record for pangolin.example.net., forwarding upstream to [10.70.0.20:53 10.70.0.20:53]
2026-11-18 19:37:19.124 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:19.125 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:19.458 [DEBUG] PangolinGo: Primary DNS failed, trying secondary: failed to read response: read udp 100.90.128.3:30778: i/o timeout
2026-11-18 19:37:19.458 [DEBUG] PangolinGo: Primary DNS failed, trying secondary: failed to read response: read udp 100.90.128.3:33252: i/o timeout
2026-11-18 19:37:21.124 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:21.125 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:21.460 [ERROR] PangolinGo: Both DNS servers failed: failed to read response: read udp 100.90.128.3:39103: i/o timeout
2026-11-18 19:37:21.461 [ERROR] PangolinGo: Failed to get DNS response for pangolin.example.net.
2026-11-18 19:37:21.461 [ERROR] PangolinGo: Both DNS servers failed: failed to read response: read udp 100.90.128.3:64134: i/o timeout
2026-11-18 19:37:21.461 [ERROR] PangolinGo: Failed to get DNS response for pangolin.example.net.
2026-11-18 19:37:22.461 [DEBUG] PangolinGo: DNS query for pangolin.example.net. (type AAAA)
2026-11-18 19:37:22.462 [DEBUG] PangolinGo: No local record for pangolin.example.net., forwarding upstream to [10.70.0.20:53 10.70.0.20:53]
2026-11-18 19:37:22.462 [DEBUG] PangolinGo: DNS query for pangolin.example.net. (type A)
2026-11-18 19:37:22.462 [DEBUG] PangolinGo: No local record for pangolin.example.net., forwarding upstream to [10.70.0.20:53 10.70.0.20:53]
2026-11-18 19:37:22.462 [DEBUG] PangolinGo: wireguard: peer(o+Dd…Zgj0) - Sending handshake initiation
2026-11-18 19:37:23.124 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:23.125 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:24.464 [DEBUG] PangolinGo: Primary DNS failed, trying secondary: failed to read response: read udp 100.90.128.3:42782: i/o timeout
2026-11-18 19:37:24.464 [DEBUG] PangolinGo: Primary DNS failed, trying secondary: failed to read response: read udp 100.90.128.3:56227: i/o timeout
2026-11-18 19:37:25.126 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:25.127 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:26.465 [ERROR] PangolinGo: Both DNS servers failed: failed to read response: read udp 100.90.128.3:54710: i/o timeout
2026-11-18 19:37:26.466 [ERROR] PangolinGo: Failed to get DNS response for pangolin.example.net.
2026-11-18 19:37:26.466 [ERROR] PangolinGo: Both DNS servers failed: failed to read response: read udp 100.90.128.3:35217: i/o timeout
2026-11-18 19:37:26.466 [ERROR] PangolinGo: Failed to get DNS response for pangolin.example.net.
2026-11-18 19:37:27.124 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:27.125 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:27.468 [ERROR] PangolinGo: Failed to resolve primary relay endpoint for site 3: DNS lookup failed using all upstream servers: lookup pangolin.example.net on [::1]:53: read udp 100.90.128.3:34256->84.241.227.81:53: i/o timeout
2026-11-18 19:37:27.469 [DEBUG] PangolinGo: websocket: setting config version to 0
2026-11-18 19:37:27.469 [DEBUG] PangolinGo: Received relay-peer message: map[chainIds:[ee733d283687444e] relayEndpoints:[pangolin.example.net] relayPort:21820 siteIds:[3]]
2026-11-18 19:37:27.469 [WARN] PangolinGo: CancelRelaySend: no active sender for chain ee733d283687444e
2026-11-18 19:37:27.470 [DEBUG] PangolinGo: wireguard: peer(o+Dd…Zgj0) - Sending handshake initiation
2026-11-18 19:37:29.125 [DEBUG] PangolinGo: websocket: Sending message: olm/wg/relay, data: map[chainIds:[aeb106ebcf51aab6] siteIds:[3]]
2026-11-18 19:37:29.127 [INFO] PangolinGo: olm: sent batched olm/wg/relay for 1 site(s)
2026-11-18 19:37:29.513 [INFO] PangolinGo: Holepunch to site 3 failed 10 times, triggering relay
2026-11-18 19:37:29.514 [INFO] PangolinGo: Queued relay message for site 3 (chain cbc97e63a19bcca5)
2026-11-18 19:37:29.715 [WARN] PangolinGo: olm: giving up on olm/wg/relay for site 3 (chain aeb106ebcf51aab6) after 10 attempts
Environment
  • OS Type & Version: LineageOS 23.2 (Android 16) on a Google Pixel 6
  • Pangolin Version: 1.25.3
  • Edition (Community or Enterprise): Enterprise (Personal)
  • Gerbil Version: 1.5.2
  • Traefik Version: 3.7
  • Newt Version: 1.19 via Docker
  • Client Version: Android 0.8.3 from Play Store, compared against macOS 0.12.2 installed via Brew
To Reproduce

Please note that we will need to force the relay path for this issue, it doesn't seem to happen with direct connections to the site that is used as an exit node.

  1. Set up a site (Newt running via Docker in my case) with an exit node, and give the user access.
  2. On the Android client, set an upstream DNS server (PiHole server accessible from LAN in my case), enable "Enable Aliases (DNS override)" and "DNS over tunnel", and select the exit node.
  3. Put the phone on mobile data and note its public IP.
  4. On the Newt host that will act as the exit node, temporarily block the handshake response from reaching the phone in order to force relay mode:
   sudo iptables -I DOCKER-USER -p udp -d <phone public IP> -j DROP
  1. Attempt to connect with the Android client.
  2. Observed: the client gets stuck at "Registering". The client log shows the relay-peer message, followed by the failed relay endpoint lookup from the tunnel IP. The Newt log repeatedly shows "Removing Endpoint for peer ..." (relay mode), but no traffic from the client arrives
  3. Disable "Enable Aliases (DNS override)" option
  4. Attempt to connect again: the client connects after a relatively long wait (about 20 seconds until the DNS timeout)

If it helps, here is a blueprint you can use:

 - "pangolin.private-resources.example-site-exit-node.enabled=true"
 - "pangolin.private-resources.example-site-exit-node.name=Example site Exit Node"
 - "pangolin.private-resources.example-site-exit-node.mode=exit-node"
 - "pangolin.private-resources.example-site-exit-node.sites[0]=example-site"
 - "pangolin.private-resources.example-site-exit-node.roles[0]=Home Exit Node"

 # This didn't make a difference for me, but the app did specifically mention you should add the DNS server as a resource
 - "pangolin.private-resources.example-site-pihole.enabled=true"
 - "pangolin.private-resources.example-site-pihole.name=Example site PiHole"
 - "pangolin.private-resources.example-site-pihole.mode=host"
 - "pangolin.private-resources.example-site-pihole.destination=10.70.0.20" # This should point to the IP of the DNS server on the LAN that the exit node can access
 - "pangolin.private-resources.example-site-pihole.tcp-ports=53-53" # Also potentially another bug? Pangolin refuses the blueprint if just `53` was entered, so we use a range instead and then it does accept it
 - "pangolin.private-resources.example-site-pihole.udp-ports=53-53"
 - "pangolin.private-resources.example-site-pihole.disable-icmp=false"
 - "pangolin.private-resources.example-site-pihole.sites[0]=example-site"
 - "pangolin.private-resources.example-site-pihole.roles[0]=Home Exit Node"

And the following settings have been used inside the Pangolin client:
Screenshot_20261119-004138_Pangolin

AI Disclosure

Claude was used to help troubleshoot the issue and process the log files.
It has also been used to come up with a more easily reproducible setup, which I was able to verify by triggering this issue from a network I know was able to connect to my Pangolin instance.

This issue report was written completely by hand and validated manually.

If the issue is difficult to reproduce for you guys, I'm able to verify if a potential fix also actually fixes it in my case.

Expected Behavior

When enabling the connection inside the Pangolin app with an exit node active and custom DNS server configured in the settings, it can connect to the exit node and also perform queries to the custom DNS server, even when the connection is in relay mode.

Ngôn ngữ chính
Kotlin
Star
46
Fork
15
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fosrl/android

Tất cả issue của fosrl/android

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.