Compare commits

..
5 Commits
Author SHA1 Message Date
traberph 3769647b77 cleanup talos 2026-10-06 15:48:50 +02:00
traberph d78e570b44 ipv6 2026-10-06 15:31:20 +02:00
traberph 7714efd9ea delete k8s files 2026-10-06 15:30:06 +02:00
traberphandClaude Opus 5.5 adb68d5146 coreos: sish edge config for production
- sish config mirrors kubernetes/base/sish (HTTP by Host on :80, SNI passthrough
  on :443, raw TCP on 22 and 20000-20099), single tenant via bind-any-host,
  domain tunnel.traberph.de
- host key and connector key provisioned from gitignored coreos/.secrets/
- MemoryMax=256M for sish
- Zincati reboot window 03:00-04:00 UTC, daily sish update within v2 with rollback
- ignore *.ign (contains the host key)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 19:11:30 +02:00
traberph 8688bd91d3 sketch coreos 2026-10-05 18:32:49 +02:00
16 changed files with 401 additions and 478 deletions
+4 -9
View File
@@ -1,13 +1,8 @@
# Plaintext secrets: never commit, back them up outside this folder
# Plaintext secrets (edge host key, connector keys): never commit, back them up outside this folder
.secrets/
# Talos generated configs contain cluster PKI and admin credentials (any folder,
# e.g. a new edge's config generated next to talos/)
controlplane.yaml
worker.yaml
talosconfig
secrets.yaml
kubeconfig
# Ignition output embeds the host key from .secrets/
*.ign
# Retired dev edge credentials (cirrus_dev), kept locally only
# Retired setups (Talos dev edge, Kubernetes) and their credentials, kept locally only
old/
+133 -52
View File
@@ -1,8 +1,8 @@
# cirrus
Self-hosted edge: a Talos node running only [sish](https://github.com/antoniomika/sish). Clusters
without inbound ports (e.g. `cumulus`) open outbound SSH tunnels to it with `sish-client`, and the
edge relays public traffic back through them:
Self-hosted edge: a Fedora CoreOS VPS running only [sish](https://github.com/antoniomika/sish).
Clusters without inbound ports (e.g. `cumulus`) open outbound SSH tunnels to it with `sish-client`,
and the edge relays public traffic back through them:
```
client ──▶ edge :22/:80/:443/:200xx (sish) ══ssh══▶ sish-client ──▶ envoy gateway ──▶ app
@@ -11,64 +11,145 @@ client ──▶ edge :22/:80/:443/:200xx (sish) ══ssh══▶ sish-client
- :443 is routed by SNI without decrypting (TLS passthrough), optionally with a PROXY v2 header.
- :80 is routed by `Host` header, raw TCP ports (e.g. :22 for Gitea SSH) by port.
Production serves everything from `cumulus`: `traberph.de` and `*.traberph.de` on :80/:443 (IPv4
and IPv6), Gitea SSH on :22. The cluster side (connectors, Envoy gateways, per-app routes) is
documented in the `cumulus` README.
## Layout
```
talos/ node config: generated base + patches (sysctl, scheduling, firewall) → talos/README.md
kubernetes/ sish deployment, kustomize base + per-edge overlay → kubernetes/README.md
.secrets/ connector private keys (gitignored)
| File | |
|---|---|
| `cirrus.yaml` | Butane config: users, sshd, network, firewall, sish, updates |
| `.secrets/ssh_host_ed25519_key` | Edge SSH host key (gitignored). Connectors pin its public half (`SISH_HOST_KEY`) |
| `.secrets/connector-cumulus` | Private key of the `cumulus` connector (gitignored), goes into a Secret in `cumulus` |
| `cirrus.ign` | Build output, embeds the host key (gitignored) |
Secrets only live in the gitignored `.secrets/` and `*.ign`; nothing secret is committed. Back up
`.secrets/` outside this folder (password manager), it is the only copy.
## Build and install
```sh
butane --strict --files-dir . cirrus.yaml > cirrus.ign
coreos-installer install /dev/<disk> --ignition-file cirrus.ign # or the provider's user-data
```
Everything is applied by hand (`talosctl`, `kubectl apply -k`). Secrets never leave the
gitignored files (`talos/controlplane.yaml`, `talos/talosconfig`, `**/.secrets/`).
Ignition runs only on first boot. Changing `cirrus.yaml` later does nothing to a running host:
either reinstall, or make the same change on the host by hand (and keep the file in sync).
## Environments
Admin access: `ssh -p 5001 core@tunnel.traberph.de` (public key only, user `core` only).
| | Edge | Domains |
|---|---|---|
| `cirrus-dev` | `10.20.5.130` (LAN), Talos v1.14.1, Kubernetes v1.37.0 | `.test` / `.sto` via local DNS |
### First boot checklist
Currently served through the dev edge from `cumulus`: Gitea SSH on :22, `http://cirrus.sto` (hello).
- `ss -tlnp`: sish on 22, 80, 443, 5002; sshd on 5001.
- `journalctl -u sish`: `Loading ssh_host_ed25519_key as ssh-ed25519 host key` (the provisioned
key, not a generated one).
- After the first OS update: SSH on 5001 still works, `semodule -l | grep sshd_port_5001`.
## Production rollout plan
## Network
The dev edge is verified end to end: firewall, port range, tunnels, and the Talos config
reproduces exactly from the files here. What is still missing for production:
Hostname `cirrus.traberph.de` on netcup. netcup gives IPv4 via DHCP but no IPv6 router
advertisements with a usable prefix: the IPv6 address from the netcup panel (/64) is set statically
in `/etc/NetworkManager/system-connections/ens3.nmconnection`, gateway `fe80::1`.
**Before the rollout**
1. **Backups.** `talos/controlplane.yaml`, `talos/talosconfig`, the edge host key and the
connector private keys exist only in this folder. Store them in a password manager (and put
the folder under git, secrets stay gitignored).
2. **Domains and DNS.** Pick the production domains; create DNS records for them (wildcards
where needed) pointing to the VPS IPv4/IPv6.
3. **HTTPS on the cluster side.** `cumulus` only has the plain connector (SSH, HTTP). For
TLS passthrough it needs a second connector (SNI, PROXY v2), an Envoy HTTPS listener that
accepts the PROXY header only from sish-client, and certificates (cert-manager with DNS-01, or
HTTP-01 over the :80 route).
4. **Remove test access.** Leave `connector-hello.pub` (local test stack) out of the
production overlay; give each production connector its own key.
| | |
|---|---|
| IPv4 | `46.38.234.119` (DHCP) |
| IPv6 | `2a03:4000:2:83c::1/64` (static), gateway `fe80::1` |
**Rollout**
1. VPS: boot the Talos image (same factory schematic as dev) and check the provider's disk name
and network (DHCP vs static, IPv6).
2. Generate a new base config into its own folder (`talos/README.md`, "New node") and apply it
with the existing patches plus one that disables the discovery service (single node, no
external dependency needed).
3. Bootstrap, fetch the kubeconfig. Verify against the firewall table: only the listed ports
answer from outside.
4. Kubernetes: new overlay `kubernetes/cirrus-prod` (copy of `cirrus-dev`) with the production
`SISH_DOMAIN`/`SISH_BIND_HOSTS`, production connector keys and a new host key. Set
`dnsPolicy: Default` for sish so the tunnel does not depend on CoreDNS. `diff`, then `apply -k`.
5. Cluster side (`cumulus`): sish-client deployment(s) for the production edge (edge IP, new host
key, production routes), matching Gateway listeners/routes and network policies. Keep the dev
connectors until production is verified.
6. Verify from outside: `ssh-keyscan` for SSH routes, `curl` for HTTP/HTTPS routes, the backend
sees the real client IP, closed ports stay closed.
7. Move existing services (e.g. from the Cloudflare tunnel) one hostname at a time by switching
their DNS records.
Only the global address (`scope global`) goes into DNS, never the `fe80::` link-local one.
**After the rollout**
- External uptime check on the edge (sish :2222 and one route per protocol): the edge is a
single point of failure for everything behind it.
- Updates by hand: `talosctl upgrade` / `upgrade-k8s`, the sish image tag, sish-client tags in
`cumulus`. The `talosconfig` admin certificate expires after one year.
## Ports
nftables (`/etc/sysconfig/nftables.conf`), default drop. Loopback, ICMP, DHCP replies and
replies to outgoing connections are allowed.
| Port (tcp) | |
|---|---|
| 5001 | Admin sshd |
| 5002 | sish SSH endpoint for connectors (public key auth) |
| 80 | sish HTTP, routed by `Host` header |
| 443 | sish TLS passthrough, routed by SNI |
| 22, 20000-20099 | Raw TCP forwards (22 = Gitea SSH) |
The forward ports must match `port-bind-range` in the sish config, otherwise a claimed port is
silently unreachable.
sshd on 5001 needs an SELinux exception (5001 is labelled `commplex_link_port_t`):
`sshd-port-selinux.service` installs `/etc/cirrus/sshd_port_5001.cil` once and again whenever an
OS update dropped it.
## sish
| Path on the host | |
|---|---|
| `/etc/containers/systemd/sish.container` | Quadlet unit (`sish.service`), rootful Podman with host networking: non-root (uid 65532), only `CAP_NET_BIND_SERVICE`, read-only root, `MemoryMax=256M`. Own writable `/tmp` tmpfs (`Tmpfs=…,mode=1777,notmpcopyup`): sish creates a temp file per forward, and podman's automatic read-only `/tmp` (copied from the image, root 755) would make every forward fail with "remote port forwarding failed" |
| `/etc/sish/config.yml` | sish config |
| `/var/lib/sish/keys/` | Host key (read-only in the container) |
| `/var/lib/sish/pubkeys/clients` | Authorized connector keys, `authorized_keys` format |
Notable config values:
| | |
|---|---|
| `ssh-address: ":5002"` | Connector SSH endpoint |
| `domain: tunnel.traberph.de` | The edge's own name. A requested name without a dot becomes `<name>.tunnel.traberph.de` |
| `bind-any-host: true` | Single tenant: connectors may claim any hostname containing a dot, wildcards included |
| `verify-dns: false` | No `_sish` TXT ownership checks (pointless with `bind-any-host`) |
| `sni-proxy`, `*-load-balancer: true` | TLS passthrough on :443, several connectors may serve the same name |
| `proxy-protocol-version: "2"` | PROXY header for connectors that request it |
| `idle-connection-timeout: 1h` | Default 5s kills websockets, SSE and slow uploads |
| `service-console-max-content-length: 0` | Default -1 buffers every body in memory, large uploads OOM-kill sish |
Every authorized key can claim every hostname and port, and with the load balancers on it can join
an existing one. So only add keys of connectors you control (sish has no per-key permissions).
**Add or remove a connector:** edit `/var/lib/sish/pubkeys/clients` on the host (sish watches the
directory, no restart needed) and the same block in `cirrus.yaml`.
**Config change:** edit `/etc/sish/config.yml`, `systemctl restart sish`, mirror it in
`cirrus.yaml`. Connectors drop for a few seconds and reconnect on their own.
```sh
systemctl status sish
journalctl -u sish -f
```
## DNS
| Record | |
|---|---|
| `tunnel.traberph.de` A/AAAA → VPS | Connectors (:5002) and admin SSH (:5001) |
| `<host>` or `*.<domain>` A/AAAA → VPS | Every hostname a connector serves; unclaimed names get a 404 (:80) or no answer (:443) |
| `*.tunnel.traberph.de` A/AAAA → VPS | Optional, only if fallback names should be reachable |
A wildcard claim (`*.example.com`) does not cover the apex `example.com`, neither in DNS nor in sish:
connectors claim the apex separately. Records that point elsewhere (e.g. still proxied through
Cloudflare) take precedence over the wildcard; deleting such a record silently moves the name to the
edge, where it only works if a connector serves it.
## Updates
Both are automatic:
- **OS:** Zincati stages new Fedora CoreOS releases (stable stream) and reboots only in the window
03:00-04:00 UTC (`/etc/zincati/config.d/55-updates-strategy.toml`).
- **sish:** upstream publishes only exact tags (`v2.24.0`), so `podman auto-update` can't follow a
version line. `sish-update.timer` (daily ~05:00 UTC) runs `/usr/local/bin/sish-update`, which
sets `Image=` in the quadlet to the newest tag matching `TRACK=v2.` (minor + patch, never a new
major), restarts sish and rolls back if nothing listens on :5002 after 30s. `TRACK=v2.24.` limits
it to patch releases.
```sh
journalctl -u zincati -u sish-update
systemctl start sish-update # check now
```
Both restart sish (tunnels drop for a few seconds). A major sish release (`v3`) is a manual change
of `TRACK` and `Image=`. The `sish-client` tags in `cumulus` are updated by hand.
## Open
- **Backups.** `.secrets/` exists only in this folder. Store it in a password manager.
- **Uptime check.** External check on the edge (sish :5002 and one route per protocol): the edge is
a single point of failure for everything behind it.
+264
View File
@@ -0,0 +1,264 @@
variant: fcos
version: 1.6.0
# cirrus: 5001 admin sshd | 5002 sish SSH | 80 HTTP by Host | 443 TLS by SNI (passthrough)
# 22, 20000-20099 raw TCP forwards
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILL4RXmGVhbcCdh3a6TdgR+7EER250UUDk0VtrwUvb9E philipp@philipp-laptop
storage:
directories:
- path: /var/lib/sish/keys
mode: 0700
user: { id: 65532 }
group: { id: 65532 }
files:
- path: /etc/hostname
mode: 0644
contents:
inline: cirrus.traberph.de
# netcup: IPv4 via DHCP, IPv6 static (no router advertisements, gateway is always fe80::1)
- path: /etc/NetworkManager/system-connections/ens3.nmconnection
mode: 0600
contents:
inline: |
[connection]
id=ens3
type=ethernet
interface-name=ens3
[ipv4]
method=auto
[ipv6]
method=manual
address1=2a03:4000:2:83c::1/64
gateway=fe80::1
# Edge SSH host key (connectors pin its public half). Kept only locally in .secrets/
# (gitignored), so back it up outside this folder. Build: butane --files-dir . ...
- path: /var/lib/sish/keys/ssh_host_ed25519_key
mode: 0400
user: { id: 65532 }
group: { id: 65532 }
contents:
local: .secrets/ssh_host_ed25519_key
- path: /var/lib/sish/pubkeys/clients # connector public keys (authorized_keys format)
mode: 0644
contents:
inline: |
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEsHP4H4HLHCEhycaAV+YZZV/HOr7HSiDkgpMA+WLO56 connector-cumulus
- path: /etc/ssh/sshd_config.d/10-cirrus.conf
mode: 0644
contents:
inline: |
Port 5001
AuthenticationMethods publickey
PermitRootLogin no
AllowUsers core
- path: /etc/cirrus/sshd_port_5001.cil # 5001 is commplex_link_port_t
mode: 0644
contents:
inline: |
(allow sshd_t commplex_link_port_t (tcp_socket (name_bind)))
- path: /etc/sish/config.yml
mode: 0644
contents:
inline: |
# Listeners
ssh-address: ":5002"
http-address: ":80"
https: false # sish never terminates TLS; :443 is an SNI passthrough listener
# Single tenant: connectors may claim any hostname containing a dot, wildcards included
# (*.example.com). Only a name without a dot falls back to <name>.<domain>.
bind-any-host: true
verify-dns: false # _sish TXT ownership checks, pointless with bind-any-host
domain: tunnel.traberph.de # the edge's own name (A/AAAA -> VPS)
# SNI passthrough + multiple connectors per hostname
sni-proxy: true
sni-load-balancer: true
tcp-load-balancer: true
http-load-balancer: true
# Connectors get exactly what they ask for, or the bind fails
bind-random-ports: false
bind-random-subdomains: false
bind-random-aliases: false
force-requested-subdomains: true
force-requested-ports: true
bind-wildcards: true
# Ports connectors may claim. Must match the nftables rule below, otherwise a claimed
# port is silently unreachable.
# 22 gitea ssh, 443 SNI, 20000-20099 reserved for raw tcp forwards.
port-bind-range: "22,443,20000-20099"
# PROXY header version for connectors that request it (sish-client default: v2)
proxy-protocol: true
proxy-protocol-version: "2"
# Default is 5s, which kills idle websockets/SSE/slow uploads
idle-connection-timeout: 1h
# Auth: public keys only
authentication: true
authentication-keys-directory: /pubkeys
private-keys-directory: /keys
# No web UI / consoles
redirect-root: false
admin-console: false
service-console: false
load-templates: false
# Default -1 makes the HTTP muxer io.ReadAll() every request/response body into memory
# (for the console), even with consoles disabled: large uploads OOM-kill sish.
# 0 = never buffer, stream bodies through.
service-console-max-content-length: 0
log-to-stdout: true
log-to-file: false
- path: /etc/containers/systemd/sish.container
mode: 0644
contents:
inline: |
[Unit]
Description=sish tunnel server
[Container]
ContainerName=sish
Image=ghcr.io/antoniomika/sish:v2.24.0
Network=host
User=65532
Group=65532
DropCapability=all
AddCapability=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ReadOnly=true
# sish creates a temp file per forward. The automatic read-only /tmp tmpfs copies the
# image's /tmp (root, 755), so uid 65532 can't write there: give it a plain sticky /tmp.
Tmpfs=/tmp:rw,nosuid,nodev,noexec,size=16m,mode=1777,notmpcopyup
Volume=/etc/sish:/config:ro,Z
Volume=/var/lib/sish/keys:/keys:ro,Z
Volume=/var/lib/sish/pubkeys:/pubkeys:ro,Z
Exec=--config=/config/config.yml
[Service]
Restart=always
RestartSec=5
MemoryMax=256M
[Install]
WantedBy=multi-user.target
# OS updates: Zincati stages new FCOS releases automatically, this limits the reboot to a window
- path: /etc/zincati/config.d/55-updates-strategy.toml
mode: 0644
contents:
inline: |
[updates]
strategy = "periodic"
[[updates.periodic.window]]
days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
start_time = "03:00" # UTC
length_minutes = 60
# sish updates: no floating tags upstream (only vX.Y.Z), so podman auto-update can't follow a
# version line. This bumps Image= to the newest tag within TRACK and rolls back if sish
# doesn't come up again.
- path: /usr/local/bin/sish-update
mode: 0755
contents:
inline: |
#!/bin/bash
set -euo pipefail
TRACK=v2. # "v2." = minor + patch releases, "v2.24." = patch releases only
unit=/etc/containers/systemd/sish.container
repo=ghcr.io/antoniomika/sish
current=$(sed -n "s|^Image=$repo:||p" "$unit")
latest=$(podman search --list-tags --limit 10000 --format '{{.Tag}}' "$repo" \
| grep -E "^${TRACK//./\\.}[0-9]+(\.[0-9]+)*$" | sort -V | tail -n1)
if [[ -z $latest || $(printf '%s\n' "$current" "$latest" | sort -V | tail -n1) == "$current" ]]; then
exit 0
fi
set_image() {
sed -i "s|^Image=.*|Image=$repo:$1|" "$unit"
systemctl daemon-reload
systemctl restart sish.service
}
echo "sish: $current -> $latest"
podman pull -q "$repo:$latest" >/dev/null
set_image "$latest"
sleep 30
if ! ss -Htln 'sport = :5002' | grep -q .; then
echo "sish $latest not listening on :5002, rolling back to $current" >&2
set_image "$current"
exit 1
fi
podman image prune -af >/dev/null
- path: /etc/sysconfig/nftables.conf
mode: 0600
overwrite: true
contents:
inline: |
table inet cirrus
delete table inet cirrus
table inet cirrus {
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iif "lo" accept
meta l4proto { icmp, ipv6-icmp } accept
udp sport 67 udp dport 68 accept
ip6 saddr fe80::/10 udp sport 547 udp dport 546 accept
tcp dport { 22, 80, 443, 5001, 5002, 20000-20099 } accept # sish ports: see port-bind-range
}
}
systemd:
units:
- name: sshd-port-selinux.service
enabled: true
contents: |
[Unit]
Description=Allow sshd to bind 5001/tcp (SELinux)
Before=sshd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecCondition=/bin/sh -c '! /usr/sbin/semodule -l | grep -qx sshd_port_5001'
ExecStart=/usr/sbin/semodule -i /etc/cirrus/sshd_port_5001.cil
[Install]
WantedBy=multi-user.target
- name: nftables.service
enabled: true
- name: sish-update.service
contents: |
[Unit]
Description=Update sish within its major version
Wants=network-online.target
After=network-online.target sish.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/sish-update
- name: sish-update.timer
enabled: true
contents: |
[Unit]
Description=Daily sish update check
[Timer]
OnCalendar=*-*-* 05:00:00 UTC
RandomizedDelaySec=30m
Persistent=true
[Install]
WantedBy=timers.target
-6
View File
@@ -1,6 +0,0 @@
# Source from anywhere: `. ./env.sh` (bash or zsh). Endpoint and node live in the talosconfig,
# so plain `talosctl <cmd>` / `kubectl <cmd>` talk to cirrus-01.
_cirrus_root=$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" && pwd)
export TALOSCONFIG="$_cirrus_root/talos/talosconfig"
export KUBECONFIG="$_cirrus_root/talos/kubeconfig" # created by: talosctl kubeconfig talos/kubeconfig
unset _cirrus_root
-58
View File
@@ -1,58 +0,0 @@
# Kubernetes: sish on the edge
Plain kustomize, applied by hand. `base/sish` is the generic deployment, each edge gets an
overlay (`cirrus-dev/`) with its domain, allowed hostnames, connector keys and host key.
```sh
kubectl --context admin@cirrus_dev diff -k kubernetes/cirrus-dev # review first
kubectl --context admin@cirrus_dev apply -k kubernetes/cirrus-dev
kubectl --context admin@cirrus_dev -n sish logs deploy/sish -f
```
Config changes create a new ConfigMap/Secret name (kustomize hash), which rolls the pod.
Rollouts use `Recreate` (host ports cannot be shared), so connectors drop for a few seconds
and reconnect on their own.
## sish
- `hostNetwork`, non-root (uid 65534), no capabilities, read-only root filesystem. Binding
:22/:80/:443 relies on the Talos sysctl in `talos/patches/unprivileged-ports.yaml`.
- `config.yml`: SNI passthrough on :443 (sish never terminates TLS), HTTP by `Host` on :80,
raw TCP forwards, public-key auth only, no web consoles.
- `port-bind-range` (ports connectors may claim) must match the firewall rule in
`talos/patches/firewall.yaml`: 22, 443 and 20000-20099 for raw TCP forwards.
- Several connectors claiming the same host/port are load-balanced round-robin.
## Overlay `cirrus-dev`
| | |
|---|---|
| `SISH_DOMAIN` | Fallback domain sish prints for forwards |
| `SISH_BIND_HOSTS` | Parent domains connectors may claim hostnames under (exact match on everything after the first label) |
| `pubkeys/*.pub` | Authorized connector public keys, one file per connector |
| `.secrets/ssh_host_ed25519_key` | Edge SSH host key (gitignored). Connectors pin its public half (`SISH_HOST_KEY`) |
Add a connector: put its public key into `pubkeys/`, list it under `sish-pubkeys` in
`kustomization.yaml`, then diff and apply. Remove a connector the same way; its sessions are
cut when the pod restarts.
New host key (e.g. for a new edge): `ssh-keygen -t ed25519 -N '' -C sish-host@<edge> -f
kubernetes/<overlay>/.secrets/ssh_host_ed25519_key`, then update `SISH_HOST_KEY` in every
connector.
Connectors run `registry.traberph.de/public/sish-client` (see its repo README); the
`cumulus` cluster runs them in `infra/configs/base/networking/sish-client`.
## sish gotchas
- `port-bind-range` defaults to `0,1024-65535`, which rejects 22 and 443.
- A raw TCP forward must bind `0.0.0.0:<port>`. With a hostname sish creates a TCP *alias*,
reachable only through sish itself, not as a public port.
- PROXY protocol is opt-in per connector (`proxy-protocol=…`); the server only fixes the version.
- `idle-connection-timeout` defaults to 5s; raised to 1h.
- `service-console-max-content-length` defaults to -1, which buffers every HTTP body in memory
(even with consoles off): a large upload OOM-kills sish. Set to 0 to stream.
- A name outside `bind-hosts` is not rejected: sish silently binds `<name>.<domain>` instead.
Check the `HTTP:`/`TLS:` line the edge prints.
- HTTP (:80) and SNI (:443) forwards need separate connector sessions.
- `Can't read file ..data` log lines are harmless (Kubernetes volume symlinks).
-52
View File
@@ -1,52 +0,0 @@
# sish configuration (keys mirror the CLI flags, see `sish --help`).
# Cluster-specific values (domain, bind-hosts) are injected as SISH_* env vars
# from the `sish-env` ConfigMap in each overlay. Env takes precedence over this file.
# Listeners
ssh-address: ":2222"
http-address: ":80"
https: false # sish never terminates TLS; :443 is an SNI passthrough listener
# SNI passthrough + multiple connectors per hostname
sni-proxy: true
sni-load-balancer: true
tcp-load-balancer: true
http-load-balancer: true
# Connectors get exactly what they ask for, or the bind fails
bind-random-ports: false
bind-random-subdomains: false
bind-random-aliases: false
force-requested-subdomains: true
force-requested-ports: true
bind-wildcards: true
# Ports connectors may claim. Must match the sish-public rule in
# talos/patches/firewall.yaml, otherwise a claimed port is silently unreachable.
# 22 gitea ssh, 443 SNI, 20000-20099 reserved for raw tcp forwards.
# Ports below 80 also need talos/patches/unprivileged-ports.yaml.
port-bind-range: "22,443,20000-20099"
# PROXY header version for connectors that request it (sish-client default: v2)
proxy-protocol: true
proxy-protocol-version: "2"
# Default is 5s, which kills idle websockets/SSE/slow uploads
idle-connection-timeout: 1h
# Auth: public keys only
authentication: true
authentication-keys-directory: /pubkeys
private-keys-directory: /keys
# No web UI / consoles
redirect-root: false
admin-console: false
service-console: false
load-templates: false
# Default -1 makes the HTTP muxer io.ReadAll() every request/response body into memory
# (for the console), even with consoles disabled: large uploads OOM-kill sish.
# 0 = never buffer, stream bodies through.
service-console-max-content-length: 0
log-to-stdout: true
log-to-file: false
-94
View File
@@ -1,94 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sish
labels:
app.kubernetes.io/name: sish
spec:
replicas: 1
# Host ports cannot be shared, so the old pod must be gone before the new one starts.
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: sish
template:
metadata:
labels:
app.kubernetes.io/name: sish
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
enableServiceLinks: false
automountServiceAccountToken: false
# Binding :22/:80/:443 as non-root relies on the node sysctl
# net.ipv4.ip_unprivileged_port_start=22 (talos/patches/unprivileged-ports.yaml).
securityContext:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
fsGroup: 65534
seccompProfile:
type: RuntimeDefault
containers:
- name: sish
image: docker.io/antoniomika/sish:v2.23.0
args:
- --config=/config/config.yml
envFrom:
- configMapRef:
name: sish-env
optional: true
ports:
- name: ssh
containerPort: 2222
- name: http
containerPort: 80
- name: https
containerPort: 443
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
resources:
requests:
cpu: 20m
memory: 32Mi
limits:
memory: 256Mi
readinessProbe:
tcpSocket:
port: ssh
periodSeconds: 10
livenessProbe:
tcpSocket:
port: ssh
initialDelaySeconds: 10
periodSeconds: 20
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: hostkey
mountPath: /keys
readOnly: true
- name: pubkeys
mountPath: /pubkeys
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: config
configMap:
name: sish-config
- name: hostkey
secret:
secretName: sish-hostkey
defaultMode: 0440
- name: pubkeys
configMap:
name: sish-pubkeys
- name: tmp
emptyDir:
sizeLimit: 16Mi
-14
View File
@@ -1,14 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: sish
resources:
- namespace.yaml
- deployment.yaml
configMapGenerator:
- name: sish-config
files:
- config.yml
# Provided by each overlay:
# ConfigMap sish-env (SISH_DOMAIN, SISH_BIND_HOSTS)
# ConfigMap sish-pubkeys (authorized connector public keys)
# Secret sish-hostkey (pinned SSH host key)
-9
View File
@@ -1,9 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: sish
labels:
# hostNetwork is only permitted by the privileged profile.
# The pod itself still runs non-root with all capabilities dropped.
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/audit: baseline
-23
View File
@@ -1,23 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: sish
resources:
- ../base/sish
configMapGenerator:
- name: sish-env
literals:
# .test is a reserved TLD: fine for dev, replace with real domains on the edge.
- SISH_DOMAIN=tunnel.cirrus.test
# Parents a connector may bind under (exact match on everything after the first label).
# "sto" allows cirrus.sto itself (and any <name>.sto); "cirrus.sto" allows <name>.cirrus.sto
- SISH_BIND_HOSTS=cirrus.test,apps.cirrus.test,sto,cirrus.sto
- name: sish-pubkeys
files:
- pubkeys/connector-dev.pub
- pubkeys/connector-hello.pub
secretGenerator:
# Edge SSH host key (connectors pin its public half). Kept only locally in
# .secrets/ (gitignored), so back it up outside this folder.
- name: sish-hostkey
files:
- ssh_host_ed25519_key=.secrets/ssh_host_ed25519_key
-77
View File
@@ -1,77 +0,0 @@
# Talos: cirrus edge node
Single-node Talos control plane that runs only sish. Talos and Kubernetes are managed by hand
with `talosctl`/`kubectl` (no Flux).
| File | |
|---|---|
| `controlplane.yaml` | Base config, **unmodified** output of `talosctl gen config` (gitignored, contains the cluster PKI) |
| `worker.yaml` | Generated worker config, unused on a single node (gitignored) |
| `talosconfig` | Admin client config for `talosctl` (gitignored) |
| `patches/*.yaml` | Every change to the base config |
```sh
export TALOSCONFIG=talos/talosconfig # run from the repo root
N="-n 10.20.5.130 -e 10.20.5.130"
```
## Base config + patches
The base file is never edited by hand; all changes live in `patches/`. The node's config is
therefore always `controlplane.yaml` + `patches/*.yaml`, which keeps changes reviewable and lets
a newly generated base (new node, new Talos defaults) get the same changes by reapplying the
patches. `talosctl patch mc` merges a patch into the node's live config; it does not touch the
local files.
| Patch | Purpose |
|---|---|
| `control-plane-scheduling.yaml` | Drops the control-plane `NoSchedule` taint so sish can run on the only node |
| `unprivileged-ports.yaml` | `ip_unprivileged_port_start=22`: sish (non-root, hostNetwork) binds :22/:80/:443 |
| `firewall.yaml` | Ingress firewall, default block (see below) |
Apply a single patch (dry run first; use `--mode try` for anything that can lock you out, it
reverts automatically unless re-applied):
```sh
talosctl $N patch mc --patch @talos/patches/<patch>.yaml --mode no-reboot --dry-run
talosctl $N patch mc --patch @talos/patches/<patch>.yaml --mode no-reboot
```
Check that the node matches the files (expect `No changes.`):
```sh
talosctl machineconfig patch talos/controlplane.yaml \
$(for p in talos/patches/*.yaml; do printf -- '--patch @%s ' "$p"; done) |
talosctl $N apply-config --file /dev/stdin --dry-run
```
## Firewall
Default action `block`. Loopback and replies to outgoing connections are always allowed.
| Open | Source | |
|---|---|---|
| 22, 80, 443, 2222, 20000-20099 tcp | anyone | sish (2222 = connector SSH, rest = forwards) |
| 6443, 50000 tcp | anyone | Kubernetes API, Talos API (both client-cert authenticated) |
| 53 udp/tcp | pod network `10.244.0.0/16` | CoreDNS forwards to the Talos host DNS |
Closed: flannel VXLAN 4789/udp, etcd 2379-2383, kubelet 10250, kube-proxy 10256, trustd 50001
(open it to the node network only when a second node joins).
The sish ports must match `port-bind-range` in `kubernetes/base/sish/config.yml`. To add a raw
TCP port outside 20000-20099, change both files together.
## New node
```sh
talosctl gen config <cluster-name> https://<node-ip>:6443 --install-disk <disk> -o talos/
talosctl machineconfig patch talos/controlplane.yaml \
$(for p in talos/patches/*.yaml; do printf -- '--patch @%s ' "$p"; done) |
talosctl apply-config --insecure -n <node-ip> --file /dev/stdin
talosctl --talosconfig talos/talosconfig config endpoint <node-ip>
talosctl --talosconfig talos/talosconfig -n <node-ip> bootstrap
talosctl --talosconfig talos/talosconfig -n <node-ip> kubeconfig
```
Back up `controlplane.yaml` and `talosconfig` outside this folder: they are the only copy of
the cluster PKI and admin credentials.
@@ -1,7 +0,0 @@
# Single node: let workloads (sish) run on the control plane by dropping the
# default control-plane NoSchedule taint.
apiVersion: v1alpha1
kind: KubeNodeConfig
taints:
node-role.kubernetes.io/control-plane:
$patch: delete
-5
View File
@@ -1,5 +0,0 @@
# Single node: no cluster discovery, so no dependency on discovery.talos.dev.
apiVersion: v1alpha1
kind: DiscoveryServiceConfig
name: default
$patch: delete
-61
View File
@@ -1,61 +0,0 @@
# Ingress firewall: block everything that is not listed here. Loopback and
# replies to outgoing connections are always allowed by Talos.
#
# Public TCP ports served by sish must match port-bind-range in
# kubernetes/base/sish/config.yml (plus :80 HTTP and :2222 sish SSH).
# Closed on purpose: flannel VXLAN 4789/udp (single node, unauthenticated),
# etcd 2379-2383, kubelet 10250, kube-proxy 10256, trustd 50001 (only needed
# when other nodes join).
apiVersion: v1alpha1
kind: NetworkDefaultActionConfig
ingress: block
---
apiVersion: v1alpha1
kind: NetworkRuleConfig
name: sish-public
portSelector:
ports:
- 22 # gitea ssh (raw tcp forward)
- 80 # sish http, routed by Host header
- 443 # sish tls, routed by SNI
- 2222 # sish ssh endpoint for connectors (public key auth)
- 20000-20099 # reserved for raw tcp forwards
protocol: tcp
ingress:
- subnet: 0.0.0.0/0
- subnet: ::/0
---
# Talos API (apid) and Kubernetes API, both mTLS / client-cert authenticated
apiVersion: v1alpha1
kind: NetworkRuleConfig
name: talos-and-kube-api
portSelector:
ports:
- 50000
- 6443
protocol: tcp
ingress:
- subnet: 0.0.0.0/0
- subnet: ::/0
---
# CoreDNS forwards to the Talos host DNS (forwardKubeDNSToHost), which pods reach
# on the host, so the pod network needs DNS to the node
apiVersion: v1alpha1
kind: NetworkRuleConfig
name: pod-dns
portSelector:
ports:
- 53
protocol: udp
ingress:
- subnet: 10.244.0.0/16
---
apiVersion: v1alpha1
kind: NetworkRuleConfig
name: pod-dns-tcp
portSelector:
ports:
- 53
protocol: tcp
ingress:
- subnet: 10.244.0.0/16
-5
View File
@@ -1,5 +0,0 @@
# Static hostname instead of the generated auto: stable one.
apiVersion: v1alpha1
kind: HostnameConfig
auto: off
hostname: cirrus-01
-6
View File
@@ -1,6 +0,0 @@
# Lets non-root processes bind ports >= 22, so sish (hostNetwork, uid 65534,
# no capabilities) can listen on :22 (Gitea SSH), :80 and :443.
# The edge runs nothing else that could grab 22-79.
machine:
sysctls:
net.ipv4.ip_unprivileged_port_start: "22"