Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def parse_args():
action="store_true",
help="Remove the MITM CA certificate from trusted roots and exit.",
)
parser.add_argument(
"--check-cert",
action="store_true",
help="Check if the CA certificate is trusted and exit.",
)
parser.add_argument(
"--no-cert-check",
action="store_true",
Expand All @@ -106,10 +111,14 @@ def main():
args = parse_args()

# Handle cert-only commands before loading config so they can run standalone.
if args.install_cert or args.uninstall_cert:
if args.install_cert or args.uninstall_cert or args.check_cert:
configure_logging("INFO")
_log = logging.getLogger("Main")

if args.check_cert:
trusted = is_ca_trusted(CA_CERT_FILE)
sys.exit(0 if trusted else 2)

if args.install_cert:
_log.info("Installing CA certificate…")
if not os.path.exists(CA_CERT_FILE):
Expand Down