OWNER_HOSTS (homelab: hub.gabvdl.xyz) answers as the owner without Authelia, for the one device that can't be on the personal tailnet (the Orus Mac). On it the gate takes only the owner's __Host-aia_owner session (7 days, host-only, Strict) — no Remote-User, host token or guest cookie is anyone; without one only the sign-in answers. - remoteaccess/webauthn.py: WebAuthn checked by the hub on `cryptography` (challenge, exact origin, RP ID, user present + verified, signature, counter); a small CBOR reader for new passkeys; fuzzed (80k inputs). - passkeys added only through a one-time link made on the admin host (15 min, one use, hashed, fragment-borne); no mail fallback — Pocket ID was rejected because a mailed code there can enrol a passkey. - Settings → Security: Internet access off (drops every session, back on from the admin host only); pushes on every sign-in and passkey added. - machine paths (worker proxy tokens, tool proxy) refused there. - tests: test_remote_access.py (31), test_webauthn.py (7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95 lines
2.8 KiB
Python
95 lines
2.8 KiB
Python
from .base import Schema
|
|
|
|
__all__ = ["SecurityEvent", "SecurityLog", "SecurityState", "SecurityLockResult",
|
|
"SecurityStopResult", "RemoteSession", "RemotePasskey", "RemoteAccess",
|
|
"PasskeyOptions", "PasskeyInvite"]
|
|
|
|
|
|
class SecurityEvent(Schema):
|
|
"""One line of the security log (security/store.py)."""
|
|
id: str
|
|
at: str
|
|
kind: str # guard_block | guard_owner | sandbox_denial | sandbox_burst |
|
|
# guest_login | new_device | link_request | guest_run |
|
|
# edge_anonymous | guests_locked | guests_unlocked | runs_stopped
|
|
who: str | None = None # a guest id, "owner", or a session's runAs
|
|
sid: str | None = None
|
|
detail: str | None = None
|
|
ip: str | None = None
|
|
ua: str | None = None
|
|
data: dict | None = None
|
|
|
|
|
|
class SecurityLog(Schema):
|
|
events: list[SecurityEvent]
|
|
|
|
|
|
class SecurityState(Schema):
|
|
"""Settings → Security: the switches, and what the last 24 h held."""
|
|
guestsLocked: bool
|
|
lockedAt: str | None = None
|
|
remoteLocked: bool = False # *Internet access* off (remoteaccess/)
|
|
remoteLockedAt: str | None = None
|
|
pushKinds: list[str]
|
|
pushable: list[str]
|
|
counts24h: dict[str, int]
|
|
guestRunsLive: int
|
|
guard: bool
|
|
sandbox: bool
|
|
|
|
|
|
class SecurityLockResult(SecurityState):
|
|
sessionsDropped: int | None = None
|
|
runsStopped: list[str] | None = None
|
|
|
|
|
|
class SecurityStopResult(Schema):
|
|
runsStopped: list[str]
|
|
|
|
|
|
class RemoteSession(Schema):
|
|
"""One of the owner's sessions on the internet address."""
|
|
id: str
|
|
created: float
|
|
seen: float
|
|
exp: float
|
|
ip: str | None = None
|
|
ua: str | None = None
|
|
via: str | None = None # how it signed in ("passkey")
|
|
current: bool = False # this very browser
|
|
|
|
|
|
class RemotePasskey(Schema):
|
|
"""One of the owner's passkeys for the internet address."""
|
|
id: str # the credential id (base64url)
|
|
name: str
|
|
created: float
|
|
lastUsed: float | None = None
|
|
synced: bool = False # backed up by a password manager (Google, iCloud…)
|
|
|
|
|
|
class RemoteAccess(Schema):
|
|
"""Settings → Security → *Internet access* (remoteaccess/)."""
|
|
hosts: list[str] # OWNER_HOSTS — empty: not set up here
|
|
locked: bool
|
|
lockedAt: str | None = None
|
|
sessions: list[RemoteSession]
|
|
passkeys: list[RemotePasskey] = []
|
|
ttlS: int
|
|
idleS: int
|
|
here: bool = False # this request came in on the internet address
|
|
|
|
|
|
class PasskeyOptions(Schema):
|
|
"""A passkey ceremony to run in the browser: ``publicKey`` goes to
|
|
``navigator.credentials.get/create`` (binary fields base64url), ``ticket``
|
|
comes back with the result."""
|
|
ticket: str
|
|
publicKey: dict
|
|
|
|
|
|
class PasskeyInvite(Schema):
|
|
"""A one-time link that adds a passkey (15 min)."""
|
|
url: str
|
|
expiresAt: float
|