[GH-ISSUE #5264] [Bug]: Node traffic sync ignores TLS verify mode skip/pin for self-signed certificates #3686

Closed
opened 2026-10-31 20:34:14 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @wangzhijie0602 on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5264

Describe the bug

When a remote node uses a self-signed TLS certificate, the node connection test works after setting TLS verify mode to skip or pin.

However, the background node traffic sync job still fails with:

the master node error log is:
WARNING - node traffic sync: fetch from SixtyNet failed: GET panel/api/inbounds/list: Get "https://1.2.3.4:8443/T6qP3mV8xK2rN7sL/panel/api/inbounds/list": tls: failed to verify certificate: x509: certificate signed by unknown authority

The slave node error log is:
813c8d019e64_3xui_app | 2026/06/13 11:10:10 http: TLS handshake error from 2.3.4.5:32884: remote error: tls: bad certificate

It appears that the background traffic sync request does not honor the per-node TLS verification mode.

How to reproduce the problem

  1. Configure a remote node panel with a self-signed TLS certificate.
  2. Add the node to the main panel.
  3. Set TLS verify mode to skip or pin.
  4. Confirm that the node connection test succeeds.
  5. Check the main panel logs.

Expected behavior

The node traffic sync job should use the selected TLS verify mode.

Actual behavior

The traffic sync job still verifies the certificate using the system CA store and fails with x509: certificate signed by unknown authority.

Relevant logs


Screenshots

No response

3x-ui version

3.1.1

Xray-core version

26.6.1

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Debain 13

Which parts of the panel are affected?

Multi-node (sub-nodes)

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @wangzhijie0602 on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5264 ### Describe the bug When a remote node uses a self-signed TLS certificate, the node connection test works after setting TLS verify mode to `skip` or `pin`. However, the background node traffic sync job still fails with: the master node error log is: WARNING - node traffic sync: fetch from SixtyNet failed: GET panel/api/inbounds/list: Get "https://1.2.3.4:8443/T6qP3mV8xK2rN7sL/panel/api/inbounds/list": tls: failed to verify certificate: x509: certificate signed by unknown authority The slave node error log is: 813c8d019e64_3xui_app | 2026/06/13 11:10:10 http: TLS handshake error from 2.3.4.5:32884: remote error: tls: bad certificate It appears that the background traffic sync request does not honor the per-node TLS verification mode. ### How to reproduce the problem 1. Configure a remote node panel with a self-signed TLS certificate. 2. Add the node to the main panel. 3. Set TLS verify mode to `skip` or `pin`. 4. Confirm that the node connection test succeeds. 5. Check the main panel logs. ### Expected behavior The node traffic sync job should use the selected TLS verify mode. ### Actual behavior The traffic sync job still verifies the certificate using the system CA store and fails with `x509: certificate signed by unknown authority`. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.1.1 ### Xray-core version 26.6.1 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Debain 13 ### Which parts of the panel are affected? Multi-node (sub-nodes) ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:34:14 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 13, 2026):

This is a confirmed bug. The node connection test and all background jobs (traffic sync, config reconcile, IP sync) use different HTTP clients, and only the connection test client honors the per-node TLS verification mode.

Root cause

internal/web/service/node.go contains nodeHTTPClientFor() (lines 61–95), which builds an http.Client that respects TlsVerifyMode (verify/skip/pin) and the PinnedCertSha256 field on the node model. NodeService.Probe() — the function behind the connection test button — calls nodeHTTPClientFor(n) directly, so it works correctly with self-signed certificates.

All background remote operations (traffic snapshot fetches, config reconcile, IP sync, global traffic pushes) go through Remote.do() in internal/web/runtime/remote.go. That method uses a package-level singleton:

var remoteHTTPClient = &http.Client{
    Transport: &http.Transport{
        MaxIdleConns:        64,
        MaxIdleConnsPerHost: 4,
        IdleConnTimeout:     60 * time.Second,
        DialContext:         netsafe.SSRFGuardedDialContext,
    },
}

No TLSClientConfig is set on that transport. The Remote struct does hold the full *model.Node (including TlsVerifyMode and PinnedCertSha256), but Remote.do() never consults those fields — it always calls remoteHTTPClient.Do(req), so Go's default certificate verification against the system CA store is used for every background call, regardless of the configured mode.

The error in the logs is exactly what Go returns when this default verification fails against a self-signed certificate:

tls: failed to verify certificate: x509: certificate signed by unknown authority

Affected operations

Every call routed through Remote.do():

  • FetchTrafficSnapshot (inbound list, online clients, last-online)
  • ReconcileNode (add/update/delete inbounds on the node)
  • FetchAllClientIps / PushAllClientIps
  • PushGlobalClientTraffics
  • UpdatePanel, RestartXray, GetWebCertFiles, GetDescendants

The heartbeat job is unaffected because it calls NodeService.Probe(), which does use nodeHTTPClientFor().

Fix path

The Remote type already carries the node's TLS settings. Remote.do() needs to select an HTTP client based on r.node.TlsVerifyMode and r.node.PinnedCertSha256, using the same logic as nodeHTTPClientFor(). The most straightforward approach is to build and cache a per-Remote HTTP client at construction time in NewRemote(), rather than relying on the shared singleton.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4697914248 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): This is a confirmed bug. The node connection test and all background jobs (traffic sync, config reconcile, IP sync) use different HTTP clients, and only the connection test client honors the per-node TLS verification mode. **Root cause** `internal/web/service/node.go` contains `nodeHTTPClientFor()` (lines 61–95), which builds an `http.Client` that respects `TlsVerifyMode` (`verify`/`skip`/`pin`) and the `PinnedCertSha256` field on the node model. `NodeService.Probe()` — the function behind the connection test button — calls `nodeHTTPClientFor(n)` directly, so it works correctly with self-signed certificates. All background remote operations (traffic snapshot fetches, config reconcile, IP sync, global traffic pushes) go through `Remote.do()` in `internal/web/runtime/remote.go`. That method uses a package-level singleton: ```go var remoteHTTPClient = &http.Client{ Transport: &http.Transport{ MaxIdleConns: 64, MaxIdleConnsPerHost: 4, IdleConnTimeout: 60 * time.Second, DialContext: netsafe.SSRFGuardedDialContext, }, } ``` No `TLSClientConfig` is set on that transport. The `Remote` struct does hold the full `*model.Node` (including `TlsVerifyMode` and `PinnedCertSha256`), but `Remote.do()` never consults those fields — it always calls `remoteHTTPClient.Do(req)`, so Go's default certificate verification against the system CA store is used for every background call, regardless of the configured mode. The error in the logs is exactly what Go returns when this default verification fails against a self-signed certificate: ``` tls: failed to verify certificate: x509: certificate signed by unknown authority ``` **Affected operations** Every call routed through `Remote.do()`: - `FetchTrafficSnapshot` (inbound list, online clients, last-online) - `ReconcileNode` (add/update/delete inbounds on the node) - `FetchAllClientIps` / `PushAllClientIps` - `PushGlobalClientTraffics` - `UpdatePanel`, `RestartXray`, `GetWebCertFiles`, `GetDescendants` The heartbeat job is unaffected because it calls `NodeService.Probe()`, which does use `nodeHTTPClientFor()`. **Fix path** The `Remote` type already carries the node's TLS settings. `Remote.do()` needs to select an HTTP client based on `r.node.TlsVerifyMode` and `r.node.PinnedCertSha256`, using the same logic as `nodeHTTPClientFor()`. The most straightforward approach is to build and cache a per-`Remote` HTTP client at construction time in `NewRemote()`, rather than relying on the shared singleton. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jun 13, 2026):

Fixed in 4c8d3cb6.

The node probe honored the per-node TLS verify mode (skip/pin), but runtime.Remote used a shared HTTP client with no TLS config — so the background traffic sync (and every other remote operation) fell back to system-CA verification and rejected self-signed nodes even after you set skip/pin.

The per-node TLS client builder is now the single source of truth (HTTPClientForNode/DecodeCertPin in the runtime layer); Remote builds and caches its client through it, and the probe path delegates to the same builder, so the two can no longer diverge.

<!-- gh-comment-id:4698090208 --> @MHSanaei commented on GitHub (Jun 13, 2026): Fixed in 4c8d3cb6. The node probe honored the per-node TLS verify mode (skip/pin), but `runtime.Remote` used a shared HTTP client with no TLS config — so the background traffic sync (and every other remote operation) fell back to system-CA verification and rejected self-signed nodes even after you set skip/pin. The per-node TLS client builder is now the single source of truth (`HTTPClientForNode`/`DecodeCertPin` in the runtime layer); `Remote` builds and caches its client through it, and the probe path delegates to the same builder, so the two can no longer diverge.
Sign in to join this conversation.
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
MHSanaei/3x-ui#3686
No description provided.