mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-05-22 07:41:54 +08:00
25 lines
954 B
Python
25 lines
954 B
Python
import mitmproxy
|
|
|
|
|
|
class CheckCA:
|
|
def __init__(self):
|
|
self.failed = False
|
|
|
|
def configure(self, options, updated):
|
|
has_ca = (
|
|
mitmproxy.ctx.master.server and
|
|
mitmproxy.ctx.master.server.config and
|
|
mitmproxy.ctx.master.server.config.certstore and
|
|
mitmproxy.ctx.master.server.config.certstore.default_ca
|
|
)
|
|
if has_ca:
|
|
self.failed = mitmproxy.ctx.master.server.config.certstore.default_ca.has_expired()
|
|
if self.failed:
|
|
mitmproxy.ctx.master.add_log(
|
|
"The mitmproxy certificate authority has expired!\n"
|
|
"Please delete all CA-related files in your ~/.mitmproxy folder.\n"
|
|
"The CA will be regenerated automatically after restarting mitmproxy.\n"
|
|
"Then make sure all your clients have the new CA installed.",
|
|
"warn",
|
|
)
|