Files
mtusi2026lab7/infra/s3/README.md
T
Vladislav Kunetskiy 1b6e96ccc0
Application / Go invariants and static checks (pull_request) Canceled after 0s
Application / Lab7 verified TLS and retained features (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
lab7: безопасность, mTLS, OpenBao и PKI lifecycle
2026-11-10 14:39:57 +03:00

77 lines
4.5 KiB
Markdown

# SeaweedFS identities and recovery
The pinned SeaweedFS 4.51 image runs as one logical `s3` role: the
`seaweedfs` container owns the network namespace and persistent volume;
the `s3` container shares that namespace and serves native HTTPS.
Do not downgrade to 3.80: its COPY authorization allowed foreign-source reads.
Owned COPY plus forbidden foreign-source/destination COPY checks remain required.
`infra/s3/s3.json` declares permissions, not credentials. `securityctl.py`
renders operator-local credentials into the read-only `/run/backend/s3.json`
mount of `s3`. Only `s3-init` and the host operator use the operator identity
as clients; application processes receive only their own credentials.
- `operator` creates the application bucket and maintains the recovery sentinel.
- `api` reads attachment/staging objects and writes staging objects only.
- `worker` reads/writes attachment/staging objects and lists the application
bucket. Bucket-level LIST can disclose foreign-prefix metadata; Write also
permits DELETE within the allowed prefixes.
## Listener isolation
| Listener | Binding and policy |
| --- | --- |
| S3 HTTPS 8333 | Native TLS; SigV4 credentials and prefix ACLs. Host publication is loopback-only. |
| S3 auxiliary gRPC 18333 | Shared namespace; mTLS trusts the role CA and permits only CN `s3`. |
| Master HTTP 9333, filer HTTP 8888, volume HTTP 8080 | Namespace loopback only; not published. |
| Master gRPC 19333, filer gRPC 18888, volume gRPC 18080 | Namespace loopback only, with the same CN `s3` mTLS restriction. |
| Iceberg HTTP 8181, Lance HTTP 9101 | Disabled by `-port.iceberg=0` and `-port.lance=0`; absence must be probed, not excluded from isolation checks. |
The three internal gRPC Unix sockets stay in the owner's private `/tmp`.
The S3 HTTP Unix socket stays in the S3 container's private `/tmp`.
No additional PKI role, client allowance, or certificate SAN is needed.
Auxiliary 18333 is not an HTTP readiness port: test TLS rejection for
`api`, `worker`, and `operator`, and successful mTLS only for `s3`.
Flags were obtained from the pinned binary with `weed s3 -help` and
`weed server -help`. The configured filer address uses SeaweedFS's explicit
HTTP/gRPC form, `127.0.0.1:8888.18888`, matching the master discovery registry.
The shipped [address parser](https://github.com/seaweedfs/seaweedfs/blob/ffa87c25f/weed/pb/server_address.go)
supports this form. The
[discovery implementation](https://github.com/seaweedfs/seaweedfs/blob/ffa87c25f/weed/wdclient/filer_client.go)
compares raw address spellings and refreshes every five minutes; removing
`127.0.0.1:8888` when discovering its explicit-gRPC equivalent does not mean
that no filer remains.
## Persistent body readiness
The filer's `/healthz` and the public API's DB/OpenBao health cannot prove that
previously stored volume bytes are readable. In the observed restart, S3
started before master leadership and volume topology had recovered.
`Controller.wait_s3()` uses the operator CA, verifies `localhost`, presents
the operator leaf, and signs requests for the published HTTPS S3 endpoint.
It creates exactly one random `operator-readiness/<key>` object in the
configured application bucket on first initialization. Its 64 KiB body forces
volume-backed storage rather than a metadata-only/HEAD probe. Expected bytes
and establishment state live in private `LAB7_OPERATOR_STATE/s3-readiness.json`.
The application identities cannot read, overwrite, or delete this prefix.
After establishment, readiness performs GET and full byte comparison only:
it never rewrites a missing object or reseeds a volume. Missing/unavailable
storage is retried within the readiness deadline; changed bytes or permanent
authorization errors fail the operation. Network operations use five-second
timeouts and body reads are size-capped and deadline-checked.
`wait_ready()` requires this body check before public HTTPS health succeeds.
Store restart first checks the old sentinel, restarts owners, recreates
shared-namespace consumers, checks old bytes again, then restarts applications.
This preserves the existing volumes and does not retry or alter public tests.
Required targeted verification after applying configuration: retain an uploaded
attachment, perform the operator restart hook, read its complete body once,
then compare it byte-for-byte. Also exercise a new staging upload/async COPY,
the existing COPY ACL matrix, auxiliary listener isolation, and the failure
case where an established readiness object is unavailable. Do not remove the
private readiness state to make a persistence check pass.