tdfs4ds.serve.credential_vault¶
tdfs4ds.serve.credential_vault
¶
Remembered credentials of the gateway (0.3.8.2): opt-in, per login, per environment.
The two halves of a stored credential are never in the same place:
- the server holds
<entry>.bin: the user name, password and logon mechanism sealed with AES-256-GCM (additional data = environment id, host, user name, entry id), and<entry>.meta: the environment, host, user name, mechanism and last-use time (none of it secret); - the browser holds the 256-bit key and the entry id, in a signed, HttpOnly,
SameSite=Strict cookie
tdfs4ds_cred_<environment id>.
Neither half opens anything alone. A token (JWT) is never stored, and nothing here logs or
writes a plaintext secret. An entry expires TDFS4DS_SERVE_REMEMBER_DAYS (30) after its
last successful use. TDFS4DS_SERVE_REMEMBER_CREDENTIALS=false switches it all off.
Vault
¶
Server half of the remembered credentials. sign / unsign come from the
login gate (auth.sign / auth.unsign): the cookie value is signed with the
server's secret, so a forged or edited cookie is refused before any file is read.
dir
instance-attribute
¶
store
¶
store(env_id: str, host: str, logmech: str, username: str, password: str, previous_cookie: Optional[str] = None) -> Optional[str]
Seal the credentials; returns the signed cookie value. None when not storable (switch off, mechanism other than TD2/LDAP, empty fields).
peek
¶
{'username', 'logmech'} when the cookie names a live entry of this environment
(nothing decrypted); None otherwise. For the login page.
load
¶
The decrypted credentials, or None (no cookie, forged cookie, wrong key, other environment, expired, tampered file). An expired entry is deleted.
touch
¶
A successful use moves the expiry: 30 days from now.
forget_environment
¶
Delete every entry of an environment (the environment is forgotten).
purge_expired
¶
Delete expired entries (and half entries). Called at start and daily.