Add TLS ALPN check for WS (#8469)
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

This commit is contained in:
DHR60 2025-12-09 20:22:13 +08:00 committed by GitHub
parent 7cee98887b
commit 6e27dca6cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 44 additions and 1 deletions

View file

@ -193,6 +193,19 @@ public class ActionPrecheckManager
}
}
// ws with tls, tls alpn should contain "http/1.1" in xray core
// rfc6455
// https://github.com/XTLS/Xray-core/blob/81f8f398c7b2b845853b1e85087c6122acc6db0b/transport/internet/tls/tls.go#L95-L116
if (item.Network == nameof(ETransport.ws)
&& item.StreamSecurity == Global.StreamSecurity)
{
var alpnList = Utils.String2List(item.Alpn) ?? [];
if (alpnList.Count > 0 && !alpnList.Contains("http/1.1"))
{
errors.Add(ResUI.AlpnMustContainHttp11ForWsTls);
}
}
return errors;
}

View file

@ -19,7 +19,7 @@ namespace ServiceLib.Resx {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ResUI {
@ -78,6 +78,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 ALPN must contain &apos;http/1.1&apos; when using WebSocket with TLS. 的本地化字符串。
/// </summary>
public static string AlpnMustContainHttp11ForWsTls {
get {
return ResourceManager.GetString("AlpnMustContainHttp11ForWsTls", resourceCulture);
}
}
/// <summary>
/// 查找类似 Export share link to clipboard successfully 的本地化字符串。
/// </summary>

View file

@ -1641,4 +1641,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuServerList2" xml:space="preserve">
<value>Configuration Item 2, Select and add from self-built</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>

View file

@ -1638,4 +1638,7 @@ Si un certificat auto-signé est utilisé ou si le système contient une CA non
<data name="menuServerList2" xml:space="preserve">
<value>Configuration Item 2, Select and add from self-built</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>

View file

@ -1641,4 +1641,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuServerList2" xml:space="preserve">
<value>Configuration Item 2, Select and add from self-built</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>

View file

@ -1641,4 +1641,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuServerList2" xml:space="preserve">
<value>Configuration Item 2, Select and add from self-built</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>

View file

@ -1641,4 +1641,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
<data name="menuServerList2" xml:space="preserve">
<value>Configuration Item 2, Select and add from self-built</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>

View file

@ -1638,4 +1638,7 @@
<data name="menuServerList2" xml:space="preserve">
<value>子配置项二,从自建中选择添加</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>使用 WebSocket+TLS 时ALPN 必须包含 'http/1.1'。</value>
</data>
</root>

View file

@ -1638,4 +1638,7 @@
<data name="menuServerList2" xml:space="preserve">
<value>子配置項二,從自建中選擇新增</value>
</data>
<data name="AlpnMustContainHttp11ForWsTls" xml:space="preserve">
<value>ALPN must contain 'http/1.1' when using WebSocket with TLS.</value>
</data>
</root>