Specs stay at repo root (cross-VM). Move deploy and code into logical projects with README per domain, updated manifest.yaml, and symlinks at legacy paths for VM122 backward compatibility.
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Webmail HTTPS check (read-only)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
import httpx
|
|
|
|
|
|
def collect(domain: str) -> dict[str, dict[str, Any]]:
|
|
domain = domain.lower().strip()
|
|
url = f"https://mail.{domain}/"
|
|
try:
|
|
with httpx.Client(timeout=12.0, follow_redirects=True, verify=True) as client:
|
|
response = client.get(url)
|
|
code = response.status_code
|
|
if 200 <= code < 400:
|
|
status, message = "pass", f"HTTP {code}"
|
|
elif code == 403:
|
|
status, message = "warn", f"HTTP {code}"
|
|
else:
|
|
status, message = "fail", f"HTTP {code}"
|
|
return {
|
|
"webmail_http": {
|
|
"check_id": "webmail_http",
|
|
"label": "Webmail HTTPS",
|
|
"status": status,
|
|
"message": message,
|
|
"evidence": {"url": url, "status_code": code},
|
|
}
|
|
}
|
|
except Exception as exc:
|
|
return {
|
|
"webmail_http": {
|
|
"check_id": "webmail_http",
|
|
"label": "Webmail HTTPS",
|
|
"status": "fail",
|
|
"message": str(exc)[:200],
|
|
"evidence": {"url": url},
|
|
}
|
|
}
|