From 9d603c5ad20503c11e6b79aa8e0203d45e835358 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 1 Feb 2026 03:12:54 +0100 Subject: [PATCH] Add pinnedPeerCertSha256 support to TLS settings Introduces the pinnedPeerCertSha256 field to TlsStreamSettings in the JS model and adds a corresponding input in the TLS settings form. This allows users to specify SHA256 fingerprints for peer certificate pinning, enhancing security configuration options. --- web/assets/js/model/inbound.js | 4 ++ web/html/form/tls_settings.html | 89 ++++++++++++++++++++++----------- 2 files changed, 64 insertions(+), 29 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 47f32f5c..1e3c0357 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -597,6 +597,7 @@ class TlsStreamSettings extends XrayCommonClass { cipherSuites = '', rejectUnknownSni = false, verifyPeerCertByName = ['dns.google', 'cloudflare-dns.com'], + pinnedPeerCertSha256 = [], disableSystemRoot = false, enableSessionResumption = false, certificates = [new TlsStreamSettings.Cert()], @@ -612,6 +613,7 @@ class TlsStreamSettings extends XrayCommonClass { this.cipherSuites = cipherSuites; this.rejectUnknownSni = rejectUnknownSni; this.verifyPeerCertByName = Array.isArray(verifyPeerCertByName) ? verifyPeerCertByName.join(",") : verifyPeerCertByName; + this.pinnedPeerCertSha256 = pinnedPeerCertSha256; this.disableSystemRoot = disableSystemRoot; this.enableSessionResumption = enableSessionResumption; this.certs = certificates; @@ -646,6 +648,7 @@ class TlsStreamSettings extends XrayCommonClass { json.cipherSuites, json.rejectUnknownSni, json.verifyPeerCertByName, + json.pinnedPeerCertSha256 || [], json.disableSystemRoot, json.enableSessionResumption, certs, @@ -664,6 +667,7 @@ class TlsStreamSettings extends XrayCommonClass { cipherSuites: this.cipherSuites, rejectUnknownSni: this.rejectUnknownSni, verifyPeerCertByName: this.verifyPeerCertByName.split(","), + pinnedPeerCertSha256: this.pinnedPeerCertSha256.length > 0 ? this.pinnedPeerCertSha256 : undefined, disableSystemRoot: this.disableSystemRoot, enableSessionResumption: this.enableSessionResumption, certificates: TlsStreamSettings.toJsonArray(this.certs), diff --git a/web/html/form/tls_settings.html b/web/html/form/tls_settings.html index c14c4831..24b994f6 100644 --- a/web/html/form/tls_settings.html +++ b/web/html/form/tls_settings.html @@ -1,11 +1,13 @@ {{define "form/tlsSettings"}} - + {{ i18n "none" }} - Reality + Reality TLS @@ -16,33 +18,44 @@ - - Auto - [[ value ]] + + Auto + [[ + value ]] - - [[ key ]] + [[ key + ]] - - [[ key ]] + [[ key + ]] - - None - [[ key ]] + None + [[ key + ]] - - [[ alpn ]] + + [[ alpn + ]] @@ -60,18 +73,31 @@ + + + + @@ -99,8 +126,10 @@ - - [[ key ]] + + [[ key + ]] @@ -108,20 +137,22 @@ - + - + - - [[ key ]] - + + [[ + key ]] + - Get New ECH Cert + Get New + ECH Cert Clear