diff --git a/packages/mitmproxy/src/lib/proxy/common/util.js b/packages/mitmproxy/src/lib/proxy/common/util.js index 9335ae6..1a0f04a 100644 --- a/packages/mitmproxy/src/lib/proxy/common/util.js +++ b/packages/mitmproxy/src/lib/proxy/common/util.js @@ -29,10 +29,16 @@ function createHttpsAgent (timeoutConfig, verifySsl) { if (!httpsAgentCache[key]) { verifySsl = !!verifySsl + // 证书回调函数 + const checkServerIdentity = (host, cert) => { + log.info(`checkServerIdentity: ${host}, CN: ${cert.subject.CN}, C: ${cert.subject.C || cert.issuer.C}, ST: ${cert.subject.ST || cert.issuer.ST}, bits: ${cert.bits}`) + } + const agent = new HttpsAgent({ keepAlive: true, timeout: timeoutConfig.timeout, keepAliveTimeout: timeoutConfig.keepAliveTimeout, + checkServerIdentity, rejectUnauthorized: verifySsl }) @@ -40,6 +46,7 @@ function createHttpsAgent (timeoutConfig, verifySsl) { keepAlive: true, timeout: timeoutConfig.timeout, keepAliveTimeout: timeoutConfig.keepAliveTimeout, + checkServerIdentity, rejectUnauthorized: false })