Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ documents for different readers.
at all. Every pinned digest is also scanned weekly for fixable HIGH and
CRITICAL CVEs, and each image with findings has an open issue until a scan
finds it clean.
- **Documented decisions and runbooks.** 132 ADRs covering what was chosen
- **Documented decisions and runbooks.** 134 ADRs covering what was chosen
and what was rejected — including the costs accepted knowingly; 56
runbooks for the operations that are easy to get wrong at 1am, one of which
is the handover page a successor reads first. Every critical alert links to
Expand Down Expand Up @@ -236,7 +236,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology
│ ├── architecture.md network.md hardware.md
│ ├── observability.md security.md roadmap.md changelog.md
│ ├── diagrams/ # the network diagram (SVG) and its predecessors
│ ├── adr/ # 132 ADRs — architecture decision records
│ ├── adr/ # 134 ADRs — architecture decision records
│ ├── exercises/ # purple-team exercise records — see its README
│ └── runbooks/ # 56 runbooks; successor-handover.md is the front door
└── Makefile # make help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
> ([`build-the-nas.md`](../runbooks/build-the-nas.md) §6.8). Its staleness
> rule is its own, `ZpoolVdevStateStale` at ten minutes, because
> `SmartStateStale`'s two days would blind a five-minute signal for two days.
>
> **Decision 4's open question is decided, 2026-11.**
> [ADR-0133](0133-turn-truenas-connect-off-on-smaug.md) turns TrueNAS Connect
> off on `smaug`, so the second, informational channel decision 4 describes
> goes away, and TrueNAS's own alerts stay in the web UI.

## Context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and a second SMB user to the share
[`build-the-nas.md`](../runbooks/build-the-nas.md) §5 created; decides
[#523](https://github.com/Gerrrt/HomeLab/issues/523)

> [!NOTE]
> **The deferral in decision 3 is decided, 2026-11.**
> [ADR-0134](0134-make-the-televisions-smb-user-read-only-on-the-media-share.md)
> makes `bilbo` read-only: the share's ACL grants Modify to `samwise` by name
> instead of to `builtin_users`. The text below is left as written, per
> ADR-0001.

## Context

`erebor/media` has been shared as `media` since 2026-09-18, with one SMB user,
Expand Down
74 changes: 74 additions & 0 deletions docs/adr/0133-turn-truenas-connect-off-on-smaug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ADR-0133: Turn TrueNAS Connect off on `smaug`

**Status:** Accepted · 2026-11 · amends
[ADR-0047](0047-collect-smaug-smart-through-a-root-cron-and-the-textfile-collector.md),
deciding the egress question its fourth decision left open

## Context

[ADR-0016](0016-open-casabonita-inward-and-keep-it-terminal-outward.md) keeps
CasaBonita terminal outward: more trusted segments reach in, and nothing on
VLAN 40 starts a connection into the estate. `network.md` gives the segment
the internet, and `smaug` one exception inward, `Allow NUT from smaug` to its
own gateway.

TrueNAS Connect is a connection `smaug` starts to the vendor's cloud. It is
internet egress, so it does not break ADR-0016, as ADR-0047 noted. What it
is instead is a vendor account registered to the appliance that holds the
backup datastore, which this repository neither configures nor tests. It was
on from the first boot, and emailed the faulted Exos's alert to the
operator's mailbox 37 s after it fired on 2026-09-20
([`replace-the-nas-disk.md`](../runbooks/replace-the-nas-disk.md)).
ADR-0047 named it "a second channel" and left "whether `smaug`
should keep initiating a connection to TrueNAS Connect at all" undecided.

A read-only audit of `smaug` on 2026-11-13 found it still enabled and
registered: `tn_connect.config` read `enabled: true, status: CONFIGURED`, and
the box held a `truenas_connect_*` certificate for a `truenas.direct` name,
valid to 2026-12-15. `network.md` and `security.md` did not list it.

What it bought in September no longer needs it. The faulted leaf it caught
was invisible to Prometheus at the time, and has not been since §6.8 of
[`build-the-nas.md`](../runbooks/build-the-nas.md) was done on 2026-10-02:
`ZpoolVdevNotOnline` and `ZpoolVdevErrors` page per leaf, `SmartDriveBadSectors`
and its siblings page per disk since §6.4, and `ZpoolNotOnline` covers the
pool. Each of them pages a phone. TrueNAS Connect reached a mailbox.

## Decision

**TrueNAS Connect is turned off on `smaug`, and the registration is removed.**
`smaug` then starts no connection to anything but its gateway's NUT server,
its time and name servers, and the registries its image pulls come from.
[`build-the-nas.md`](../runbooks/build-the-nas.md)
§6.12 is the procedure and the proof.

**TrueNAS's own alerts stay where they are: the web UI.** No alert service is
configured in its place. The paging path for this host is the one ADR-0047
chose, Prometheus over the textfile collector, with the estate's rules, tests
and silences behind it.

## Alternatives considered

- **Keep it and record it.** Add it to `network.md`'s outbound list and
accept the residual. Rejected: it duplicates a path that already pages,
and what it adds is an untested vendor channel into the appliance that
holds the backup datastore.
- **Mail the alerts another way**, with TrueNAS's SMTP alert service.
Rejected for ADR-0047's reason: it is a second alerting path, with none of
the estate's rules, tests or silences behind it.

## Consequences

- **No vendor account is registered to `smaug`.** The documents never
recorded one, and now there is none to record.
- **Some TrueNAS alert classes now reach only the web UI**: a failed periodic
snapshot task, a failed cron job, a scrub that did not run. The ones that
matter for data loss have Prometheus counterparts. The cron jobs that feed
the textfile collector have staleness rules (`SmartStateStale`,
`ZpoolVdevStateStale`, `CertExpiryStateStale`). A failed snapshot task has
none, and is the gap to watch. Reopen this if it bites.
- **The `truenas_connect_*` certificate goes with the registration.** The UI
keeps its self-signed certificate, which `collect-cert-expiry.sh` already
watches, and is reached from Hicks on `443`, as `network.md` says.
- Turning it back on is a new ADR, because it is a vendor channel into the
backup datastore's host.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ADR-0134: Make the televisions' SMB user read-only on the media share

**Status:** Accepted · 2026-11 · amends
[ADR-0051](0051-let-hicks-workstations-mount-the-media-share-as-a-user-of-their-own.md),
deciding the change its third decision deferred

## Context

The `media` share on `erebor/media` was created from TrueNAS's SMB preset,
whose ACL grants `builtin_users` Modify. Every SMB user joins that group when
it is created, so `bilbo`, the credential stored on the televisions, can
write, rename and delete the library
([`build-the-nas.md`](../runbooks/build-the-nas.md) §5).

ADR-0051 gave workstations their own user, `samwise`, so that the
credential typed on workstations is not the one living on televisions, and
the two can be revoked apart. It considered making `bilbo` read-only and
deferred it, because "it means changing the share's ACL, which is a separate
change with its own test".

A read-only audit of `smaug` on 2026-11-13 read the ACL as five entries:
`owner@` and `group@` (root), `builtin_users` Modify,
`builtin_administrators` Full Control, and `everyone@` Basic Read with
inheritance. `builtin_users` held `bilbo`, `samwise` and the local admin
account.

The televisions run firmware nobody can audit, with a permanent internet
connection and no patch guarantee: `network.md` gives CasaBonita a guest's
trust for that reason. A television never needs to write the library. It
plays through Jellyfin, or reads files over SMB. And `erebor/media` is not
snapshotted, so a delete or an encryption from a television is final.

## Decision

**`bilbo` reads the library and writes nothing.** The share's ACL loses the
preset's `builtin_users` Modify entry, gains a `samwise` user entry with
Modify and inheritance, and is applied recursively. `bilbo` keeps read access
through the existing `everyone@` Basic Read entry, the same entry Jellyfin
reads by as uid 65534. Nothing else changes: the users, the share, the `445`
pass and the services' read-only mounts.

**Write access to the library is granted to users by name, never to a group
every SMB user joins.** A future SMB user starts read-only.

[`build-the-nas.md`](../runbooks/build-the-nas.md) §5 is the procedure, with
the test ADR-0051 asked for: `bilbo` is refused a write and still reads,
`samwise` writes and deletes, and Jellyfin still plays.

## Alternatives considered

- **Leave it, and accept the residual.** Rejected: the cost of the change is
one ACL edit, and the residual is the whole library on a device class the
estate trusts least.
- **A read-only share for the televisions beside a writable one.** Two shares
on one dataset, with `bilbo` on one and `samwise` on the other. It works,
but the ACL already expresses the difference, and a second share is a
second thing to keep in step.
- **Snapshot `erebor/media` instead.** It would undo a delete, but not keep
one from happening, and the library's size makes it a capacity decision.
ADR-0051 left it separate, and so does this one.

## Consequences

- **A compromised television can read the library and nothing more.** That
was already true of what Jellyfin exposes. It is now true of SMB too.
- **The local admin account loses write through `builtin_users`** and keeps
Full Control through `builtin_administrators`. Nothing in the estate writes
the library as that account.
- **MakeMKV's rips are unaffected.** It writes `rips/` as 65534, its owner
([ADR-0114](0114-rip-discs-on-smaug-with-makemkv-started-only-to-rip.md)),
and a person moves the result into `movies/` as `samwise`.
- **A recursive ACL apply rewrites every file's entries.** On a library of
about 31 MiB it is instant. On a full one it takes longer, and is still
one operation.
5 changes: 5 additions & 0 deletions docs/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ Televisions and consoles. Internet only.
segment, so the *Reaches* column is unchanged. The pass narrows rather than
opens: before it, *Allow internet* already passed the whole segment to that
address, and the block is what keeps the televisions off the listener.
**Its internet egress also carries TrueNAS Connect**, the vendor's cloud
service, registered on `smaug` since its first boot and read as enabled on
2026-11-13. [ADR-0133](adr/0133-turn-truenas-connect-off-on-smaug.md)
turns it off; [`build-the-nas.md`](runbooks/build-the-nas.md) §6.12 is
the procedure, and until that is done the registration stands.
- **Three rules from `trinity` to `mediatv`, in force since 2026-10-19:**
`10.0.99.40 → 10.0.40.40`, passing `3001/tcp` for Home Assistant's LG
webOS integration and `9/udp` for the magic packet that wakes the TV, and
Expand Down
96 changes: 93 additions & 3 deletions docs/runbooks/build-the-nas.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,13 @@ Have a Hicks workstation and a shell on `morpheus` ready.

1. **The user.** **Credentials → Users → Add**: `samwise`, with SMB on and
TrueNAS access, shell, SSH and sudo all off, the same shape as `bilbo`. It
joins `builtin_users` on creation, and the share's ACL already grants that
group Modify, so no ACL edit is needed. Its password is typed on
workstations only; it never goes into a television. Do not reuse `bilbo`'s.
joins `builtin_users` on creation, and the share's preset ACL grants that
group Modify. *Make `bilbo` read-only* below replaces that grant with one
to `samwise` by name. On a rebuild, do its steps 1–3, the ACL change,
right after this step. Its tests wait for what they test, as that section
says. Its
password is typed on workstations only; it never goes into a television.
Do not reuse `bilbo`'s.

2. **SMB1 is off.** **System → Services → SMB → Edit**: *Enable SMB1 support*
must be clear. Every client here speaks SMB 2 or 3, and `445` is the only
Expand All @@ -669,6 +673,48 @@ Have a Hicks workstation and a shell on `morpheus` ready.
counts in `network.md`, `security.md` and `stacks/media/README.md` from
*specified* to *created*, in one commit, the way `4533` was.

### Make `bilbo` read-only

[ADR-0134](../adr/0134-make-the-televisions-smb-user-read-only-on-the-media-share.md).
The televisions' credential reads the library and writes nothing; write is
granted to `samwise` by name. Have a Hicks workstation, and a television or
any machine that can mount the share as `bilbo`.

Steps 4–6 test the change. On a running host, run them now. On a rebuild,
each waits for what it depends on:

- Step 4 needs a mount as `bilbo`. A device on CasaBonita can do it at once.
A Hicks workstation needs the `445` pass from *Workstations* step 3.
- Step 5 needs that pass.
- Step 6 needs Jellyfin, which §6 brings up.

Run each when its dependency exists. A test that fails before then has failed
on the order of the steps, not on the ACL.

1. **Read the ACL first.** **Datasets → `erebor/media` → Permissions → Edit**.
It should list the five entries §5's note records: `owner@`, `group@`,
`builtin_users` Modify, `builtin_administrators` Full Control, and
`everyone@` Basic Read with inheritance. If it does not, stop and record
what it does list.
2. **Change two entries.** Add a **User** entry for `samwise`: Allow, Basic
**Modify**, flags Basic **Inherit**. Then delete the `builtin_users` entry.
Leave `everyone@` exactly as it is; it is `bilbo`'s read and Jellyfin's.
3. **Apply it recursively.** Tick *Apply permissions recursively* and save,
so every file already in the library carries the new entries and not the
old inherited ones.
4. **`bilbo` is refused a write and still reads.** Mount
`\\10.0.40.30\media` as `bilbo`, open a file, then try to copy a small
file in. The open succeeds and the copy is refused.
5. **`samwise` writes and deletes.** From the Hicks workstation, mount as
`samwise`, copy the same small file in, then delete it. Both succeed.
6. **Jellyfin still plays**, on a television, a title that was in the
library before step 3.
7. **Record it here**: the date, the ACL as it now reads, and the three
results. Then change §5's note and `security.md`'s `445` paragraph from
*decided* to *done*, in one commit.

> **Not yet done.** Decided 2026-11-13.

## §5b — The ISO store, for `Saruman`

[ADR-0072](../adr/0072-put-the-iso-store-on-smaug-over-nfs-to-saruman-alone.md),
Expand Down Expand Up @@ -2192,6 +2238,50 @@ measured.
documents from *specified* to *created*, in one commit, the way `4533`
was.

### §6.12 — Turn TrueNAS Connect off

[ADR-0133](../adr/0133-turn-truenas-connect-off-on-smaug.md). TrueNAS
Connect was on from the first boot, and nothing in this repository set it up
or tests it. Prometheus is this host's paging path: `ZpoolVdevNotOnline`,
`ZpoolNotOnline` and the `SmartDrive*` rules, from §6.4 and §6.8.

1. **Prove the paging path first, for this host and as far as the phone.**
A sample proves less than it looks: node_exporter re-serves a textfile's
last contents after its cron job stops, so a series can be present and
stale. On the monitoring host's Prometheus:
- **Coverage.** `up{instance="smaug"}` is `1`.
`count(homelab_smart_healthy{host="smaug"})` is `3`: both Exos and the
boot SSD. `homelab_zpool_vdev_state{host="smaug",pool="erebor"}` names
both of the mirror's leaves.
- **Freshness.** Run
`time() - node_textfile_mtime_seconds{instance="smaug",file=~".*(smart|zpool)-state-.*"}`.
The `smart-state` file must be under `172800` (two days) and the
`zpool-state` file under `600` (ten minutes). Neither `SmartStateStale`
nor `ZpoolVdevStateStale` may be firing. Those two rules are what make
a quiet collector loud.
- **Delivery.** The `Watchdog`'s daily notification has reached the phone
in the last day. If it has not, or the external heartbeat check has
never been seen to go red, run *Confirming it actually works* in
[`verify-the-alert-path.md`](verify-the-alert-path.md) first.

If any of these fails, fix it before turning off the other channel.
2. **Turn it off in the UI.** Open TrueNAS Connect's settings in the web
UI, disable the service and remove the registration. Then, in the
vendor's TrueNAS Connect portal, remove `smaug` from the account.
3. **Read it from the console shell**:

```bash
midclt call tn_connect.config | python3 -c 'import sys,json;d=json.load(sys.stdin);print(d["enabled"],d["status"])'
```

It prints `False` and a status that is not `CONFIGURED`.
4. **The certificate goes.** **Credentials → Certificates**: no
`truenas_connect_*` entry is left. If one is, delete it. The UI's own
certificate, under System → General → GUI, is unchanged.
5. **Record it here**: the date and the two readings.

> **Not yet done.** Decided 2026-11-13.

## §7 — Verify

> **As of 2026-09-19:** the monitoring-host line holds in both halves, the
Expand Down
8 changes: 7 additions & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,13 @@ carries: a workstation holding the password can delete or encrypt the library,
and `erebor/media` is not snapshotted. The library is replaceable (ADR-0008),
so this is accepted. What limits it is the user: `samwise` is a second SMB
user, typed on workstations and never stored on a television, so the
televisions' `bilbo` and the workstations' credential are revoked apart. The
televisions' `bilbo` and the workstations' credential are revoked apart.
Both can still write the library today, through the preset's `builtin_users`
Modify entry.
[ADR-0134](adr/0134-make-the-televisions-smb-user-read-only-on-the-media-share.md)
makes `bilbo` read-only and grants write to `samwise` by name;
[`build-the-nas.md`](runbooks/build-the-nas.md) §5 *Make `bilbo` read-only*
is the change, and it is not yet done. The
same pass puts an SMB login prompt in front of everything on Hicks, the
corporate laptop included, as `443` already puts the TrueNAS one.
**One more is from ImaginationLAN, and it exists.**
Expand Down