Переглянути джерело

docs: explain security through obscurity honestly and audit every page that suggests moving a port (#230) (#284)

* docs: explain security through obscurity honestly and audit port-move wording (#230)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* docs: correct the scan-speed claim and add the port-move audit record (#230)

A default full-range scan takes minutes; seconds needs a fast scanner on a good
link. Add the grep audit the issue asks for, in docs/superpowers/specs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
ChiefGyk3D 1 місяць тому
батько
коміт
a85d09d025

+ 3 - 2
docs/superpowers/specs/2026-10-19-edge-dmz-design.md

@@ -147,7 +147,7 @@ One droplet, tagged `rns-dmz`, with a role tag as well (`rns-dmz-transport`) so
 | Surface | Reachable from | How |
 |---|---|---|
 | Reticulum `TCPServerInterface` (4242 unless config says otherwise) | The internet | Cloud Firewall and nftables |
-| i2pd pinned inbound port, TCP and UDP | The internet | Same |
+| i2pd inbound port, TCP and UDP | Nobody until the i2pd stack is built (ruling 11); then the internet | Same. i2pd picks the port; it is not pinned |
 | Meshtastic MQTT over TLS, 8883 | The internet; authentication required, no anonymous access | Same |
 | iperf3, 5201 | The maintainer's home WAN IP and the core connectors' egress addresses only | Source-restricted rule; built-in iperf3 RSA auth on top |
 | SSH, any admin port | Nowhere | There is none |
@@ -179,7 +179,7 @@ Cloud Firewall limits that matter here, read from https://docs.digitalocean.com/
 
 ### 4.5 Services
 
-Per the handoff: `rnsd` with `enable_transport = Yes` and a `TCPServerInterface`; `lxmd` as a propagation node with storage and transfer limits; i2pd with SAM on loopback, a pinned inbound port and capped transit; Mosquitto with TLS and authentication, private broker for the maintainer's nodes by default; iperf3 with `--rsa-private-key-path` and `--authorized-users-path`, key material from Doppler. Option names for Reticulum, lxmd and i2pd have changed between releases, and whether the distro's iperf3 is built with OpenSSL auth support is UNVERIFIED. The implementation PR checks each against the version it pins and records the link, as the handoff requires.
+Per the handoff: `rnsd` with `enable_transport = Yes` and a `TCPServerInterface`; `lxmd` as a propagation node with storage and transfer limits; i2pd with SAM on loopback, an inbound port that stays closed until the i2pd stack is built and that i2pd then picks at random (ruling 11, not a security measure), and capped transit; Mosquitto with TLS and authentication, private broker for the maintainer's nodes by default; iperf3 with `--rsa-private-key-path` and `--authorized-users-path`, key material from Doppler. Option names for Reticulum, lxmd and i2pd have changed between releases, and whether the distro's iperf3 is built with OpenSSL auth support is UNVERIFIED. The implementation PR checks each against the version it pins and records the link, as the handoff requires.
 
 Memory is the open fact. Five daemons on 1 GiB, with no swap, has not been measured. It is the reason section 5 prices a 2 GiB variant.
 
@@ -443,6 +443,7 @@ Decisions the maintainer owed (my pick in the third column, his ruling in the fo
 | 8 | Transfer: accept it as a watched usage line, with a billing alert before the first apply | Accept, once Reticulum has a stated rate cap (section 5.7) | DECIDED 2026-10-19: tracked as a watched usage line plus a billing alert, once Reticulum has a rate cap |
 | 9 | Ingest protocol and relay controls (section 4.6.1) | Not mine to pick; the home-side design owns them, and approval waits for it | NOT ruled: owned by the home-side relay/ingest design |
 | 10 | The core connector firewall gets TCP 5201 outbound for the ZTNA path (section 4.3) | Accept in the implementation PR, with the ZTNA path conditional on the two checks there | DECIDED 2026-10-19: TCP 5201 outbound rule on the core connector firewall, added in the implementation PR |
+| 11 | The i2pd inbound port (issue #122, ruled 2026-10-22) | n/a | RULED 2026-10-22: the i2pd inbound port stays closed until the i2pd stack is built. Then i2pd picks a random port, as an I2P router does by design, and the firewall rule follows what it picked. This is not claimed as a security measure: a scanner finds any open port, so the controls are the ones in section 3 (patching by rebuild, least privilege, default-deny firewall, rate and transit caps, detection). See [What does not count as protection](../../wiki/Plan-for-Failure-Blast-Radius-and-Assuming-Breach.md#what-does-not-count-as-protection) |
 
 Before decision 4 can be anything but provisional, these have to be confirmed: the price and limits of a separate DigitalOcean team; whether credentials and Spacelift contexts can be isolated per team; how transfer pooling works across teams; how DigitalOcean's abuse handling treats a team and what it can suspend; and how teardown of the edge team works. And an abuse-response runbook has to exist, with measurable thresholds. Proposed starting values, mine, not measured, for the maintainer to set: alert at 80 percent of the monthly transfer cap; alert if two consecutive days each exceed twice the daily share of that cap; alert at 80 percent of the `lxmd` storage cap; any provider abuse notice answered, and the named service switched off by a pull request and a rebuild, within a target of 24 hours (the provider's own response window is UNVERIFIED).
 

+ 68 - 0
docs/superpowers/specs/2026-10-30-port-move-audit-230.md

@@ -0,0 +1,68 @@
+# Port-move audit (issue #230)
+
+Done-when for #230: "a grep audit that lists each place checked and what changed". Audit records in this repository live in `docs/superpowers/specs/` (see [the foundations gap audit](2026-10-22-foundations-gap-audit.md)), so this one does too. The question: does any page present moving a service to another port as protection? The maintainer's position is that it is security through obscurity. A scanner finds any open port, and a full-range scan takes minutes on a default run and seconds with a fast scanner on a good link.
+
+The check is also a test, `tests/test_no_port_move_as_protection.py`. This record was derived by re-running its patterns against `origin/main` (before the change) and against this branch (after), not from memory.
+
+## What was checked
+
+| Scope | Files | How |
+|---|---|---|
+| `docs/wiki/*.md` (without `Contents.md`, `_Sidebar.md`, `_Footer.md`), `docs/stages/*.md`, `README.md` | 124 files | The test's `PORT_MOVE` and `SERVICE` patterns, then the `HONEST` pattern |
+| `docs/superpowers/specs/`, `docs/superpowers/plans/`, `docs/threat-model/README.md`, plus the three scopes above | all files | Plain `grep -rniE` with the patterns below (not in the test) |
+
+Patterns (case-insensitive):
+
+1. `PORT_MOVE`: `(non-?standard|odd|unusual|alternate|alternative|different|another|high|random|other than 22)\s+(tcp\s+)?port`, or `(move|moves|moved|moving|change|changes|changed|changing)` within 40 characters before `port`, or `port` within 20 characters before `move|moved|change|changed`, or `its own port`.
+2. `SERVICE` on the same line: `ssh|sshd|rdp|telnet|management|admin|service|daemon|login|server`.
+3. `HONEST` on the same line passes the line: the move is called not a protection, obscurity, log noise, functional, and similar.
+4. Extra greps over the design docs: `non-?standard port`; `odd port|unusual port|alternate port|different port|another port|high port|random port|other than 22`; `20222`; `pinned (inbound )?port|pins? the port|fixed port`; `obscurity`.
+
+## Result of the wiki, stage and README scan
+
+Before (`origin/main`): 14 lines matched `PORT_MOVE` and `SERVICE`; 6 had no `HONEST` wording and failed. After: 17 lines match (three new honest lines were added); 0 fail. Counts are lines, not pages.
+
+## Lines that failed and what changed
+
+| File:line (on `origin/main`) | What it said | Change |
+|---|---|---|
+| `Deception-and-Honeypots-Cloud-Cowrie-Weekend.md:260` | Debian/Ubuntu SSH note: "a changed port surprising people" | Added "(a functional problem, not a security one)" |
+| `Deception-and-Honeypots-Cloud-Sensor-Anatomy.md:103` | Predict box: "giving real SSH a different port" | Added "(for function)" |
+| `Deception-and-Honeypots-T-Pot-at-Home.md:137` | Installer "changes the SSH port to 64295" | Added "(to free port 22 for its honeypots; that is function, not protection)" |
+| `Deception-and-Honeypots-T-Pot-at-Home.md:230` | Uninstall leaves "the changed SSH port" | Added "(a function change, not protection)" |
+| `Deception-and-Honeypots-T-Pot-at-Home.md:268` | Evidence table: installer changes the SSH port | Added "(for function, so the honeypots can use 22)" |
+| `Subnets-NAT-and-Firewalls-By-Hand.md:879` | Evade: admin "hides" a service on 20222 | Added "(security through obscurity)" |
+
+## Lines that passed already, with a small edit
+
+| File:line | What changed |
+|---|---|
+| `Deception-and-Honeypots-Cloud-Cowrie-Weekend.md:85` | None. Already says function, not a defense. A clause was added: a different port "makes your own logs quieter, which is not a security control" |
+| `Deception-and-Honeypots-Cloud-Sensor-Anatomy.md:49` | Added "(it is security through obscurity)" |
+
+## Lines that passed and were left alone
+
+`Cowrie-Weekend:245` (says "for function, not protection"), `Sensor-Anatomy:40`, `Sensor-Anatomy:147`, `Deception-and-Honeypots-Start-Here.md:49`, `Plan-for-Failure:113` (functional move, stated as such), `Subnets:774` and `Subnets:887` (the lab run that shows a scan finding the odd port in about two seconds; a full-range figure is already marked est.).
+
+## New text
+
+- `Plan-for-Failure-Blast-Radius-and-Assuming-Breach.md:100`: the "What does not count as protection" section states the position. Review fix: it said a scanner tries all 65,535 ports "in seconds"; it now says a default full-range scan takes minutes and a fast scanner on a good link can do it in seconds. The Subnets lab measured 401 ports in about two seconds, which is a small range, not a full scan.
+- `Droplet-Hardening.md:120`: says sshd stays on 22 and why, linking the section above. Wording aligned with the same figure.
+- `Threats-in-Plain-Words.md:392`: the Evade bullet links the section above.
+- `test_blast_radius_lesson.py`: the cap on pages linking the lesson went from 8 to 9 for the two new links (Droplet hardening, threats lesson).
+
+## Design docs (not scanned by the test)
+
+| File | Hit | Change |
+|---|---|---|
+| `specs/2026-10-19-edge-dmz-design.md` (exposure table and the handoff paragraph) | "pinned inbound port" for i2pd | Reworded: the port stays closed until the i2pd stack is built, then i2pd picks it at random, not as a security measure |
+| `specs/2026-10-19-edge-dmz-design.md` rulings table | no ruling on the i2pd port | Added ruling 11 (issue #122, ruled 2026-10-22), linking the lesson |
+| `plans/2026-10-12-edge-dmz-handoff.md:51` | "i2pd pinned inbound port" | Not changed. It is the original handoff record, which the design doc quotes and supersedes (ruling 11) |
+| `specs/2026-10-22-foundations-gap-audit.md:161` | "port" and "different" in an unrelated sentence (a firewall mini-loop) | None. False positive, not about moving a service |
+| `specs/2026-10-21-peertube-stage-design.md:137` | SMTP ports blocked by the provider | None. Not a port move |
+| `docs/stages/*.md`, `README.md`, other specs | `non-standard port`, `20222`, `obscurity`: no hits outside the wiki | None |
+| `docs/stages/01-access.md`, `aws-access.md` | "1-65535" outbound UDP range | None. A firewall range for Twingate peer-to-peer, not a port move |
+
+## Limits
+
+A phrase check finds common wording, not every possible one. A page that says "run it on 2222" with no "port" next to it would not match. The patterns were not widened for this audit.

+ 2 - 2
docs/wiki/Deception-and-Honeypots-Cloud-Cowrie-Weekend.md

@@ -82,7 +82,7 @@ The addresses below are documentation placeholders. In your shell you will use y
 |---|---|---|
 | `SENSOR` | `192.0.2.10` | The server's public address, which the provider shows you once it exists. |
 | `YOU` | `203.0.113.10` | **Your** public address, the only one allowed to reach the management port. Your router's status page shows it. It may change (most homes have a changing address): if it does you are locked out until you edit the firewall from your account console. |
-| `MGMT_PORT` | `49152` | The port real SSH uses, because Cowrie takes 22. It is a **function** choice, not a defense: a scanner finds any open port. The cloud firewall allowing only `YOU`, key-only login and no passwords are the controls; a different port at most makes your own logs quieter. Pick one between 1024 and 65535, not 22, 23, 2222 or 2223. |
+| `MGMT_PORT` | `49152` | The port real SSH uses, because Cowrie takes 22. It is a **function** choice, not a defense: a scanner finds any open port. The cloud firewall allowing only `YOU`, key-only login and no passwords are the controls; a different port at most makes your own logs quieter, which is not a security control. Pick one between 1024 and 65535, not 22, 23, 2222 or 2223. |
 
 Two firewalls, by tag, on the **cloud** side. The provider's pages (read 2026-10-22) say that when more than one firewall applies to a droplet, "the rules from every one of those firewalls are combined into a single set", that allow rules are additive, and that a firewall blocks "all traffic that isn't expressly permitted by a rule". That makes the second firewall easy to remove:
 
@@ -257,7 +257,7 @@ sshd -t && systemctl restart ssh
 ss -ltnp | grep sshd
 ```
 
-(`49152` is `MGMT_PORT`; use yours. Debian 12's main SSH configuration includes the files in `/etc/ssh/sshd_config.d/`, est. Ubuntu has started SSH from a systemd socket since 22.10, and forum posts show a changed port surprising people, which is one reason this lesson uses Debian.) Then, from a **second** terminal on your computer:
+(`49152` is `MGMT_PORT`; use yours. Debian 12's main SSH configuration includes the files in `/etc/ssh/sshd_config.d/`, est. Ubuntu has started SSH from a systemd socket since 22.10, and forum posts show a changed port surprising people (a functional problem, not a security one), which is one reason this lesson uses Debian.) Then, from a **second** terminal on your computer:
 
 ```bash
 ssh -p 49152 admin@SENSOR

+ 2 - 2
docs/wiki/Deception-and-Honeypots-Cloud-Sensor-Anatomy.md

@@ -46,7 +46,7 @@ Each row is a control with a reason and a way to check it. Lesson 8 builds every
 | # | Guardrail | Why | How you check it |
 |---|---|---|---|
 | 1 | **An account of its own**, holding nothing else, with its own payment method. | A provider acts on an account. A honeypot is built to draw complaints, and a suspension should land somewhere that holds nothing you need. The [honeypot design](https://github.com/ChiefGyk3D/Clouds-Against-Humanity/blob/main/docs/superpowers/specs/2026-10-21-honeypot-design.md) (section 3) says why a separate team or project in your main account is not enough. | The account's resource list shows the sensor, its firewall and nothing else. |
-| 2 | **A separate management path**: real SSH on a port other than 22 (for function: the imitation needs 22), reachable **only from your own address** at the cloud firewall and again on the host, key-only, no passwords, no root login. | Port 22 now belongs to the imitation, so the operator needs another way in. **The new port number is not a protection**: anyone who scans finds it. What protects the door is the firewall allowing only your address, key-only login, no passwords, patching by rebuild, and logs you read. If real SSH were open to everyone, the first password-guesser would be guessing against your real door whatever its port. | From a machine that is not yours, the management port does not answer. From yours, it does. |
+| 2 | **A separate management path**: real SSH on a port other than 22 (for function: the imitation needs 22), reachable **only from your own address** at the cloud firewall and again on the host, key-only, no passwords, no root login. | Port 22 now belongs to the imitation, so the operator needs another way in. **The new port number is not a protection** (it is security through obscurity): anyone who scans finds it. What protects the door is the firewall allowing only your address, key-only login, no passwords, patching by rebuild, and logs you read. If real SSH were open to everyone, the first password-guesser would be guessing against your real door whatever its port. | From a machine that is not yours, the management port does not answer. From yours, it does. |
 | 3 | **Only the lure ports are open to everyone**: 22 and, if you chose it, 23. | A honeypot is exposed on purpose; nothing else should be. | The firewall lists exactly the rows in the table in lesson 8. |
 | 4 | **Nothing real on the box.** No real files, keys, tokens, passwords or accounts, and no key that opens anything else. | The sensor will be attacked, and a clever visitor may get past the imitation. Whatever is on it is lost. | Read the machine's files and its user-data once, before exposing it. |
 | 5 | **No route to anything else of yours.** No peering, no tunnel, no VPN client, no Twingate connector or client on the box, no stored key for another machine. | A taken-over sensor with a path home is a way in. Twingate is how this project reaches private things; the sensor must have none of that. | The account has no other resources; the box has no software that joins a private network. |
@@ -100,7 +100,7 @@ What that means for you: expect mostly automated visitors, repeating a short scr
 
 ## Exercise: review the plan on paper
 
-**Predict.** Before you read anything else: which of the nine guardrails do you think a first-time builder is most likely to get wrong? Write it down. (The author's guess is the management path: giving real SSH a different port and locking it to one address is the step where people lock themselves out.)
+**Predict.** Before you read anything else: which of the nine guardrails do you think a first-time builder is most likely to get wrong? Write it down. (The author's guess is the management path: giving real SSH a different port (for function) and locking it to one address is the step where people lock themselves out.)
 
 **Do.**
 

+ 3 - 3
docs/wiki/Deception-and-Honeypots-T-Pot-at-Home.md

@@ -134,7 +134,7 @@ less ~/tpotce/install.sh                           # read it; q to quit
 
 A clone of a tag is in a "detached HEAD" state (it points at a fixed release, not a moving branch), which is what you want for a pin. The default-branch README says the installer prints what it settled on before it changes anything: read that line and stop if it is not the release you meant. Whether the 24.04.1 tag's own installer behaves the same was not read. If you choose the newer default branch instead, clone without `--branch`, read the default-branch README, and write down the commit (`git -C ~/tpotce rev-parse HEAD`) so you can say what you ran.
 
-**5. Know what the installer changes.** The README lists, among others: it **changes the SSH port to 64295**, **disables the DNS stub listener**, sets SELinux (a Linux access-control system) to monitor mode, **sets the firewall target for the public zone to ACCEPT**, installs Docker, and **adds your user to the `docker` group**. Two consequences. First, the host's own firewall is opened up, so **your network firewall is the wall**; this is why the design page tests it first. Second, membership of the `docker` group is effectively root on that machine (est.; widely documented), which is fine on a disposable decoy and a reason never to reuse that account anywhere else.
+**5. Know what the installer changes.** The README lists, among others: it **changes the SSH port to 64295** (to free port 22 for its honeypots; that is function, not protection), **disables the DNS stub listener**, sets SELinux (a Linux access-control system) to monitor mode, **sets the firewall target for the public zone to ACCEPT**, installs Docker, and **adds your user to the `docker` group**. Two consequences. First, the host's own firewall is opened up, so **your network firewall is the wall**; this is why the design page tests it first. Second, membership of the `docker` group is effectively root on that machine (est.; widely documented), which is fine on a disposable decoy and a reason never to reuse that account anywhere else.
 
 **6. Opt out of data sharing now**, before rebooting: do steps 2 and 3 of the opt-out (open the file, delete the block) and skip the stop and start, since the reboot comes next.
 
@@ -227,7 +227,7 @@ Do this when you finish, or on the end date you wrote in your [one-page plan](De
 
 1. **Decide what to keep.** Counts and a short written summary may be worth keeping. Raw logs are not. Copy nothing off the decoy that you would not publish.
 2. **Stop it:** `systemctl stop tpot` (README).
-3. **Uninstall, if you will reuse the machine:** `~/tpotce/uninstall.sh`, then `sudo reboot` (README; only on supported distributions). The README does not say what it leaves behind. Expect Docker, the changed SSH port and the `docker` group membership to remain (est.), which is why the next step exists.
+3. **Uninstall, if you will reuse the machine:** `~/tpotce/uninstall.sh`, then `sudo reboot` (README; only on supported distributions). The README does not say what it leaves behind. Expect Docker, the changed SSH port (a function change, not protection) and the `docker` group membership to remain (est.), which is why the next step exists.
 4. **Wipe or reimage the disk.** A machine that was built to be attacked is not worth trusting. Reinstall the operating system from scratch, or for a VM delete the VM and its disk file. The README's factory reset (delete `~/tpotce/data`, `git reset --hard`, reinstall) is for repairing T-Pot, not for decommissioning.
 5. **Data on disk.** Honeypot logs live in `~/tpotce/data` and persist for the number of cycles in `TPOT_PERSISTENCE_CYCLES` in `~/tpotce/.env` (default 30), and the Elasticsearch indices follow a 30-day policy by default. Wiping the disk removes both. Backups you made are yours to delete too.
 6. **Remove the network pieces,** in this order: the ZTNA resource or VPN rule for the decoy; the DHCP reservation; any DNS names; the firewall rules for the honeynet (**the LAN-to-honeynet pass, the admin pass, the update window and the block**); then the VLAN or the switch port and the interface. Restore the switch port to its normal use.
@@ -265,7 +265,7 @@ Retrieved 2026-10-22.
 | Sizes (Hive 16 GB / 256 GB SSD; Sensor 8 GB / 128 GB SSD), IPv4 and non-proxied internet need, VM and Raspberry Pi 4 notes, no desktop environment | Same, and the [24.04.1 README](https://raw.githubusercontent.com/telekom-security/tpotce/24.04.1/README.md) for the sizes | Read |
 | Required ports: management 64294, 64295, 64297; outgoing 80 and 443; honeypot port table; glutton and honeytrap bind unclaimed TCP ports | Same README, "Required Ports" and "System Placement" | Read |
 | Data submitted by default to Sicherheitstacho via `ewsposter`; opt out by removing the `# Ewsposter service` block; HPFEEDS is a separate opt-in; the README encourages not disabling it | Same README, "Disclaimer" and "Community Data Submission" | Read. That the opt-out holds after an update is **not stated** |
-| The installer changes the SSH port to 64295, disables the DNS stub listener, sets SELinux to monitor mode, sets the public firewall zone target to ACCEPT, installs Docker and adds the user to the docker group | Same README, "Get and install T-Pot" (also in the 24.04.1 README) | Read. That `docker` group membership is root-equivalent is **est.** (widely documented, not read here) |
+| The installer changes the SSH port to 64295 (for function, so the honeypots can use 22), disables the DNS stub listener, sets SELinux to monitor mode, sets the public firewall zone target to ACCEPT, installs Docker and adds the user to the docker group | Same README, "Get and install T-Pot" (also in the 24.04.1 README) | Read. That `docker` group membership is root-equivalent is **est.** (widely documented, not read here) |
 | `update.sh` "mercilessly" overwrites local changes; it writes a backup first; uninstall is `~/tpotce/uninstall.sh` then a reboot; logs are in `~/tpotce/data`, kept for `TPOT_PERSISTENCE_CYCLES` (default 30); the Elasticsearch policy keeps 30 days; a daily reboot is set up at install | Same README, "Maintenance", "Uninstall T-Pot", "Log Persistence", "Daily Reboot" | Read |
 | Latest tag 24.04.1, published 2024-12-11; repository last pushed 2026-10-21 (`pushed_at`); license GPL-3.0 | [GitHub API: tags](https://api.github.com/repos/telekom-security/tpotce/tags), [releases](https://api.github.com/repos/telekom-security/tpotce/releases/latest) and [repository](https://api.github.com/repos/telekom-security/tpotce) | Read |
 | The two READMEs list different operating systems; the installer "will stop on an older one"; `-b` takes a branch, tag or commit | Both READMEs | Read. Whether the 24.04.1 installer accepts `-b` is **not read** |

+ 2 - 0
docs/wiki/Droplet-Hardening.md

@@ -117,6 +117,8 @@ The DigitalOcean cloud firewall is the only inbound layer today. The `host_firew
 
 It changes `user_data`, so turning it on replaces the droplet, and it has **not been tested on a real droplet yet**. A wrong ruleset can lock you out of SSH. Stage it: `host_firewall = true` with `host_firewall_instances = ["a"]`, apply, check SSH through Twingate to that connector, and only then `["a", "b"]`. If you lose SSH, the Droplet Console in the DigitalOcean panel is believed to be an out-of-band path, but that is not tested; the documented fallback is to replace the droplet through OpenTofu (set `host_firewall` to false and apply, which is a replace). Rollback on a box you can still reach is `sudo nft delete table inet cah_host` or setting `host_firewall` to false.
 
+sshd stays on port 22. The port is not changed because a port move is security through obscurity: a scanner can check every port in minutes, so it would add no protection. The protection is the list above, plus a firewall that lets nothing in from the internet and Twingate as the only way to reach the private address. The reasoning, and what to do instead, is in [What does not count as protection](Plan-for-Failure-Blast-Radius-and-Assuming-Breach.md#what-does-not-count-as-protection).
+
 Ubuntu's `nftables.service` loads a file that begins with `flush ruleset` on start, restart and reload, and a package upgrade try-restarts it, so it could silently remove both this table and the metadata lock's. Both units are therefore `After=nftables.service` and `PartOf=nftables.service` (with `ReloadPropagatedFrom=` and an `ExecReload`), so a restart or reload of it re-runs our script and loads the table again. The link is soft, so a unit still starts when `nftables.service` is inactive. A plain `systemctl stop nftables` still flushes the ruleset. This is reasoning from the unit semantics and the unpacked package, not tested on a real machine. The verify and rollback commands are in the [stage 1 guide](https://github.com/ChiefGyk3D/Clouds-Against-Humanity/blob/main/docs/stages/01-access.md).
 
 ## IPv6 stays closed

+ 14 - 1
docs/wiki/Plan-for-Failure-Blast-Radius-and-Assuming-Breach.md

@@ -97,7 +97,20 @@ Not every choice here shrinks the radius. [Fork private stacks and the pipeline]
 
 ## What does not count as protection
 
-Changing a service to a nonstandard port, hiding a version banner, or renaming an admin page do not shrink a blast radius and do not stop an attack. They make casual scanning a little less noisy. They are **security through obscurity**: relying on the attacker not knowing a fact. An attacker who finds the service gets the same reach as before. Treat these as, at most, small noise reduction, never as one of the layers. [First hour on a new system](First-Hour-on-a-New-System-Updates-and-Baseline.md) makes the same point about banners and PHP.
+Changing a service to a nonstandard port, hiding a version banner, or renaming an admin page do not shrink a blast radius and do not stop an attack. They are **security through obscurity**: relying on the attacker not knowing a fact. The maintainer's position is that this is a flawed, one-trick idea. It works only until the attacker learns the fact, and learning it is cheap: a port scanner can try all 65,535 ports of a host (a default full-range scan takes minutes; a fast scanner on a good link can do it in seconds), and once it finds the service the attacker goes straight to it with the same reach as before. [First hour on a new system](First-Hour-on-a-New-System-Updates-and-Baseline.md) makes the same point about banners and PHP, and [Subnets, NAT and firewalls by hand](Subnets-NAT-and-Firewalls-By-Hand.md) runs the scan so you can watch it.
+
+Measures that work the same way every time, whether or not the attacker knows how you set things up:
+
+- **Patching.** The flaw is gone, so there is nothing left to find behind any port.
+- **Least privilege.** An account or service that can do little limits what a break-in buys.
+- **Key-only authentication.** There is no password to guess; see [Droplet hardening](Droplet-Hardening.md#login).
+- **A default-deny firewall.** Nothing is reachable unless a rule says who may reach it; see [DigitalOcean network and firewalls](DigitalOcean-Network-and-Firewalls.md).
+- **Rate limiting.** Guessing is slowed whatever it targets; see [Rate limiting at every layer](Rate-Limiting-at-Every-Layer.md).
+- **Detection.** Someone has to notice; see [Logs, SIEM and detection basics](Logs-SIEM-and-Detection-Basics.md).
+
+A non-default port can make your logs quieter, because the automated guessing aimed at the default port does not reach it. That is a log-noise effect and not a security control, and no page here counts it as a layer. Some software picks a random port by design, for example an I2P router, which chooses one when it is first set up. That is how the software works, and it is not claimed as protection either.
+
+Sometimes a port move is **functional**, and then the page says that is the reason. A honeypot needs port 22 for its lure, so the real management SSH has to live on another port ([Cloud Cowrie for a weekend](Deception-and-Honeypots-Cloud-Cowrie-Weekend.md)). The new number protects nothing; the protection is that only your address can reach it, with a key and no passwords.
 
 ## Honest limits
 

+ 1 - 1
docs/wiki/Subnets-NAT-and-Firewalls-By-Hand.md

@@ -876,7 +876,7 @@ table inet lab {
 
 The new rule's counter has packets on it, so something is using a rule you did not mean to have. A counter holds packet and byte totals only: it does **not** record who sent them, so on its own it cannot say whether the packets came from `oth`, from `cli` or from a stranger. Attribution needs one of two things. In the lab, a source-specific rule: add `ip saddr 10.78.0.30 tcp dport 8080 counter` above the broad one and run the check again; only that counter moves for `oth`. On a real machine, a `log` rule with a prefix, which writes the source address of each matching packet to the kernel log (read it with `journalctl -k` or `dmesg`; the cloud path below does exactly this). `-a` shows each rule's **handle**, the number you use to delete it. The packet counts are small because the check sends few packets; yours will differ. A `log` rule loads in the lab without error, but I did not find a way to read its output from inside the lab (est. reason: the kernel log belongs to the real machine, not to a pretend one), so the counters stand in for the log here; the cloud path shows a `log` rule on a real server.
 
-**Evade (in words, then one run).** An administrator who is told "that port is exposed" might "hide" it instead of fixing it: move a service to port 20222 and open that port to anyone. Run exactly that and then do what an attacker's tool does, check a whole range:
+**Evade (in words, then one run).** An administrator who is told "that port is exposed" might "hide" it instead of fixing it (security through obscurity): move a service to port 20222 and open that port to anyone. Run exactly that and then do what an attacker's tool does, check a whole range:
 
 ```bash
 ip netns exec srv python3 listen.py 10.78.0.10 20222 > /dev/null 2>&1 &

+ 1 - 1
docs/wiki/Threats-in-Plain-Words.md

@@ -389,7 +389,7 @@ The same loop as the [labs](Labs-Break-It-on-Purpose.md), at concept level only.
 - **Build.** A one-page asset list for your home or lab: each device, its maker and product, the version, and whether it is reachable from the internet (the `inventory.csv` from Exercise 3 is that page). You cannot defend what you cannot list.
 - **Break.** Add a device with old firmware to the list: a made-up router on a version years behind. You have not touched a real device; you have written down a row that, if it were real, would be the weakest one.
 - **Detect.** Look the product up in a public list (Exercise 3), read the record (Exercise 1) and decide whether it touches you (Exercise 4). For a real network, detection also means logs and alerts that show someone *using* a flaw: see [Logs, SIEM and detection basics](Logs-SIEM-and-Detection-Basics.md), then [Cloud telemetry: what and why](Cloud-Telemetry-What-and-Why.md) and [Build your own mini SOC](Build-Your-Own-Mini-SOC.md).
-- **Evade.** In words only: an attacker prefers the unpatched, internet-facing device because the work was already done. A known flaw has a public write-up and often public tools, so one method works against many owners at once, and it is far cheaper than finding a new flaw (the cases above show campaigns against many organizations that shared one product). They also prefer quiet: stolen valid credentials and ordinary admin tools, as in the lateral movement case, give a defender little that looks "bad" to catch. This page gives no working steps and none are needed to understand the economics.
+- **Evade.** In words only: an attacker prefers the unpatched, internet-facing device because the work was already done. A known flaw has a public write-up and often public tools, so one method works against many owners at once, and it is far cheaper than finding a new flaw (the cases above show campaigns against many organizations that shared one product). They also prefer quiet: stolen valid credentials and ordinary admin tools, as in the lateral movement case, give a defender little that looks "bad" to catch. This page gives no working steps and none are needed to understand the economics. Defenders are tempted to hide a service, for example by moving SSH to another port, which is security through obscurity and fails for the same reason: see [What does not count as protection](Plan-for-Failure-Blast-Radius-and-Assuming-Breach.md#what-does-not-count-as-protection).
 - **Defend.** A patch plan with owners and dates (who patches what, how fast for something on a known-exploited list, and what you do if there is no fix: turn the feature off, remove the device, or limit who can reach it); an exposure review (what is reachable from the internet, and whether it needs to be: this project's answer is [zero public inbound ports behind a zero trust gateway](Why-ZTNA-Not-a-VPN.md)); segmentation so one fallen machine does not reach the rest; a restore you have tested from a copy an attacker could not alter (see [Enterprise infrastructure differences](Enterprise-Infrastructure-Differences.md#high-availability-disaster-recovery-and-backups)); and sign-in that resists phishing.
 
 **Flip the board.** You are now the person who must decide what to patch this week with time for five items out of five hundred. You have the CVSS score, the EPSS estimate, the KEV flag, whether the product is internet-facing, and what lives on the machine. Write down which two signals you would weight most and why, and what you would still not know. Then flip again: you are the vendor's incident team, and a researcher reports a flaw in a product with a customer base you cannot contact directly. What is the first thing a customer needs from you (an advisory with fixed versions, a workaround and a date), and what would make them miss it?

+ 2 - 1
tests/test_blast_radius_lesson.py

@@ -134,7 +134,8 @@ def test_glossary_defines_assume_breach_and_defense_in_depth():
 
 def test_at_least_four_existing_pages_link_the_lesson_at_first_use():
     users = [p.name for p in WIKI.glob("*.md") if p != PAGE and p.name not in {"Glossary.md", "_Sidebar.md", "Reading-Order.md"} and PAGE.name in p.read_text()]
-    assert 4 <= len(users) <= 8, users
+    # 9, not 8: issue #230 added the required links from Droplet hardening and the threats lesson.
+    assert 4 <= len(users) <= 9, users
 
 
 def test_the_lesson_is_in_the_sidebar_and_reading_order():

+ 74 - 0
tests/test_no_port_move_as_protection.py

@@ -0,0 +1,74 @@
+"""No page may present moving a service to another port as a security control (issue #230).
+
+The maintainer's position: changing a port (SSH is the usual example) is security through
+obscurity, a flawed one-trick idea. A scanner checks every port in seconds and, once it finds the
+service, goes straight to it. This test is a conservative phrase check over the wiki, the stage
+guides and the README: any line that talks about moving a service to a different port must, on that
+same line, also say it is not protection (or say why the move is functional). A line that does
+neither fails, unless it is in ALLOWED with a reason.
+
+It is a phrase check and not a proof: it catches the common wording, not every possible one.
+"""
+
+import re
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+FILES = sorted((ROOT / "docs" / "wiki").glob("*.md")) + sorted((ROOT / "docs" / "stages").glob("*.md")) + [ROOT / "README.md"]
+SKIP = {"Contents.md", "_Sidebar.md", "_Footer.md"}
+
+# A line is about a port move when it matches one of these.
+PORT_MOVE = re.compile(
+    r"(non-?standard|odd|unusual|alternate|alternative|different|another|high|random|other than 22)\s+(tcp\s+)?port\b"
+    r"|\b(move|moves|moved|moving|change|changes|changed|changing)\b[^.|]{0,40}\bport\b"
+    r"|\bport\b[^.|]{0,20}\b(move|moved|change|changed)\b"
+    r"|\bits own port\b",
+    re.IGNORECASE,
+)
+
+# ... and only counts when it is about exposing or reaching a service, not (say) a switch port.
+SERVICE = re.compile(r"\b(ssh|sshd|rdp|telnet|management|admin|service|daemon|login|server)\b", re.IGNORECASE)
+
+# A line that says the move is not protection, or why it is functional, passes.
+HONEST = re.compile(
+    r"not (a |the )?(protection|defen[sc]e|security control|control|layer|substitute)"
+    r"|obscurity|log noise|quieter|less noisy|for function|function choice|functional|because the imitation|because cowrie takes"
+    r"|bought two seconds|does not (work|protect|stop|change)|no protection|adds no protection|nothing about who may",
+    re.IGNORECASE,
+)
+
+# (file name, a substring of the line) -> why the line is a false positive. Keep it short.
+ALLOWED: dict[tuple[str, str], str] = {}
+
+
+def hits() -> list[tuple[str, int, str]]:
+    found = []
+    for path in FILES:
+        if path.name in SKIP:
+            continue
+        for n, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
+            if PORT_MOVE.search(line) and SERVICE.search(line) and not HONEST.search(line):
+                found.append((path.name, n, line.strip()))
+    return found
+
+
+def allowed(name: str, line: str) -> bool:
+    return any(f == name and sub in line for (f, sub) in ALLOWED)
+
+
+def test_no_line_presents_a_port_move_as_protection():
+    bad = [(f, n, line[:160]) for f, n, line in hits() if not allowed(f, line)]
+    assert not bad, "port move not marked as non-protection (add the disclaimer or an ALLOWED reason):\n" + "\n".join(f"{f}:{n}: {line}" for f, n, line in bad)
+
+
+def test_every_allowlist_entry_still_matches_something_and_has_a_reason():
+    live = hits()
+    for (name, sub), reason in ALLOWED.items():
+        assert len(reason) > 20, f"allowlist entry {name!r} needs a real reason"
+        assert any(f == name and sub in line for f, _, line in live), f"stale allowlist entry: {name!r} / {sub!r}"
+
+
+def test_the_checker_bites_on_a_protection_claim():
+    assert PORT_MOVE.search("Move SSH to a non-standard port to keep attackers out.")
+    assert not HONEST.search("Move SSH to a non-standard port to keep attackers out.")
+    assert HONEST.search("A different port is not a security control.")