mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
bbbc613c3ed0ee15a832b8a11ef8d3adbe2d0c20
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
79e99e7865 |
terraform: add a SeaweedFS Terraform provider for S3, IAM and S3 Tables (#13478)
* terraform/provider: import the SeaweedFS Terraform provider Import terraform-provider-seaweedfs by Luís Costa (MIT) as a nested Go module. It manages S3 buckets and their configuration (tags, CORS, lifecycle, versioning, policy, encryption, public access block, ownership controls, request payment, quota), IAM users, access keys, groups, roles, policies, attachments, OIDC providers and service accounts, and S3 Tables buckets, namespaces, tables, policies and maintenance configuration. The module path and the provider source address move to seaweedfs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: build and test in-tree Drop the standalone repo's release and git-hook instructions, credit the original author, and list the provider in the terraform layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform: vet and unit-test the provider in CI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep configured JSON in state after apply Bucket, group, managed and S3 Tables policies stored the compacted JSON sent to the server, so a policy written as a heredoc or with file() failed apply with an inconsistent result. Keep the planned string, and keep configured table metadata while the server's copy is semantically equal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: read IAM policy documents without query unescaping SeaweedFS returns user, group and managed policy documents as raw JSON and role trust policies path-escaped. Query unescaping turned a "+" in a resource into a space and failed on a literal "%". Return valid JSON as is and path-unescape anything else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep service account settings left out of the config description, expiration and status are optional and computed, so a change to another attribute planned them as unknown and Update sent empty values. SeaweedFS reads an empty Expiration as "never expires". Carry the prior state forward for unknown values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: use the root IAM path in the full example The user resource accepts only "/", so the example failed at user creation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: make the smoke test and local build portable Use the in-repo chart by default and check it before touching the cluster, bind the port-forward to 127.0.0.1 and fail when it does not start, build from the module directory, and point dev_overrides at the directory holding the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep large JSON numbers exact when normalizing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: compare single statements, empty Sid and scalar conditions canonically Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: reject unknown provider settings instead of using the environment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: do not adopt a bucket owned by another identity Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: clear tags of an adopted bucket when the config sets none Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: report bucket configuration settings SeaweedFS did not store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: treat empty and absent lists alike when comparing bucket configuration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: refuse to adopt an existing IAM user unless a retried create made it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep omitted role settings so a trust policy change updates in place Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: resend a service account expiration only when it changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep a configured expiration that names the same instant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: stop retrying CreateAccessKey when a failed attempt left a key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: add new group members before removing old ones Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: reject empty or padded OIDC client IDs, thumbprints and URL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep an empty OIDC list as a known empty set Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: reject an empty namespace or name for a table policy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: compare table metadata with the server's omitted required=false Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: do not replace a table when only metadata formatting differs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: keep a created S3 Tables object in state when its cleanup fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: reject an explicitly empty compaction strategy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: document import IDs and the object lock versioning destroy case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: stop on any uncertain CreateAccessKey failure and name the keys it left Only NoSuchEntity (user not visible yet) is retried. Any other failure, including cancellation and a failure on the last attempt, lists the user's keys once more and reports the new ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: do not adopt an IAM user found after a failed CreateUser attempt A retry that hits EntityAlreadyExists cannot tell whether the failed attempt or another client created the user, so ask for an import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: point BucketAlreadyExists on bucket create to terraform import SeaweedFS answers BucketAlreadyExists both for another identity's bucket and for the caller's own bucket that has an ACL, so the create cannot adopt it safely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: treat omitted public access block flags as false when comparing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: restore the BucketOwner-only note on the request payment resource Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: say the smoke test runs the version the chart deploys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * terraform/provider: make the unknown endpoint test check the unknown-setting error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8ac5133abe |
admin: default to port 12535, keep 23646 as a best-effort compat listener (#11816)
* admin: default to port 12535, keep 23646 as a best-effort compat listener The default admin HTTP port 23646 derives a worker gRPC port of 33646 (port + GrpcPortOffset), inside the Linux default ephemeral range (32768+). One of our own startup dials can claim 33646 before the admin binds it, killing startup. This is the same failure #10209 fixed for the test port allocator, still reachable via the mini default (#10838) and via standalone `weed admin` defaults. Move the default admin port to 12535 (gRPC 22535) everywhere, keeping the http+10000 convention so worker -admin derivation, the Rust worker and host:http.grpc addressing keep working: - weed admin -port, weed mini -admin.port - weed worker -admin, the plugin worker fallback, Rust worker and weed-lance-worker defaults - help text, README, helm values, docker compose, tests So old workers, bookmarks and scripts keep working, admin also serves the same handler and the worker gRPC server on the previous default (-port.legacy / -admin.port.legacy, default 23646, 0 disables). The legacy gRPC port binds best-effort: it lives in the ephemeral range, so a failed bind only warns instead of reintroducing the startup failure. weed mini reserves it early like the primary port and keeps it out of its own port relocation. grpc.Server tracks every listener handed to Serve, so the compat listener stops with the primary. Also warn when an explicitly configured admin port puts the derived gRPC port at or above the ephemeral floor, the other fix suggested in the issue. Supersedes the pinned-grpc approach in #11814: pinning -admin.port.grpc off the +10000 convention breaks external workers that derive the admin gRPC port from the HTTP address. ClickHouse/ClickHouse#115512 pins -admin.port on their side; this makes that pin unnecessary. Fixes #10838 * admin: let services win the legacy ports, close compat listener on failure Review findings on the compat listeners: - Do not put the legacy ports in mini's reservedPorts: an explicit -s3.port=23646 or -master.port.grpc=33646 must be honored, not rejected or stolen by the early reservation. Mini now checks the finalized port set and skips only the conflicting compat listener, so HTTP and gRPC compat degrade independently and the service keeps its port. - Also skip the legacy HTTP listener when a mini service owns the port: a wildcard-bound service can still leave loopback bindable, which would let the compat listener shadow it for loopback clients. - Close legacyServer's raw listener in the deferred cleanup: Serve may not have registered it yet when startAdminServer returns early. - Helm: add admin.legacyPort (default 23646) and expose the legacy http/grpc ports through the admin Service, container ports and NetworkPolicy so older workers resolved via the Service keep working. * helm: only pass -port.legacy when it differs from the binary default ct install deploys the released image with the new chart, and 4.48 does not know -port.legacy, so the admin pod crash-loops. Omitting the flag at the default value is behavior-identical on new binaries (their default is also 23646) and keeps older releases installable; legacyPort: 0 or a custom port still renders the flag. |
||
|
|
a0b1272cc3 |
filer: authorize the chunk proxy and the root listing like the rest of the filer port (#11152)
* filer: require a read token for the root listing maybeCheckJwtAuthorization waved through every GET/HEAD on "/", so a filer with jwt.filer_signing.read.key set still served its root directory listing -- entry names, sizes and chunks[].file_id -- to a caller holding no token at all, and served the same listing to a token restricted by allowed_prefixes. The exemption was added for health checks before the filer had /healthz and /readyz. Both are registered on the default and read-only muxes ahead of the "/" handler and answer without a token, so drop it. Point the mTLS harness at /healthz, which is what it was probing for. * filer: keep the jwt query parameter out of a proxied chunk request The proxy stripped "jwt" from the forwarded query on reads only, on the grounds that a writer's own credential travels there. It does not: an uploader carries its AssignVolume token in the Authorization header, and the query parameter on this path holds a filer credential. Strip it for every method. A volume server has no business seeing a filer token, and because security.GetJwt reads the query before the header, relaying one would hide the writer's own token behind it. * filer: dispatch the chunk proxy after the JWT gate The ?proxyChunkId= branch returned before maybeCheckJwtAuthorization ran, so GET, PUT, POST and DELETE against any needle in the cluster were reachable on the filer's HTTP port with no filer credential, on a filer where every other request answered 401. An anonymous caller read a stored object, replaced its bytes, or deleted the needle, which the master's next vacuum makes permanent. #10434 stopped the filer from minting a volume write token for that caller, which closes the write half only where the volume server has a jwt.signing.key of its own -- not the shipped default, and not what scaffold/security.toml recommends for a filer deployment. The read half stayed open in every configuration, because the filer mints the read token itself. Move the dispatch below the gate. A file id carries no path, so a token restricted by allowed_prefixes cannot be scoped against one and is refused here; every consumer of this endpoint holds an unrestricted token. * filer: mint the volume credential for a proxied write too The proxy minted a volume token on reads and forwarded whatever the caller sent on writes. #10434 made it that way because the branch ran ahead of the JWT gate, so a token minted here would have been signed for an unauthenticated caller; the branch now runs behind the gate, and the credential the caller presents there is a filer one, which a volume server cannot validate and has no business seeing. Mint at the access level the request needs, and drop the caller's Authorization when there is no key to mint from. A proxied uploader then needs only the filer credential, instead of holding one for each hop with a single header to put them in. * mount, mq, filer.sync: send the filer credential for a proxied chunk Every in-tree consumer of ?proxyChunkId= reached the filer anonymously: mount and the broker put the AssignVolume token in the Authorization header, which is a volume credential, and filer.sync sent nothing at all. That was enough only while the branch ran ahead of the filer's JWT gate. Build the URL through one helper, and pick the credential from the URL it returns: a chunk proxied through a filer is a request to the filer, which authorizes it and attaches the volume credential itself, so the token there is a filer one at the access level the request needs. * filer: honor -exposeDirectoryData The flag was declared on all three commands that start a filer and read by none of them: FilerOption.ExposeDirectoryData was only ever assigned from filer.expose_directory_metadata in security.toml, so -exposeDirectoryData=false silently left the listing exposed. Only the TOML key had any effect. Plumb the flag through and let either switch turn the listing off. * filer: count a proxied chunk request once Moving the dispatch below the gate put it after the deferred request observation, so every proxied chunk now landed in FilerRequestHistogram twice, once under its HTTP method and once under chunkProxy. Name the deferred one after the proxy instead, the way the unsupported-method branch already does, which also gives the endpoint the status codes FilerRequestCounter records. |
||
|
|
a10607f90a |
Add Terraform support for VM-based SeaweedFS deployment (#9754)
* terraform: add cloud-agnostic core renderer module Renders per-node weed argv, systemd units, config files, disk-mount and secret-fetch scripts, and cloud-init from an address map. Creates zero cloud resources. Flags verified against the weed binary: volume uses -mserver for the master list, gRPC is -port.grpc (auto http+10000), minFreeSpacePercent is a string, filer store via -defaultStoreDir. * terraform: add mTLS and JWT security module Generates the CA, per-component certs with distinct CNs, and JWT signing keys via the tls/random providers. Emits a core_security object plus PEMs for secret-store delivery. * terraform: add AWS deployment module and examples Reserves stable ENIs first, renders config via the core, then creates instances, prevent_destroy EBS data disks mounted at /data, and the cluster security group. With enable_security, generates certs/JWT, stores them in SSM SecureString, grants an instance role, and fetches them at boot so secrets stay out of user_data. Keyed for_each on every stateful tier. * terraform: add local cluster test harnesses run_local_cluster.sh and run_local_secure.sh render a cluster with the core and run real weed processes, asserting master quorum, volume registration, filer/s3 round-trips, mutual-TLS formation, and JWT enforcement. Use an isolated high port range with a guard so they never touch a cluster already running on the machine. The weed binary defaults to $(go env GOPATH)/bin/weed. * terraform: add CI workflow and README fmt/validate/tofu-test plus smoke jobs that build weed and run both harnesses. * terraform: guard against empty filesystem UUID in mount script An empty UUID made grep -q match any fstab line, skipping the fstab entry and breaking the mount. Fail fast when blkid returns no UUID. * terraform: sanitize cluster name in WEED_CLUSTER env keys Hyphens or spaces in cluster_name produced invalid systemd/bash env var names; map non-alphanumerics to underscores. * terraform: omit empty jwt.signing block from security.toml With enable_security and no JWT key, the template emitted [jwt.signing] key="". Gate the block on a non-empty key and cover it with a test. * terraform: mark core security input as sensitive The security object carries JWT signing keys; keep them out of plan output and known values. * terraform: enforce jwt_length minimum of 32 * terraform: note region/AZ coupling in HA example * terraform: guard WORKDIR before recursive delete in test harnesses * terraform: fix README fence language and test count * terraform: handle embedded s3 with no filer nodes Indexing sort(keys(var.filers))[0] errored at plan time when embedded S3 was enabled but no filers were defined; fall back to an empty config source. * terraform: scope kms:Decrypt to a configurable key arn Replace the hardcoded Resource="*" with a kms_key_arn variable (default "*") so production can restrict decrypt to a specific CMK. * terraform: encrypt EBS data volumes at rest Set encrypted = true on the volume/filer data disks and the all-in-one example disk. * terraform: protect filer instances from API termination Filers hold the leveldb2 metadata store, so they are stateful and get the same disable_api_termination as masters and volumes. * terraform: stop instance before detaching in all-in-one example * terraform: drop stale references to the removed plan doc * terraform: correct stale mount-step comment in aws module * terraform: mark Terraform support as experimental in README |