فهرست منبع

Create SMB_PROPOSAL.md

Toby Chui 1 هفته پیش
والد
کامیت
2ae4336725
1فایلهای تغییر یافته به همراه464 افزوده شده و 0 حذف شده
  1. 464 0
      src/mod/storage/SMB_PROPOSAL.md

+ 464 - 0
src/mod/storage/SMB_PROPOSAL.md

@@ -0,0 +1,464 @@
+# Built-in SMB server: proposal
+
+Status: proposal, nothing built. Surveyed 2026-11-07 on branch `v3.0.5`.
+
+## 1. Verdict
+
+**This is feasible.** Go can listen on port 445 and speak SMB 2/3 well enough
+for Windows Explorer, with no Samba and no cgo. Three separate Go projects
+report working Windows clients. The cryptography comes from the standard
+library, `golang.org/x/crypto` (already a dependency) and a few small helpers.
+The first six phases of the roadmap need no new Go dependency.
+
+**Recommendation:** write the server in the tree at `src/mod/storage/smbserver`
+rather than depending on a library. Every permissively licensed library is
+under five months old with almost no users, so a dependency brings no field
+testing. They are useful as references instead (section 5).
+
+Two limits cannot be engineered away:
+
+1. **ArozOS hosted on Windows cannot have port 445.** The Windows kernel owns
+   it. Binding failed on this machine for `:445`, `127.0.0.1:445` and
+   `127.0.0.2:445`, with the listener held by PID 4. Linux, the main NAS
+   target, is not affected. See section 8.
+2. **Microsoft is retiring NTLM.** NTLMv2 is the right choice today, but the
+   next major Windows release is targeted to turn it off by default. This hits
+   every standalone NAS, Samba included, so moving to a built-in server does
+   not make it worse. See section 7.
+
+**How far the evidence goes:** nothing was prototyped. I read the source and
+documentation of these projects, but did not run them. The Windows results
+below are their own reports. This PC cannot run the test either (section 10).
+Phase 1 is therefore the real proof, and it ends in a go/no-go gate.
+
+## 2. What exists today
+
+`mod/fileservers/servers/samba` wraps a system Samba install. Its limits are
+the reason for this work:
+
+| Today | Effect |
+|---|---|
+| `NewSambaShareManager` returns an error unless Linux with `/bin/smbcontrol` | No SMB on Windows, macOS or a minimal Linux |
+| Edits `/etc/samba/smb.conf`, runs `sudo adduser`, `smbpasswd`, `pdbedit`, restarts smbd | Needs sudo, creates one Unix account per ArozOS user, and a change restarts the daemon |
+| `syncUserShares` skips `IsNetworkDrive()` drives | `cluster:/`, `share:/`, S3, FTP and WebDAV drives are unreachable |
+| smbd reads smb.conf, not the drive access lists | `SyncDriveAccess` must keep a copy in step |
+| A share is named `<username>_<drive>` for isolated drives | Awkward paths, because smbd cannot resolve per user |
+
+## 3. What Windows Explorer needs
+
+The dialect is not the hard part. Windows negotiates anything from 2.0.2 to
+3.1.1 by default, so even 2.1 would connect. **Target 3.1.1 and accept down to
+2.1**: 3.1.1 protects the negotiation against downgrade, and 2.1 is the lowest
+dialect with large reads and writes.
+
+| Requirement | Why | If it is missing |
+|---|---|---|
+| Signing | Required by default on all connections from Windows 11 24H2 and Server 2025 | Connection refused |
+| Real authentication, no guest | Windows 11 Pro blocks guest, and signing cannot work with guest | Connection refused |
+| NTLMv2 inside SPNEGO | The workgroup path; there is no domain controller | Cannot log in |
+| TCP port 445 | `\\host\share` always dials 445 and has no port syntax | Explorer cannot connect |
+| Answer the SMB1 negotiate | Windows may open with it, and we reply with SMB2 | Mount fails |
+| Compound requests | Windows chains create, query and close | Mount or listing fails |
+| Credits, multi-credit I/O | Flow control and large reads and writes | Stalls, poor speed |
+| `VALIDATE_NEGOTIATE_INFO` | Downgrade check for 3.0 and 3.0.2 clients | Client drops the connection |
+| File and volume info classes | Explorer reads many; layouts must be exact | Odd errors, wrong sizes |
+| `IPC$` with srvsvc over DCE/RPC | How `\\host` lists its shares | Only full `\\host\share` paths work |
+| Security descriptors | The Properties dialog asks for them | Properties errors; can be synthesized |
+| `CHANGE_NOTIFY` | Live refresh of open folders | Folders refresh less often, otherwise fine |
+| WS-Discovery | The Network view; NetBIOS browsing is gone | Not listed; typing the address still works |
+
+Not needed: SMB1, NetBIOS ports 137 to 139, multichannel, RDMA, DFS,
+compression, persistent handles, printers.
+
+## 4. Survey of Go SMB servers
+
+Size is non-test Go source. Windows evidence is what each project reports.
+
+| Project | Licence | Activity | Size | Dialects | Encryption | Windows evidence | Pluggable FS |
+|---|---|---|---|---|---|---|---|
+| [go-filesystems/smb](https://github.com/go-filesystems/smb) | BSD-3 | Since Sep 2026, active | 176 KB | 2.1 to 3.0.2 | None | Windows 11 ARM64 25H2, 3.0.2, signed, via a forwarded 445 | Yes, pre-1.0 interface |
+| [sonroyaalmerol/go-smb-server](https://github.com/sonroyaalmerol/go-smb-server) | MIT | No push since 15 Jul 2026, 10 open PRs | 140 KB | 2.0.2 to 3.1.1 | AES-128-CCM | None on main; open PR #3 reports Windows Server 2025 | Yes |
+| [softwarity/smbserver](https://github.com/softwarity/smbserver) | Apache-2.0 | Published Oct 2026 | 116 KB | 2.0.2, 2.1 (3.0 if pinned) | None | Best: redirector and Explorer copy engine in CI, on a high port | No, one folder and one user |
+| [ahmetozer/gosamba](https://github.com/ahmetozer/gosamba) | Apache-2.0 | Jun to Sep 2026 | 682 KB | 2.0.2 to 3.1.1 | Yes | None published; `smbclient` on Linux | No, an app with `internal/` code, and no Windows host |
+| [macos-fuse-t/go-smb2](https://github.com/macos-fuse-t/go-smb2) | **AGPL-3.0** or commercial | Since 2023, 143 stars | 844 KB | SMB2/3 | Not stated | macOS focus | Yes |
+| [gavriva/smb2](https://github.com/gavriva/smb2) | MIT | One push, 2017 | 60 KB | Not stated | Not stated | None | Basic |
+| [izouxv/smbapi](https://github.com/izouxv/smbapi) | **None** | Last push Jan 2024 | 175 KB | Not stated | Not stated | iPhone and macOS claimed | Unclear |
+
+Conclusions:
+
+- **Ruled out by licence:** the AGPL project (rule 3) and `smbapi`, which has no
+  licence at all and so cannot be used.
+- **No mature permissive option.** The usable ones have 0 to 7 stars and are
+  months old. The only project with real adoption is the AGPL one.
+- **`go-smb-server` cannot be used from main.** Its Windows, locking,
+  concurrency and session security fixes all sit in unmerged PRs, and the fork
+  default branches do not carry them either.
+- **`go-filesystems/smb` is the closest fit**, but it lacks 3.1.1, encryption,
+  oplocks and streams, and it requires Go 1.27.1 (ArozOS is on 1.26.10).
+- **The job is bounded.** Complete servers here run from 116 KB to 682 KB of
+  Go, which is roughly 4,000 to 21,000 lines.
+
+### What their bug history teaches
+
+These come from the `go-smb-server` PRs and are a free defect list for us:
+
+- **Before PR #3, neither Windows Server 2025 nor the Linux kernel client could
+  complete a mount**, although `smbclient` and a Go client passed. Causes
+  included the SMB1 opening, NTLMSSP framing and challenge flags, compound
+  offsets, `FileId` handling in related compounds, and info class layouts.
+- **Never grant an oplock before breaks exist.** Clients wrote back stale
+  cached data, which is silent corruption.
+- **A self-written test client proves little.** Every LOCK from Windows failed
+  because of a wrong offset, and the end-to-end test passed because it built
+  requests with the same mistake (PR #5). Test against real clients.
+- **One request at a time per connection is too slow.** Reading 64 MiB from an
+  object store took 2.3 to 5.8 s serially and 0.5 to 3.2 s concurrently
+  (PR #6). Design for concurrency from the first day.
+- **Compound signing is a security boundary.** Verify each part against its
+  original bytes, sign after offsets are final, and never fall back to
+  plaintext when encryption fails (PR #12).
+
+## 5. Recommended approach
+
+| Option | Upside | Downside |
+|---|---|---|
+| A. Depend on a library | Least code at first | No option has both Windows proof and 3.1.1; thin maintenance; our needs would become forks anyway |
+| B. Fork one into the tree | Starts from working code | Inherits a design we did not choose; gaps remain large; merge burden |
+| **C. Write it in the tree** | Fits ArozOS exactly, no new dependency, one concurrency and security design | Most up-front work; we own all the bugs |
+
+**Choose C.** The difficult parts are ArozOS-specific anyway: per-user dynamic
+shares, access checks on every operation, staged drives, quotas and the
+credential store. The core is a fixed public specification with free conformance
+tools, and this matches how `mod/office` and `pdfrender` were done. **Fallback:**
+if Phase 1 stalls on interop, fork `go-filesystems/smb` (BSD-3) as the seed.
+
+Reuse rules: permissive code may be borrowed with its notice kept, for example
+CCM and CMAC from `hirochachacha/go-smb2` (BSD, internal there, so copied) and
+the test matrix idea from `softwarity/smbserver`. Do not read or copy from the
+AGPL project.
+
+```
+src/mod/storage/smbserver/
+    server.go, conn.go   listener, connection limits, reader and writer goroutines
+    wire/                headers, commands, info classes, status codes
+    auth/                SPNEGO and NTLMv2 (Kerberos later)
+    crypt/               key derivation, CMAC, GMAC, CCM, GCM, preauth hash
+    rpc/                 DCE/RPC and NDR for srvsvc and wkssvc
+    state/               sessions, trees, opens, share modes, locks, oplocks, notify
+    backend.go           the small interface the core calls
+    aroz/                that interface over *user.User and FileSystemHandler
+src/mod/fileservers/servers/smbserv/   fileservers.Server glue, settings, activation
+src/web/SystemAO/disk/smb.html         settings page (instr/smb.html for connection help)
+```
+
+Only `aroz/` imports ArozOS packages, so the protocol core stays testable by
+itself. This is the same split as `sftpserver.Access`.
+
+## 6. Mapping to the ArozOS file system
+
+### Shares and users
+
+- **A share is a drive.** `\\host\user` is the signed-in user's `user:/`, and
+  the list comes from `GetAllFileSystemHandler()` for that session. The server
+  knows who is connected, so the `<username>_<drive>` naming goes away:
+  `VirtualPathToRealPath(vpath, username)` already resolves isolated drives.
+- **One share per drive, not one virtual root.** Free space, read-only state
+  and the drive name then all behave naturally in Windows.
+- **No shares on arbitrary host paths.** Admins add a drive instead, which keeps
+  every path under the access lists.
+- **The session holds a username, not a frozen permission set.** As in
+  `sftpserver/vroot.go`, ask `CanRead` and `CanWrite` on each operation, so a
+  rule change reaches open sessions. Every write path must check `CanWrite`.
+- **Files are owned by the ArozOS process**, like everything File Manager
+  writes. No Unix accounts are needed.
+
+### Passwords: the one real gap
+
+NTLM needs the **NT hash**, MD4 of the UTF-16 password. ArozOS stores
+`sha512(password)` in `auth/passhash/<user>`, and one cannot be derived from the
+other. So `ValidateUsernameAndPassword` cannot be used, and existing accounts
+cannot work over SMB until a password is supplied once.
+
+**Recommendation: a dedicated SMB password per user**, set when the user
+activates SMB, after confirming the login password. They may type the same one,
+or take a generated one, and Windows Credential Manager remembers it.
+
+- An NT hash is enough to log in over SMB and is quick to crack. Keeping it
+  separate means a leak does not expose the web login, and it can be revoked.
+- It works for LDAP and OAuth accounts, which have no local password to reuse.
+- It needs no hooks in the password change paths (`user.go`, `system.resetpw.go`,
+  the cluster write-back).
+- Store it encrypted with AES-GCM, following `mod/email/secretbox.go`.
+- **Store the Kerberos AES keys at the same time**, which are also derived from
+  the password. This keeps a Kerberos path open without asking everyone again.
+
+Clusters: start with activation per node, and later verify NTLM at the identity
+origin over ACN, so that a member need not hold the hash.
+
+### Operations
+
+| SMB | ArozOS |
+|---|---|
+| `TREE_CONNECT` | Find the drive in `GetAllFileSystemHandler()`, `CanRead` on its root |
+| `CREATE` | `CanRead` / `CanWrite` by requested access, then `OpenFile` or a staged handle |
+| `READ`, `WRITE`, `FLUSH` | `ReadAt`, `WriteAt`, `Sync` |
+| `QUERY_DIRECTORY` | `ReadDir` once per handle, then page from the snapshot |
+| Set end of file / allocation | `Truncate` |
+| Rename | `Rename`, both ends checked; across drives is refused so Windows copies instead |
+| Delete | Marked on the open, then `Remove` at last close |
+| Basic info | `Chtimes` |
+| Volume size | `diskcapacity.ResolveCapacityInfo` on local drives, capped by remaining `StorageQuota` on `user:/` |
+| Creation time | `filesystem.GetFileCreationTime`, falling back to modified time |
+| Security descriptor | Synthesized from the user's access level; changes are accepted and ignored |
+
+### Windows behaviour the server must provide itself
+
+`FileSystemAbstraction` has none of this, and it should not gain it:
+
+| Behaviour | Approach |
+|---|---|
+| Share modes, byte-range locks | In-memory tables keyed by drive and path |
+| Case-insensitive names | Exact match first, then a case-folded scan of the parent, with a short cache |
+| Names Windows forbids (`:`, `?`, trailing dot) | Map to the private Unicode range other SMB clients use |
+| Stable file IDs | The inode on local drives, otherwise a hash of drive and path |
+| Alternate data streams | Do not advertise them at first, then keep small streams in memory |
+| `.metadata` folders | Report as hidden; refuse writes into them over SMB |
+| Symlinks | Refuse links that lead outside the drive root |
+| Path safety | Reject `..` and stream syntax before resolving; test against the `user:../bob` class of bug |
+
+**Oplocks and other writers:** File Manager and WebDAV writes bypass the server,
+so they will not break an SMB client's cache. Samba has the same gap by default
+(`kernel oplocks = no`). Accept it, grant no oplocks until breaks work, and
+document it.
+
+### Drive types
+
+| Drive | `RequireBuffer` | Plan |
+|---|---|---|
+| Local disks | false | Direct `OpenFile`; Phases 1 and 2 |
+| `smb`, `sftp` | false | Direct; check behaviour under load in Phase 4 |
+| `webdav`, `ftp`, `s3`, `cluster` | true | **Staged handle**, Phase 4 |
+| `share:/` | Handled inside sharefs | Read-only; already refuses writes |
+
+`Open` and `OpenFile` return "not supported" on all four buffered types, so
+random I/O needs a new layer. WebDAV's `BufferFsIoHandler` is no model: it holds
+the file in memory and refuses anything over 28 MB. FTP does not support these
+drives at all.
+
+A staged handle copies the file to `LocalBufferPath` when first read (extending
+`BufferRemoteToLocal`), does random I/O on that copy, and commits by `WriteStream`
+at close. This suits `cluster:/`, which already publishes whole files. Rules:
+
+- Long transfers must return `STATUS_PENDING` first, or the Windows request
+  timer expires while waiting.
+- `CLOSE` waits for the upload and reports failure, because Windows gives the
+  user little feedback at that point. On failure, keep the staged file and log.
+- Each save uploads the whole file. An admin limit caps the staged size.
+
+### Quotas and trash
+
+- **Quota:** call `StorageQuota.HaveSpace` as writes extend a file, and return
+  `STATUS_DISK_FULL`. Follow FTP here; **WebDAV and SFTP have no quota check
+  today**, which is a separate existing gap.
+- **Trash:** SMB delete is permanent, as with Samba today. Sending deletes to
+  ArozOS trash can be an option in Phase 6.
+
+## 7. Security
+
+This is a new network parser, and the installer's service has no `User=` line,
+so it normally runs as root. Go removes memory corruption, not logic bugs.
+
+- **Never:** SMB1 sessions, guest or anonymous sessions, NTLMv1, unsigned
+  sessions on any dialect that can sign.
+- **Before login:** only `NEGOTIATE` and `SESSION_SETUP` are reachable. Apply
+  message size limits, a 30 second login deadline, and per-IP connection caps.
+- **Failed logins:** check `ValidateLoginIpAccess` at accept. Delay failures,
+  as Windows does with 2 seconds per attempt, and adapt `explogin`, whose API
+  takes an `*http.Request`. Log with `LogAuthByRequestInfo(..., "smb")`.
+- **Exposure:** `ForwardPortIfUpnp: false`, and default to private network
+  addresses only, with an explicit admin override. Port 445 must not reach the
+  internet.
+- **Hardening:** fuzz every decoder reachable before login, run `GOARCH=386`
+  tests, and test boundary values, as for the other untrusted-file parsers.
+
+**NTLM retirement.** Microsoft's FAQ gives the "next major release of Server and
+Client (subject to change)" as the target, with no date. Admins can re-enable
+NTLM at first, but that ability "will be narrowed" over time, and NTLM-only
+appliances "will need" vendor updates. Windows' own LocalKDC does not help a
+third-party server, which needs its own Kerberos support. Samba developers are
+working on a local KDC with IAKerb, and that is the path to follow (Phase 7).
+
+## 8. Platforms and ports
+
+| Host | Port 445 | Windows Explorer access |
+|---|---|---|
+| Linux as root (the installer's service) | Works | Full |
+| Linux without root | Needs `cap_net_bind_service`, or systemd `AmbientCapabilities` | Full |
+| Linux with Samba running | Taken by smbd | Only one can run; the settings page says why |
+| macOS | Needs File Sharing off | Full (not tested in this survey) |
+| Windows | **Held by the kernel** | Alternate port only: Windows 11 24H2+ or Server 2025 clients, mapped by an admin with `New-SmbMapping -TcpPort`; no `\\host` browsing |
+
+The server stays pure Go and builds for every Makefile target, with a
+configurable port. Freeing 445 on a Windows host would mean disabling the
+Windows Server service, which ArozOS must not do for the user.
+
+Low-end boards need measuring: signing every packet in software may limit
+speed on ARM and MIPS, since signing cannot be turned off for Windows 11 clients.
+
+## 9. Roadmap
+
+Size and effort are rough estimates from the surveyed projects, for one
+developer, before any prototype. Each phase ends with a check on **real clients
+at default settings**.
+
+| Phase | Result | Lines | Effort |
+|---|---|---|---|
+| 0. Rig | Test bench, CI, codec | 1k | 3 to 4 days |
+| 1. Read-only | Browse and copy out in Explorer | 6k | 2 to 3 weeks |
+| 2. Writes | Safe for everyday apps | 4k | 2 to 3 weeks |
+| 3. Product | Experimental release | 1.5k + UI | 1 week |
+| 4. All drives | Cluster, S3, FTP, WebDAV | 1k | 1 week |
+| 5. Speed and resilience | Caching, reconnect, encryption | 4k | 3 to 4 weeks |
+| 6. Reach | Discovery, macOS, extras | 2k | 2 weeks |
+| 7. After NTLM | Kerberos, then retire the Samba wrapper | Open | Open |
+
+Phases 0 to 3 are the first usable release, at about 6 to 8 weeks.
+
+### Phase 0: test rig and foundations
+
+- Set up a Linux host and Windows 10 and Windows 11 24H2+ clients (section 10).
+- Capture real sessions in Wireshark to use as codec fixtures.
+- Build the `wire` codec and NTLMv2 against the MS-NLMP test vectors.
+- Measure CMAC, GMAC and GCM speed on a Raspberry Pi class board.
+
+**Done when** captured Windows traffic round-trips through the codec exactly.
+
+### Phase 1: read-only Explorer, the go/no-go gate
+
+- Negotiate 2.1 to 3.1.1 with the SMB1 opening, preauth integrity, SPNEGO and
+  NTLMv2, and all signing algorithms.
+- Compound requests, credits, multi-credit I/O, and a concurrent connection
+  design with one writer goroutine.
+- Tree connect, create, close, read, query directory, query info, `IPC$`,
+  srvsvc and wkssvc, and `CHANGE_NOTIFY` that pends and cancels cleanly.
+- Local drives and `share:/`, with passwords set by a temporary admin command.
+
+**Done when** both Windows clients, against a Linux host on port 445, list
+`\\host`, browse, open Properties, and copy out 10 GB with matching hashes, and
+a wrong password is refused and logged. **If this is not reached, revisit the
+fork fallback before going on.**
+
+### Phase 2: writes that real applications trust
+
+- All create dispositions, write, flush, set info, delete on close, rename.
+- Share modes, byte-range locks, case-insensitive lookup, name mapping, file IDs.
+- `CanWrite` on every path, quota checks, read-only drives reported as such.
+
+**Done when** Explorer copy, move, rename and delete, Word and Excel saves
+(temp file, then rename), VS Code and `robocopy /MIR` all work, data hashes
+match, and agreed `smbtorture` smb2 suites pass.
+
+### Phase 3: product integration, shipped as experimental
+
+- `fileservers.Server` entry (`ID: "smb"`), a settings page, connection help, and
+  system locale strings. Popups use `ssdialog`.
+- User activation, encrypted credential store, revocation, IP checks, login
+  delay, auth log, and a connected clients list.
+- Mutual exclusion with Samba, and a clear message when 445 is taken.
+- Optional import of existing hashes from `pdbedit -Lw`, so Samba users need not
+  set a password again.
+
+**Done when** a fresh install can enable SMB and connect from Windows with no
+terminal use. The Samba wrapper stays available.
+
+### Phase 4: every drive type
+
+- Staged handles with admin limits and interim responses.
+- `cluster:/`, S3, FTP and WebDAV, plus checks on `smb` and `sftp`.
+- Cluster activation and the NTLM verify over ACN if wanted.
+
+**Done when** Explorer can read, edit and save on each drive type, and a failed
+upload is reported and loses no data.
+
+### Phase 5: speed and resilience
+
+- Oplocks and leases, **with breaks working first**.
+- Durable handles, so open files survive Wi-Fi drops and sleep.
+- AES-128/256 GCM and CCM encryption, with a per-share "require" option.
+- Server-side copy, and notify from in-server events plus light polling of
+  watched folders only, which works on every drive type with no new dependency.
+
+**Done when** the TCP cut tests pass during a copy, encrypted sessions pass the
+Phase 2 set, and throughput is within an agreed range of Samba on the same box.
+
+### Phase 6: reach and extras
+
+- WS-Discovery responder (UDP 3702, TCP 5357) for the Network view, and
+  `_smb._tcp` through `mod/network/mdns`.
+- macOS and iOS: named streams and the Apple extensions.
+- Previous Versions backed by `localversion`, and deletes into ArozOS trash.
+
+### Phase 7: after NTLM
+
+- Follow the Samba local KDC work, and evaluate IAKerb with a small built-in KDC.
+- Decide when the built-in server replaces the Samba wrapper, then remove it.
+- Optional: SMB over QUIC for safe remote access.
+
+## 10. Testing
+
+**This PC cannot test Explorer against a local server.** Windows owns 445 here,
+build 19045 has no alternate port client, and WSL has no distribution. Needed:
+
+- a Linux machine or VM with its own IP address, so that Explorer reaches a real
+  445. A Raspberry Pi, or a Hyper-V or VirtualBox guest on this PC, would do;
+- a Windows 11 24H2+ client as well as this Windows 10 one, because the signing
+  and guest defaults differ.
+
+| Layer | Tool | Runs |
+|---|---|---|
+| Unit | Go tests, MS-NLMP and signing vectors, fuzzing | Every push |
+| Integration | `hirochachacha/go-smb2`, already in `go.mod` | Every push |
+| Real clients | `smbclient` and a Linux `cifs` mount | CI |
+| Windows | `net use /TCPPORT` on a Windows Server 2025 runner, as softwarity does | CI |
+| Windows on 445 | Explorer, Office and `robocopy` against the Linux host | Each phase |
+| Conformance | `smbtorture`, Microsoft's MIT-licensed WindowsProtocolTestSuites | Phase 2 onward |
+| Resilience | Cut TCP during copies, large file hashes | Phase 5 |
+
+Also build a small logging proxy early. Windows reports defects as vague errors
+long after the cause, so a trace of each command and status saves a lot of time.
+
+## 11. Risks
+
+| Risk | Impact | Mitigation |
+|---|---|---|
+| A client behaviour no document mentions | Schedule | Real clients from Phase 1, trace proxy, go/no-go gate |
+| Silent data corruption | Severe | No caching grants until breaks work, hash tests, flush maps to `Sync`, staged data kept on failure |
+| Security flaw in a root process | Severe | Section 7 limits, fuzzing, private networks by default, experimental label first |
+| NTLM turned off by default | High, long term | Admin re-enable at first; Kerberos keys stored from the start; Phase 7 |
+| Slow on small boards | Medium | Measure in Phase 0; prefer GMAC where the client allows it |
+| Long-term ownership of a protocol server | Medium | Narrow scope, conformance suites in CI, Samba wrapper kept until proven |
+| Hash stored on the server | Medium | Dedicated SMB password, encrypted at rest, revocable |
+| Staged saves on slow remotes | Medium | Size limit, interim responses, documented behaviour |
+
+## 12. Decisions needed
+
+1. **Approach:** write it in the tree (recommended), or fork a library?
+2. **Passwords:** a dedicated SMB password (recommended), or reuse the login
+   password and hook every password change?
+3. **Samba wrapper:** keep it until the built-in server has proven itself
+   (recommended), or replace it at Phase 3?
+4. **Windows hosts:** accept alternate port only (recommended)?
+5. **First target:** Phases 0 to 3 as the first release (recommended)?
+6. **Test hardware:** which Linux box and Windows 11 24H2+ client can Phase 0 use?
+
+## Sources
+
+- [SMB security hardening](https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-security-hardening), Microsoft Learn: signing, guest, NTLM blocking, rate limiter
+- [Configure alternative SMB ports](https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-ports), Microsoft Learn
+- [Accessing a third-party NAS with SMB in Windows 11 24H2 may fail](https://techcommunity.microsoft.com/blog/filecab/accessing-a-third-party-nas-with-smb-in-windows-11-24h2-may-fail/4154300), Microsoft
+- [Retiring NTLM: frequently asked questions](https://techcommunity.microsoft.com/blog/windows-itpro-blog/retiring-ntlm-frequently-asked-questions/4550522), Microsoft
+- [sambaXP](https://sambaxp.org/): local KDC and IAKerb talk abstract
+- [Eliminating NTLM in Storage](https://www.snia.org/sniadeveloper/session/19287), SNIA
+- [WindowsProtocolTestSuites](https://github.com/microsoft/WindowsProtocolTestSuites), Microsoft
+- `go-smb-server` PRs [#3](https://github.com/sonroyaalmerol/go-smb-server/pull/3), [#5](https://github.com/sonroyaalmerol/go-smb-server/pull/5), [#6](https://github.com/sonroyaalmerol/go-smb-server/pull/6), [#12](https://github.com/sonroyaalmerol/go-smb-server/pull/12)
+- [Verifying with Windows](https://github.com/go-filesystems/smb/blob/main/docs/verifying-with-windows.md), go-filesystems/smb