-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import rs from '@/utils/rs'; | ||
import YAML from '@/utils/yaml'; | ||
import download from '@/utils/download'; | ||
import { | ||
|
@@ -463,6 +464,25 @@ function lastParse(proxy) { | |
if (['', 'off'].includes(proxy.sni)) { | ||
proxy['disable-sni'] = true; | ||
} | ||
let caStr = proxy['ca_str']; | ||
if (proxy['ca-str']) { | ||
caStr = proxy['ca-str']; | ||
} else if (caStr) { | ||
delete proxy['ca_str']; | ||
proxy['ca-str'] = caStr; | ||
} | ||
try { | ||
if ($.env.isNode && !caStr && proxy['_ca']) { | ||
caStr = $.node.fs.readFileSync(proxy['_ca'], { | ||
encoding: 'utf8', | ||
}); | ||
} | ||
} catch (e) { | ||
$.error(`Read ca file failed\nReason: ${e}`); | ||
} | ||
if (!proxy['tls-fingerprint'] && caStr) { | ||
proxy['tls-fingerprint'] = rs.generateFingerprint(caStr); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Ariesly
Contributor
|
||
} | ||
return proxy; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import rs from 'jsrsasign'; | ||
|
||
export function generateFingerprint(caStr) { | ||
const hex = rs.pemtohex(caStr); | ||
const fingerPrint = rs.KJUR.crypto.Util.hashHex(hex, 'sha256'); | ||
return fingerPrint.match(/.{2}/g).join(':').toUpperCase(); | ||
} | ||
|
||
export default { | ||
generateFingerprint, | ||
}; |
caStr
这里是证书不是服务端证书吧?tls-fingerprint
这里验证的是服务端证书?证书生成是参照这个:
https://v1.hysteria.network/zh/docs/custom-ca/
只能用
xxx.server.crt
产生的fingerprint
才能验证通过.openssl x509 -noout -fingerprint -sha256 -in xxx.server.crt
用
xxx.ca.crt
产生的fingerprint
验证不通过.openssl x509 -noout -fingerprint -sha256 -in xxx.ca.crt