mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
MITM freedom RAW TLS: Allow "fromMitm" to be written at any position in verifyPeerCertInNames
, Add checking for alpn
"fromMitm"
https://github.com/XTLS/Xray-core/issues/4348#issuecomment-2643340434
This commit is contained in:
parent
db5f18b98c
commit
d4c7cd02fd
3 changed files with 29 additions and 14 deletions
|
@ -433,6 +433,13 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||
if c.ALPN != nil && len(*c.ALPN) > 0 {
|
||||
config.NextProtocol = []string(*c.ALPN)
|
||||
}
|
||||
if len(config.NextProtocol) > 1 {
|
||||
for _, p := range config.NextProtocol {
|
||||
if tcp.IsFromMitm(p) {
|
||||
return nil, errors.New(`only one element is allowed in "alpn" when using "fromMitm" in it`)
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.CurvePreferences != nil && len(*c.CurvePreferences) > 0 {
|
||||
config.CurvePreferences = []string(*c.CurvePreferences)
|
||||
}
|
||||
|
@ -443,7 +450,7 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||
config.CipherSuites = c.CipherSuites
|
||||
config.Fingerprint = strings.ToLower(c.Fingerprint)
|
||||
if config.Fingerprint != "unsafe" && tls.GetFingerprint(config.Fingerprint) == nil {
|
||||
return nil, errors.New(`unknown fingerprint: `, config.Fingerprint)
|
||||
return nil, errors.New(`unknown "fingerprint": `, config.Fingerprint)
|
||||
}
|
||||
config.RejectUnknownSni = c.RejectUnknownSNI
|
||||
|
||||
|
@ -472,7 +479,7 @@ func (c *TLSConfig) Build() (proto.Message, error) {
|
|||
config.MasterKeyLog = c.MasterKeyLog
|
||||
|
||||
if c.ServerNameToVerify != "" {
|
||||
return nil, errors.PrintRemovedFeatureError("serverNameToVerify", "verifyPeerCertInNames")
|
||||
return nil, errors.PrintRemovedFeatureError(`"serverNameToVerify"`, `"verifyPeerCertInNames"`)
|
||||
}
|
||||
config.VerifyPeerCertInNames = c.VerifyPeerCertInNames
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue