Table of Contents
STS (Security Token Service)
STS is part of the advanced IAM system (
-s3.iam.config/-iam.config). See S3 Configuration for how it relates to-s3.config.
The S3 gateway also answers the AWS STS API. A caller trades something it already has (an access key, an OIDC token, an LDAP password) for temporary credentials: an ASIA... access key, a secret, and a session token that expire on their own.
| Action | Caller proves itself with | Session runs as |
|---|---|---|
AssumeRole |
SigV4 access key (static user, IAM user, or another session) | the named role, or the caller itself when RoleArn is omitted |
AssumeRoleWithWebIdentity |
OIDC JWT (WebIdentityToken) |
the named role, or the policies in a token claim |
AssumeRoleWithLDAPIdentity |
LDAP username and password | the named role |
GetFederationToken |
SigV4 access key of a long-term user | the caller, narrowed by an optional session policy |
GetCallerIdentity |
any SigV4 credentials | n/a, returns who you are |
Endpoint
STS shares the S3 port. Requests are POST / with Action=...&Version=2011-06-15, as query parameters or as a form body, so any AWS SDK or the AWS CLI works with the S3 endpoint as its STS endpoint:
export AWS_ENDPOINT_URL_STS=http://localhost:8333 # or pass --endpoint-url on each call
aws sts get-caller-identity
STS is on whenever the advanced IAM system is running, which is the default for weed s3, weed server -s3 and weed mini, with or without an IAM config file. Without a file, policies default to allow; see the zero-configuration notes in S3 Configuration.
Configuration
The sts block of the IAM config file:
{
"sts": {
"tokenDuration": "1h",
"maxSessionLength": "12h",
"issuer": "seaweedfs-sts",
"signingKey": "base64-encoded-32-byte-key",
"accountId": "000000000000"
},
"providers": [ ... ],
"policies": [ ... ],
"roles": [ ... ]
}
| Field | Default | Meaning |
|---|---|---|
tokenDuration |
1h |
Session length when the caller does not pass DurationSeconds |
maxSessionLength |
12h |
Upper bound for DurationSeconds on the AssumeRole* actions |
issuer |
seaweedfs-sts |
iss of the session tokens this cluster mints and accepts |
signingKey |
see below | HMAC key for session tokens and for deriving session secrets |
accountId |
000000000000 |
Account in the ARNs STS builds (assumed-role, federated-user, LDAP users) |
Without signingKey, the gateway uses the filer JWT signing key from security.toml, then a key derived from the cluster's SSE-S3 master key. Details in S3 Configuration under "STS Configuration & Defaults".
Sessions are stateless: everything about a session is in its signed token, so any gateway can validate a session another gateway issued, with no shared session store. That only holds when every gateway has the same issuer and signingKey. Changing the signing key ends every outstanding session.
Session length
| Action | DurationSeconds range |
Default |
|---|---|---|
AssumeRole, AssumeRoleWithWebIdentity, AssumeRoleWithLDAPIdentity |
900 to maxSessionLength |
tokenDuration |
GetFederationToken |
900 to 129600 (36h) | 43200 (12h) |
A role's maxSessionDuration (seconds) further caps sessions for that role.
Roles
A role is a set of attached policies plus a trust policy that says who may assume it. Roles come from the roles list in the IAM config file, or are created at runtime through the IAM API.
{
"roleName": "Uploader",
"roleArn": "arn:aws:iam::000000000000:role/Uploader",
"attachedPolicies": ["UploadPolicy"],
"maxSessionDuration": 3600,
"trustPolicy": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::000000000000:user/ci" },
"Action": "sts:AssumeRole"
}
]
}
}
Trust policies are deny by default: a role with no trust policy, or none that matches, cannot be assumed. Principal values are compared exactly; the only pattern is "*".
Managing roles through the IAM API
The IAM API on the S3 port supports CreateRole, GetRole, ListRoles, DeleteRole, UpdateAssumeRolePolicy, AttachRolePolicy, DetachRolePolicy and ListAttachedRolePolicies:
aws iam create-policy --endpoint-url http://localhost:8333 \
--policy-name UploadPolicy --policy-document file://upload-policy.json
aws iam create-role --endpoint-url http://localhost:8333 \
--role-name Uploader \
--assume-role-policy-document file://trust.json
aws iam attach-role-policy --endpoint-url http://localhost:8333 \
--role-name Uploader --policy-arn arn:aws:iam::000000000000:policy/UploadPolicy
Where those roles live depends on roleStore:
{ "roleStore": { "storeType": "filer" } }
With no IAM config file the role store is the filer, so runtime roles survive restarts and every gateway sees them. With a config file it defaults to memory: runtime roles are lost on restart and are local to one gateway, so set "storeType": "filer" if you create roles through the API. Roles from the config file are never written to the store and cannot be changed or deleted through the API; a stored role with the same name takes precedence over the file's.
Deleting a role, or replacing it with a new role of the same name, ends the sessions issued for it.
AssumeRole
Signed with SigV4 by any principal the gateway knows: a -s3.config identity, an IAM user, a service account, or an existing session (role chaining).
aws sts assume-role \
--role-arn arn:aws:iam::000000000000:role/Uploader \
--role-session-name build-42 \
--duration-seconds 1800
With RoleArn. The role's trust policy decides, evaluated as action sts:AssumeRole with the caller's ARN as the AWS principal. The caller's own policies do not need to allow sts:AssumeRole, but an explicit Deny of it, or a permissions boundary that excludes it, still blocks. The session gets the role's attached policies, never the caller's, even when the caller is an admin.
The caller's ARN is what GetCallerIdentity returns. For -s3.config identities it is arn:aws:iam::000000000000:user/<identity name>. A session's ARN is arn:aws:sts::<accountId>:assumed-role/<role>/<session name>.
Without RoleArn. The caller gets a session for itself, with its own permissions. This needs sts:AssumeRole allowed in the caller's own policy (an admin identity qualifies). Useful for clients that only know how to work with session credentials.
RoleSessionName is required: 2 to 64 characters from [\w+=,.@-].
AssumeRoleWithWebIdentity
Exchanges an OIDC token for a session. No SigV4 signature; the token is the credential.
aws sts assume-role-with-web-identity \
--role-arn arn:aws:iam::000000000000:role/S3ReadOnlyRole \
--role-session-name alice \
--web-identity-token "$OIDC_TOKEN"
The token must come from a configured OIDC provider (signature checked against its JWKS, iss and aud/azp checked against issuer and clientId). Provider setup is in OIDC Integration; Kubernetes ServiceAccount Authentication is the IRSA-style recipe for pods.
The trust policy is evaluated as action sts:AssumeRoleWithWebIdentity with these keys:
| Key | Value |
|---|---|
Principal Federated |
the provider's name from the config (or the issuer URL if no configured provider has that issuer) |
oidc:iss, oidc:sub, oidc:aud |
the token's iss, sub, aud |
oidc:<claim> |
any other top-level claim, e.g. oidc:groups, oidc:email |
sts:DurationSeconds |
the requested duration |
{
"Effect": "Allow",
"Principal": { "Federated": "keycloak" },
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": { "oidc:sub": "a8f6b7c2-..." },
"ForAnyValue:StringEquals": { "oidc:groups": ["data-eng"] }
}
}
If the provider has a roleMapping and the requested role appears in it (as a rule's role or the defaultRole), the token must also map to that role. Roles the mapping does not mention are governed by their trust policy alone.
The session keeps the token's identity for request-time policies: jwt:sub, jwt:groups, jwt:roles, any other claim as ${jwt:<claim>}, and aws:PrincipalTag/<key> for claim keys listed in the provider's allowedPrincipalTagKeys. See S3 Policy Variables.
Claim-based policies
Set policyClaim on an OIDC provider to let the IdP hand out permissions directly. When the caller omits RoleArn (or passes arn:aws:iam:::role/sts-claim-based) and the token carries that claim, the session gets the policies named in the claim (a string, a comma-separated string, or an array of policy names). No role or trust policy is consulted: the IdP is the authority for both who you are and what you may do. A token without the claim is refused.
AssumeRoleWithLDAPIdentity
Authenticates a user against an LDAP provider and returns a session for a role. This action is not in AWS STS, so the AWS CLI has no command for it; send the form directly.
Add an LDAP provider:
{
"providers": [
{
"name": "corp-ldap",
"type": "ldap",
"enabled": true,
"config": {
"server": "ldaps://ldap.example.com:636",
"bindDN": "cn=svc-seaweedfs,ou=svc,dc=example,dc=com",
"bindPassword": "...",
"baseDN": "ou=people,dc=example,dc=com",
"userFilter": "(uid=%s)"
}
}
]
}
Then call it with form parameters (no signature):
curl -s -X POST http://localhost:8333/ \
--data-urlencode Action=AssumeRoleWithLDAPIdentity \
--data-urlencode Version=2011-06-15 \
--data-urlencode RoleArn=arn:aws:iam::000000000000:role/Analyst \
--data-urlencode RoleSessionName=alice \
--data-urlencode LDAPUsername=alice \
--data-urlencode LDAPPassword="$PASSWORD"
RoleArn is required. With several LDAP providers, pass LDAPProviderName to pick one.
The trust policy is evaluated the same way as AssumeRole: action sts:AssumeRole, with the LDAP user as the AWS principal arn:aws:iam::<accountId>:user/<uid>. So a role either trusts named LDAP users, or "*":
{
"Effect": "Allow",
"Principal": { "AWS": ["arn:aws:iam::000000000000:user/alice", "arn:aws:iam::000000000000:user/bob"] },
"Action": "sts:AssumeRole"
}
LDAP group membership is not visible to the trust policy, so a role cannot be limited to an LDAP group. Principal: "*" admits every user the LDAP server authenticates.
GetFederationToken
A long-term user (not a session) gets temporary credentials for itself, usually narrowed with a session policy to hand to something less trusted.
aws sts get-federation-token --name uploader --duration-seconds 3600 \
--policy '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:PutObject","Resource":"arn:aws:s3:::incoming/*"}]}'
The caller needs sts:GetFederationToken allowed by its own policy. Name is 2 to 32 characters from [\w+=,.@-]. The session ARN is arn:aws:sts::<accountId>:federated-user/<Name>, and it carries the caller's policies (including group policies) intersected with the session policy.
GetCallerIdentity
Returns the ARN, user ID and account of whatever credentials signed the request. It is the quickest way to find the ARN to put in a trust policy, and to check that a session works.
aws sts get-caller-identity
Session policies
AssumeRole, AssumeRoleWithWebIdentity, AssumeRoleWithLDAPIdentity and GetFederationToken take an optional Policy parameter. The session can then do only what both the role (or caller) and the session policy allow. It cannot grant anything the role does not have. Up to 2048 characters; PackedPolicySize in the response is the percentage of that used.
Using the credentials
Any AWS SDK or tool that takes a session token:
export AWS_ACCESS_KEY_ID=ASIA...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...
aws --endpoint-url http://localhost:8333 s3 ls
The token travels as X-Amz-Security-Token, in the header for signed requests and in the query string for presigned URLs. A presigned URL stops working when its session expires, whatever its own expiry says.
A session ends when it expires, when its role is deleted or replaced, or when the signing key changes. There is no API to revoke a single session early, so keep durations short for anything you may need to cut off.
Errors
| Code | HTTP | Typical cause |
|---|---|---|
MissingParameter |
400 | RoleSessionName, WebIdentityToken, LDAPUsername, Name, ... missing |
InvalidParameterValue |
400 | Bad DurationSeconds or session name; web identity token with the wrong issuer or audience, malformed, or missing claims; RoleArn that is not a role ARN |
ExpiredTokenException |
400 | Web identity token already expired |
MalformedPolicyDocument |
400 | Policy is not valid policy JSON or is over 2048 characters |
InvalidAction |
400 | Unknown Action |
AccessDenied |
403 | Bad signature, trust policy refused the caller, LDAP bind failed, identity policy denies, GetFederationToken called with session credentials |
ServiceUnavailable |
503 | STS not initialized, or no LDAP provider configured |
The message carries the specific reason. For more, run the gateway with -v=2 and look for AssumeRole, AssumeRoleWithWebIdentity or AssumeRoleWithLDAPIdentity in the log.
Troubleshooting
| Symptom | Check |
|---|---|
AssumeRole denied for a static user |
Run get-caller-identity with that user's keys and put that exact ARN in the trust policy |
| Session credentials work on one gateway and are rejected by another | Gateways have different signingKey or issuer |
Role created with aws iam create-role disappears after restart |
The IAM config file is in use and roleStore is memory; set "roleStore": {"storeType": "filer"} |
Web identity denied with Federated set to the issuer URL |
aws:FederatedProvider is the provider name when the issuer matches a configured provider |
Web identity denied for a role in roleMapping |
The token's claims do not map to that role; the trust policy is not reached |
| Session shorter than requested | maxSessionLength or the role's maxSessionDuration capped it |
See also
- OIDC Integration, Kubernetes ServiceAccount Authentication
- S3 Configuration, S3 Credentials
- Amazon IAM API, AWS IAM CLI
- S3 Policy Variables, S3 Policy Conditions, S3 Bucket Policies
- S3 API Audit log (sessions are logged with the assumed-role principal and the STS caller)
Introduction
- Quick Start with weed mini
- Simplest S3 Bucket and User Setup
- Components
- Blob Store Architecture
- Getting Started
- Production Setup
- A typical step‐by‐step example
- Benchmarks
- FAQ
- Applications
API
Configuration
- Replication
- Store file with a Time To Live
- Failover Master Server
- Erasure coding for warm storage
- EC Bitrot Detection
- Server Startup via Systemd
- Environment Variables
Filer
- Filer Setup
- Directories and Files
- File Operations Quick Reference
- Data Structure for Large Files
- Filer Data Encryption
- Filer Commands and Operations
- Filer JWT Use
- TUS Resumable Uploads
Filer Stores
- Filer Cassandra Setup
- Filer Redis Setup
- Super Large Directories
- Path-Specific Filer Store
- Choosing a Filer Store
- Customize Filer Store
Management
Advanced Filer Configurations
- Migrate to Filer Store
- Migrate Between Filer Stores
- Add New Filer Store
- Filer Store Replication
- Filer Active Active cross cluster continuous synchronization
- Filer as a Key-Large-Value Store
- Path Specific Configuration
- Filer Change Data Capture
- Filer Operation Serialization
FUSE Mount
- Mount on Windows
- FIO benchmark
- fstab and systemd mount
- POSIX Compliance
- Distributed POSIX Locks
- P2P reading in weed mount
- Mount over the Internet
WebDAV
SFTP Server
Cloud Drive
- Cloud Drive Benefits
- Cloud Drive Architecture
- Configure Remote Storage
- Azure Blob Storage Authentication
- Mount Remote Storage
- Cache Remote Storage
- Cloud Drive Quick Setup
- Gateway to Remote Object Storage
AWS S3 API
- Amazon S3 API
- Supported APIs vs Minio
- S3 Lifecycle
- S3 Lifecycle vs Volume TTL
- S3 Conditional Operations
- S3 CORS
- S3 Object Lock and Retention
- S3 Object Versioning
- S3 RenameObject
- S3 API Benchmark
- S3 API FAQ
- S3 Bucket Quota
- S3 Rate Limiting
- S3 API Audit log
- S3 Nginx Proxy
- Docker Compose for S3
- Image Gateway
S3 Table Bucket
- S3 Table Bucket
- S3 Table Bucket Commands
- S3 Tables Security
- SeaweedFS Iceberg Catalog
- Iceberg REST Catalog API
- Iceberg Table Maintenance
- SeaweedFS Lance Catalog
- Lance Maintenance Worker
S3 Vector Bucket
- S3 Vector Bucket
- S3 Vectors API
- S3 Vector Bucket Metadata Filtering
- S3 Vector Bucket Security
- S3 Vector Bucket Performance
Iceberg Integrations
- Spark Iceberg Integration
- Trino Iceberg Integration
- Dremio Iceberg Integration
- DuckDB Iceberg Integration
- Doris Iceberg Integration
- RisingWave Iceberg Integration
- Lakekeeper Iceberg Integration
- OLake Go Iceberg Integration
Lance Integrations
S3 Authentication & IAM
- S3 Configuration - Start Here
- S3 Credentials (
-s3.config) - OIDC Integration (
-s3.iam.config) - STS - Temporary Credentials
- Kubernetes ServiceAccount Authentication (IRSA-style)
- S3 Policy Variables
- S3 Policy Conditions
- S3 Bucket Policies
- Amazon IAM API
- AWS IAM CLI
- weed shell - Shell IAM Commands
Server-Side Encryption
S3 Client Tools
- AWS CLI with SeaweedFS
- s3cmd with SeaweedFS
- rclone with SeaweedFS
- restic with SeaweedFS
- nodejs with Seaweed S3
Machine Learning
HDFS
- Hadoop Compatible File System
- run Spark on SeaweedFS
- run HBase on SeaweedFS
- Run Trino on SeaweedFS
- Hadoop Benchmark
- HDFS via S3 connector
Replication and Backup
- Async Replication to another Filer [Deprecated]
- Async Backup
- Async Filer Metadata Backup
- Async Replication to Cloud [Deprecated]
- Kubernetes Backups and Recovery with K8up
Metadata Change Events
Messaging
- Structured Data Lake with SMQ and SQL
- Seaweed Message Queue
- SQL Queries on Message Queue
- SQL Quick Reference
- PostgreSQL-compatible Server weed db
- Pub-Sub to SMQ to SQL
- Kafka to Kafka Gateway to SMQ to SQL
Use Cases
Operations
- System Metrics
- weed shell
- Data Backup
- Deployment to Kubernetes and Minikube
- Helm Chart Recipes
- Deployment with seaweed-up
Rust Volume Server
Advanced
- Large File Handling
- Optimization
- Optimization for Many Small Buckets
- Volume Management
- Fixing Damaged Volumes
- Tiered Storage
- Cloud Tier
- Cloud Monitoring
- Load Command Line Options from a file
- SRV Service Discovery
- Volume Files Structure
Security
- Security Overview
- Security Configuration
- Cryptography and FIPS Compliance
- Run Blob Storage on Public Internet