<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=MindAttic.Authentication%2FOPERATIONS</id>
	<title>MindAttic.Authentication/OPERATIONS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=MindAttic.Authentication%2FOPERATIONS"/>
	<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=MindAttic.Authentication/OPERATIONS&amp;action=history"/>
	<updated>2026-12-06T13:43:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>https://mindattic.com/wiki/docs/index.php?title=MindAttic.Authentication/OPERATIONS&amp;diff=542&amp;oldid=prev</id>
		<title>Docs Sync: md2wiki: sync from MindAttic.Docs</title>
		<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=MindAttic.Authentication/OPERATIONS&amp;diff=542&amp;oldid=prev"/>
		<updated>2026-11-29T20:25:21Z</updated>

		<summary type="html">&lt;p&gt;md2wiki: sync from MindAttic.Docs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Operations runbook =&lt;br /&gt;
&lt;br /&gt;
Provisioning, rotation, disaster recovery, email, and deployment for MindAttic.Authentication. These are &amp;lt;strong&amp;gt;operator/IaC&amp;lt;/strong&amp;gt; responsibilities — the running app is a read-only consumer of secrets and never writes production secrets.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== 1. Secret provisioning ==&lt;br /&gt;
&lt;br /&gt;
The app is &amp;lt;strong&amp;gt;fail-closed&amp;lt;/strong&amp;gt;: no &amp;lt;code&amp;gt;pepper.v1&amp;lt;/code&amp;gt; ⇒ won&amp;#039;t start; no &amp;lt;code&amp;gt;bootstrap-token&amp;lt;/code&amp;gt; ⇒ can&amp;#039;t seed the first admin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Dev&amp;lt;/strong&amp;gt; (writable file store, &amp;lt;code&amp;gt;%APPDATA%\MindAttic\Security\tokens.json&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-jsonc&amp;quot;&amp;gt;{&lt;br /&gt;
  &amp;quot;pepper.v1&amp;quot;:        &amp;quot;&amp;amp;lt;base64 of 32 random bytes&amp;gt;&amp;quot;,&lt;br /&gt;
  &amp;quot;bootstrap-token&amp;quot;:  &amp;quot;&amp;amp;lt;a strong ≥12-char string&amp;gt;&amp;quot;,&lt;br /&gt;
  &amp;quot;dp-kek&amp;quot;:           &amp;quot;&amp;amp;lt;base64 of 32 random bytes&amp;gt;&amp;quot;,&lt;br /&gt;
  &amp;quot;reset-token-key&amp;quot;:  &amp;quot;&amp;amp;lt;base64 of 32 random bytes&amp;gt;&amp;quot;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The provisioning CLR tool (&amp;lt;code&amp;gt;tools/&amp;lt;/code&amp;gt;, 📋 planned) generates these via &amp;lt;code&amp;gt;RandomNumberGenerator&amp;lt;/code&amp;gt; and writes the dev file / prints values for prod seeding. Generate a pepper manually meanwhile:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;[Convert]::ToBase64String((1..32 &amp;amp;#124; % { Get-Random -Max 256 } &amp;amp;#124; % { [byte]$_ }))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Prod&amp;lt;/strong&amp;gt; (read-only): seed the same names as Azure Key Vault secrets / App Service settings (&amp;lt;code&amp;gt;MindAttic&amp;amp;#95;_Vault&amp;amp;#95;_Security&amp;amp;#95;_pepper.v1&amp;lt;/code&amp;gt;, …) via IaC &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; deploy. The app only reads them.&lt;br /&gt;
&lt;br /&gt;
== 2. First-run bootstrap ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthBootstrapper.SeedAdminAsync()&amp;lt;/code&amp;gt; (called once at startup) creates the &amp;lt;code&amp;gt;admin&amp;lt;/code&amp;gt; account &amp;lt;strong&amp;gt;iff no users exist&amp;lt;/strong&amp;gt;, using &amp;lt;code&amp;gt;bootstrap-token&amp;lt;/code&amp;gt; as the initial password, with &amp;lt;code&amp;gt;MustChangePassword = MustEnrollMfa = true&amp;lt;/code&amp;gt;. &amp;lt;strong&amp;gt;Immediately rotate &amp;lt;code&amp;gt;bootstrap-token&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; in Vault afterward — it is a standing backdoor until rotated (the app logs a warning reminding you).&lt;br /&gt;
&lt;br /&gt;
== 3. Rotation ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Pepper:&amp;lt;/strong&amp;gt; add &amp;lt;code&amp;gt;pepper.v2&amp;lt;/code&amp;gt; to Vault, set &amp;lt;code&amp;gt;Crypto:CurrentPepperKeyId = &amp;quot;v2&amp;quot;&amp;lt;/code&amp;gt;, keep &amp;lt;code&amp;gt;pepper.v1&amp;lt;/code&amp;gt; readable. Hashes re-pepper on each user&amp;#039;s next login (&amp;lt;code&amp;gt;NeedsRehash&amp;lt;/code&amp;gt;). Retire &amp;lt;code&amp;gt;v1&amp;lt;/code&amp;gt; only when telemetry shows ~0 rows reference it. &amp;lt;strong&amp;gt;Back up every pepper&amp;lt;/strong&amp;gt; (Key Vault soft-delete/versioning) — loss ⇒ forced reset for all affected users.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Data Protection keys:&amp;lt;/strong&amp;gt; auto-roll at the 90-day lifetime; persisted via Azure Blob, wrapped by Key Vault. Never let the ring be deleted (cookies become unverifiable).&lt;br /&gt;
* &amp;lt;strong&amp;gt;Reset-token key:&amp;lt;/strong&amp;gt; rotating invalidates in-flight reset links (acceptable; they&amp;#039;re short-lived).&lt;br /&gt;
&lt;br /&gt;
== 4. Disaster recovery ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Loss&lt;br /&gt;
! Effect&lt;br /&gt;
! Recovery&lt;br /&gt;
|-&lt;br /&gt;
| Pepper (no backup)&lt;br /&gt;
| All password hashes unverifiable&lt;br /&gt;
| Forced password reset for all users. &amp;lt;strong&amp;gt;Back it up.&amp;lt;/strong&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| DP key ring&lt;br /&gt;
| Existing auth cookies invalid&lt;br /&gt;
| Users re-login; restore the ring from Blob/KV backup to avoid mass re-login.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;bootstrap-token&amp;lt;/code&amp;gt; leaked&lt;br /&gt;
| Backdoor until rotated&lt;br /&gt;
| Rotate; the seeded admin must already have changed its password.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Pre-launch gate:&amp;lt;/strong&amp;gt; pepper + DP-KEK backed up in Key Vault with a &amp;lt;strong&amp;gt;tested restore drill&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== 5. Email (password reset / security alerts) ==&lt;br /&gt;
&lt;br /&gt;
Auth emails go through &amp;lt;code&amp;gt;IAuthEmailSender&amp;lt;/code&amp;gt;, which &amp;lt;code&amp;gt;AddMindAtticAuthentication&amp;lt;/code&amp;gt; chooses at first use:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Configuration&lt;br /&gt;
! Sender&lt;br /&gt;
! Result&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MindAttic:Vault:Notifications:email&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;smtpHost&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;username&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;password&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;from&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;smtpPort&amp;lt;/code&amp;gt; optional, default 587)&lt;br /&gt;
| &amp;lt;code&amp;gt;SmtpAuthEmailSender&amp;lt;/code&amp;gt;&lt;br /&gt;
| Mail is delivered over SMTP (MailKit). Port 465 = implicit TLS; any other port requires STARTTLS.&lt;br /&gt;
|-&lt;br /&gt;
| Section absent or incomplete&lt;br /&gt;
| &amp;lt;code&amp;gt;LoggingAuthEmailSender&amp;lt;/code&amp;gt;&lt;br /&gt;
| Nothing is delivered. A startup &amp;lt;strong&amp;gt;warning&amp;lt;/strong&amp;gt; says so and names the missing fields.&lt;br /&gt;
|-&lt;br /&gt;
| Host registered its own &amp;lt;code&amp;gt;IAuthEmailSender&amp;lt;/code&amp;gt;&lt;br /&gt;
| the host&amp;#039;s&lt;br /&gt;
| The library&amp;#039;s registration steps aside.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Provisioning:&amp;lt;/strong&amp;gt; dev — &amp;lt;code&amp;gt;%APPDATA%\MindAttic\Notifications\providers.json&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;{ &amp;quot;email&amp;quot;: { &amp;quot;smtpHost&amp;quot;, &amp;quot;smtpPort&amp;quot;, &amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;from&amp;quot; } }&amp;lt;/code&amp;gt;); prod — app settings &amp;lt;code&amp;gt;MindAttic&amp;amp;#95;_Vault&amp;amp;#95;_Notifications&amp;amp;#95;_email&amp;amp;#95;_smtpHost&amp;lt;/code&amp;gt; … &amp;lt;code&amp;gt;&amp;amp;#95;_from&amp;lt;/code&amp;gt; (or Key Vault references). Also set &amp;lt;code&amp;gt;MindAttic&amp;amp;#95;_Auth&amp;amp;#95;_Reset&amp;amp;#95;_PublicBaseUrl&amp;lt;/code&amp;gt; to the app&amp;#039;s public https origin: a reset link must be absolute, so with SMTP on and no base URL the sender refuses reset mail and the startup log warns.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Delivery is queued.&amp;lt;/strong&amp;gt; The reset request returns without waiting on SMTP, so a slow or failing mail server cannot become an enumeration oracle ([[MindAttic.Authentication/BIBLE|LAW-3]]). Each message gets 3 attempts (2 s, 4 s back-off); a final failure is logged as an error. Queued mail drains on graceful shutdown.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Logs never carry&amp;lt;/strong&amp;gt; the reset link (a bearer credential) or the SMTP password; recipients are masked (&amp;lt;code&amp;gt;a***@example.com&amp;lt;/code&amp;gt;). Confirm the startup line &amp;lt;code&amp;gt;auth email is delivered over SMTP (host:port as user from …)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Reset is enumeration-safe (&amp;quot;if an account exists, we&amp;#039;ve emailed a link&amp;quot;) and the link base comes from &amp;lt;code&amp;gt;PublicBaseUrl&amp;lt;/code&amp;gt;, never &amp;lt;code&amp;gt;Request.Host&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== 6. Deployment (Windows App Service, Prose-style) ==&lt;br /&gt;
&lt;br /&gt;
GitHub Actions on &amp;lt;code&amp;gt;windows-latest&amp;lt;/code&amp;gt;, &amp;lt;strong&amp;gt;build → migrate → deploy&amp;lt;/strong&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;build:&amp;lt;/strong&amp;gt; &amp;lt;code&amp;gt;dotnet publish&amp;lt;/code&amp;gt;; restore the private packages (Vault, Authentication, Legion) from the local-packages feed + nuget.org.&lt;br /&gt;
* &amp;lt;strong&amp;gt;migrate:&amp;lt;/strong&amp;gt; apply EF migrations (creates/updates the &amp;lt;code&amp;gt;auth&amp;lt;/code&amp;gt; schema) via an &amp;lt;strong&amp;gt;OIDC service principal&amp;lt;/strong&amp;gt; with &amp;lt;code&amp;gt;db_ddladmin&amp;lt;/code&amp;gt;; the App Service managed identity is read/write only and cannot run DDL.&lt;br /&gt;
* &amp;lt;strong&amp;gt;deploy:&amp;lt;/strong&amp;gt; push to the App Service slot. App settings carry the &amp;lt;code&amp;gt;MindAttic&amp;amp;#95;_Vault&amp;amp;#95;_Security&amp;amp;#95;_*&amp;lt;/code&amp;gt; secrets (or Key Vault references); &amp;lt;code&amp;gt;UseHsts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;UseForwardedHeaders&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;KnownProxies&amp;lt;/code&amp;gt;, and an edge WAF / global rate-limit are required (the per-IP throttle assumes a correct client IP and the WAF backstops distributed stuffing).&lt;br /&gt;
&lt;br /&gt;
== 7. Operational must-dos (red-team mandated) ==&lt;br /&gt;
&lt;br /&gt;
* Configure &amp;lt;code&amp;gt;ForwardedHeaders&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;KnownProxies&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;KnownNetworks&amp;lt;/code&amp;gt; (empty ⇒ per-IP throttle collapses to global).&lt;br /&gt;
* Edge WAF / global rate-limit in front (documented hard dependency).&lt;br /&gt;
* Enable the cluster anomaly brake + CAPTCHA step-up.&lt;br /&gt;
* Operator MFA reset requires &amp;lt;strong&amp;gt;dual-control&amp;lt;/strong&amp;gt; for Admin targets + an out-of-band owner notification.&lt;br /&gt;
* Run a proactive &amp;lt;strong&amp;gt;forced-reset campaign&amp;lt;/strong&amp;gt; for dormant legacy-hash accounts (don&amp;#039;t wait for next login).&lt;br /&gt;
* Monitor DP key-ring age + Argon2 verify latency; alert on a shrunk/empty key set.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-crumb&amp;quot;&amp;gt;Part of [[MindAttic.Authentication]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-source&amp;quot;&amp;gt;From [https://github.com/mindattic/MindAttic.Authentication/blob/main/docs/OPERATIONS.md MindAttic.Authentication/docs/OPERATIONS.md] via MindAttic.Docs; synced automatically, so edit the repo, not this page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:MindAttic.Authentication]]&lt;/div&gt;</summary>
		<author><name>Docs Sync</name></author>
	</entry>
</feed>