Files
upstream-mirror 89f5be005d
Some checks failed
go: build dev binaries / cleanup (push) Successful in 4s
Codespell / Check for spelling errors (push) Failing after 3s
docker: build dev containers / build-rust-binaries (amd64, x86_64-unknown-linux-musl) (push) Failing after 3s
docker: build dev containers / build-dev-containers (push) Has been skipped
docker: build dev containers / build-rust-binaries (arm64, true, aarch64-unknown-linux-musl) (push) Failing after 3s
End to End / FUSE Mount (push) Failing after 2s
EC Integration Tests / EC Integration Tests (push) Failing after 30s
FUSE DLM Integration Tests / FUSE DLM Integration Tests (push) Failing after 3s
FUSE Volume Server Failover Tests / FUSE Volume Server Failover (push) Failing after 3s
FUSE Integration Tests / FUSE Integration Testing (push) Failing after 2s
FUSE P2P Peer Chunk Sharing Integration Tests / FUSE P2P Peer Chunk Sharing (push) Failing after 3s
go: build binary / Go Vet (push) Failing after 2s
go: build binary / Go Vet 32-bit (push) Failing after 3s
go: build binary / Build (push) Failing after 4s
go: build binary / Build cross-platform (freebsd/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (darwin/arm64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/arm64) (push) Failing after 3s
go: build binary / Test (push) Failing after 2s
go: build binary / Test 32-bit (push) Failing after 3s
helm: lint and test charts / lint-test (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (11) (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (17) (push) Failing after 3s
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Failing after 2s
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Failing after 3s
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Has been skipped
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Has been skipped
Java Client Unit Tests / Java Unit Tests (11) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (17) (push) Failing after 2s
Java Client Unit Tests / Java Unit Tests (21) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (8) (push) Failing after 3s
Kafka Quick Test (Load Test with Schema Registry) / Kafka Client Load Test (Quick) (push) Failing after 3s
Kafka Gateway Tests / Kafka Unit Tests (unit-tests-1) (push) Failing after 11s
Kafka Gateway Tests / Kafka Integration Tests (Critical) (integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka End-to-End Tests (with SMQ) (e2e-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Consumer Group Tests (Highly Isolated) (consumer-group-1) (push) Failing after 2s
Kafka Gateway Tests / Kafka Client Compatibility (with SMQ) (client-compat-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka SMQ Integration Tests (Full Stack) (smq-integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Protocol Tests (Isolated) (protocol-1) (push) Failing after 3s
KMS Tests / KMS Provider Integration Tests (push) Failing after 2s
KMS Tests / S3 KMS End-to-End Tests (push) Failing after 3s
Master Cold Start Tests / Master Cold Start Tests (push) Failing after 4s
Metadata Subscribe Integration Tests / Metadata Subscribe Integration Tests (push) Failing after 3s
Multi-Master Tests / Multi-Master Failover Tests (push) Failing after 3s
Performance / CPU and Heap Profile (push) Failing after 2s
Performance / S3 Read/Write Benchmark (rust volume) (push) Failing after 3s
pjdfstest POSIX Compliance / pjdfstest (push) Failing after 2s
Plugin Worker Integration Tests / Plugin Worker: erasure_coding (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: vacuum (push) Failing after 3s
Rust Volume Server Tests / Rust Integration Tests (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 1) (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 1) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 3) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Distributed Tests (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Performance Tests (push) Failing after 3s
Performance / Throughput Benchmark (go volume) (push) Failing after 3s
Performance / Throughput Benchmark (rust volume) (push) Failing after 2s
Performance / S3 Read/Write Benchmark (go volume) (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: volume_balance (push) Failing after 3s
PostgreSQL Gateway Tests / PostgreSQL Basic Tests (push) Failing after 3s
Rust Volume Server Tests / Rust Unit Tests (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 3) (push) Failing after 3s
Rust Plugin Worker Tests / Rust Plugin Worker Build and Unit Tests (push) Failing after 3s
rust: build dev volume server binaries / cleanup (push) Successful in 3s
S3 ETag and ACL Tests / S3 ETag + ACL Integration Tests (push) Failing after 3s
S3 IAM Integration Tests / IAM Unit Tests (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (advanced) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (basic) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (group) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (policy-enforcement) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (sts) (push) Failing after 4s
S3 Keycloak Integration Tests / S3 Keycloak Integration Tests (push) Failing after 3s
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.11) (push) Failing after 3s
S3 PyArrow Parquet Tests / Go Unit Tests (Implicit Directory) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.12) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-amd64, x86_64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-arm64, aarch64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-linux (linux-amd64, x86_64-unknown-linux-gnu) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.9) (push) Has been cancelled
S3 Proxy Signature Tests / S3 Proxy Signature Verification Tests (push) Has been cancelled
S3 SDK V2 Route Disambiguation Tests / S3 SDK V2 Routing Tests (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (quick) (push) Has been cancelled
S3 SSE Tests / S3 SSE Compatibility Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Metadata Persistence Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Copy Operations Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Multipart Upload Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Performance Test (push) Has been cancelled
S3 SSE Tests / S3 Volume Encryption Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (comprehensive) (push) Has been cancelled
Spark Integration Tests / Spark Integration Tests (push) Failing after 2s
Telemetry Integration Tests / telemetry-integration-test (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 1) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 1) (push) Failing after 3s
Ceph S3 tests / Basic S3 tests (KV store) (push) Has been cancelled
Ceph S3 tests / S3 Versioning & Object Lock tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Unit Tests (push) Failing after 3s
Ceph S3 tests / S3 CORS tests (push) Has been cancelled
Ceph S3 tests / SeaweedFS Custom S3 Copy tests (push) Has been cancelled
Ceph S3 tests / Basic S3 tests (SQL store) (push) Has been cancelled
test s3 over https using aws-cli / awscli-tests (push) Has been cancelled
TLS Rotation Integration Tests / TLS Rotation Integration Tests (push) Has been cancelled
Vacuum Integration Tests / Vacuum Integration Tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Variables Integration Tests (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (advanced-policy) (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (basic-policy) (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (contextual-policy) (push) Failing after 4s
S3 Policy Integration Tests / Trusted Proxy Detection Tests (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Shell Integration Tests (push) Failing after 3s
Samba on FUSE Integration / samba-integration (push) Failing after 2s
SFTP Integration Tests / SFTP Integration Testing (push) Failing after 3s
terraform: validate and test modules / fmt, validate, plan-level tests (push) Failing after 3s
terraform: validate and test modules / local cluster smoke test (real weed) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 3) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 2) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 2) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 3) (push) Failing after 5s
mount: windows conformance / WinFsp conformance (push) Has been cancelled
mount: windows / Mount on Windows (push) Has been cancelled
snapshot of https://github.com/seaweedfs/seaweedfs.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 03:23:42 +05:00
..

🔐 SeaweedFS KMS Integration Tests

This directory contains comprehensive integration tests for SeaweedFS Server-Side Encryption (SSE) with Key Management Service (KMS) providers. The tests validate the complete encryption/decryption workflow using OpenBao (open source fork of HashiCorp Vault) as the KMS provider.

🎯 Overview

The KMS integration tests simulate AWS KMS functionality using OpenBao, providing:

  • ✅ Production-grade KMS testing with real encryption/decryption operations
  • ✅ S3 API compatibility testing with SSE-KMS headers and bucket encryption
  • ✅ Per-bucket KMS configuration validation
  • ✅ Performance benchmarks for KMS operations
  • ✅ Error handling and edge case coverage
  • ✅ End-to-end workflows from S3 API to KMS provider

🏗️ Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   S3 Client     │    │   SeaweedFS     │    │    OpenBao      │
│   (aws s3)      │───▶│   S3 API        │───▶│   Transit       │
└─────────────────┘    └─────────────────┘    └─────────────────┘
        │                       │                       │
        │              ┌─────────────────┐              │
        │              │ KMS Manager     │              │
        └──────────────▶│ - AWS Provider  │◀─────────────┘
                       │ - Azure Provider│
                       │ - GCP Provider  │
                       │ - OpenBao       │
                       └─────────────────┘

📋 Prerequisites

Required Tools

  • Docker & Docker Compose - For running OpenBao and SeaweedFS
  • OpenBao CLI (bao) - For direct OpenBao interaction (optional)
  • AWS CLI - For S3 API testing
  • jq - For JSON processing in scripts
  • curl - For HTTP API testing
  • Go 1.19+ - For running Go tests

Installation

# Install Docker (macOS)
brew install docker docker-compose

# Install OpenBao (optional - used by some tests)
brew install openbao

# Install AWS CLI  
brew install awscli

# Install jq
brew install jq

🚀 Quick Start

1. Run All Tests

cd test/kms
make test

2. Run Specific Test Types

# Unit tests only
make test-unit

# Integration tests with OpenBao
make test-integration  

# End-to-end S3 API tests
make test-e2e

# Performance benchmarks
make test-benchmark

3. Manual Setup

# Start OpenBao only
make dev-openbao

# Start full environment (OpenBao + SeaweedFS)
make setup-seaweedfs

# Run manual tests
make dev-test

🧪 Test Components

1. OpenBao KMS Provider (openbao_integration_test.go)

What it tests:

  • KMS provider registration and initialization
  • Data key generation using Transit engine
  • Encryption/decryption of data keys
  • Key metadata and validation
  • Error handling (invalid tokens, missing keys, etc.)
  • Multiple key scenarios
  • Performance benchmarks

Key test cases:

TestOpenBaoKMSProvider_Integration
TestOpenBaoKMSProvider_ErrorHandling  
TestKMSManager_WithOpenBao
BenchmarkOpenBaoKMS_GenerateDataKey
BenchmarkOpenBaoKMS_Decrypt

2. S3 API Integration (test_s3_kms.sh)

What it tests:

  • Bucket encryption configuration via S3 API
  • Default bucket encryption behavior
  • Explicit SSE-KMS headers in PUT operations
  • Object upload/download with encryption
  • Multipart uploads with KMS encryption
  • Encryption metadata in object headers
  • Cross-bucket KMS provider isolation

Key scenarios:

# Bucket encryption setup
aws s3api put-bucket-encryption --bucket test-openbao \
  --server-side-encryption-configuration '{
    "Rules": [{
      "ApplyServerSideEncryptionByDefault": {
        "SSEAlgorithm": "aws:kms", 
        "KMSMasterKeyID": "test-key-1"
      }
    }]
  }'

# Object upload with encryption
aws s3 cp file.txt s3://test-openbao/encrypted-file.txt \
  --sse aws:kms --sse-kms-key-id "test-key-2"

3. Docker Environment (docker-compose.yml)

Services:

  • OpenBao - KMS provider (port 8200)
  • Vault - Alternative KMS (port 8201)
  • SeaweedFS Master - Cluster coordination (port 9333)
  • SeaweedFS Volume - Data storage (port 8080)
  • SeaweedFS Filer - S3 API endpoint (port 8333)

4. Configuration (filer.toml)

KMS Configuration:

[kms]
default_provider = "openbao-test"

[kms.providers.openbao-test]
type = "openbao"
address = "http://openbao:8200"
token = "root-token-for-testing"
transit_path = "transit"

[kms.buckets.test-openbao]
provider = "openbao-test"

📊 Test Data

Encryption Keys Created

The setup script creates these test keys in OpenBao:

Key Name Type Purpose
test-key-1 AES256-GCM96 Basic operations
test-key-2 AES256-GCM96 Multi-key scenarios
seaweedfs-test-key AES256-GCM96 Integration testing
bucket-default-key AES256-GCM96 Default bucket encryption
high-security-key AES256-GCM96 Security testing
performance-key AES256-GCM96 Performance benchmarks
multipart-key AES256-GCM96 Multipart upload testing

Test Buckets

Bucket Name KMS Provider Purpose
test-openbao openbao-test OpenBao integration
test-vault vault-test Vault compatibility
test-local local-test Local KMS testing
secure-data openbao-test High security scenarios

🔧 Configuration Options

Environment Variables

# OpenBao configuration
export OPENBAO_ADDR="http://127.0.0.1:8200"
export OPENBAO_TOKEN="root-token-for-testing"

# SeaweedFS configuration  
export SEAWEEDFS_S3_ENDPOINT="http://127.0.0.1:8333"
export ACCESS_KEY="any"
export SECRET_KEY="any"

# Test configuration
export TEST_TIMEOUT="5m"

Makefile Targets

Target Description
make help Show available commands
make setup Set up test environment
make test Run all tests
make test-unit Run unit tests only
make test-integration Run integration tests
make test-e2e Run end-to-end tests
make clean Clean up environment
make logs Show service logs
make status Check service status

🧩 How It Works

1. KMS Provider Registration

OpenBao provider is automatically registered via init():

func init() {
    seaweedkms.RegisterProvider("openbao", NewOpenBaoKMSProvider)
    seaweedkms.RegisterProvider("vault", NewOpenBaoKMSProvider) // Alias
}

2. Data Key Generation Flow

1. S3 PUT with SSE-KMS headers
2. SeaweedFS extracts KMS key ID  
3. KMSManager routes to OpenBao provider
4. OpenBao generates random data key
5. OpenBao encrypts data key with master key
6. SeaweedFS encrypts object with data key
7. Encrypted data key stored in metadata

3. Decryption Flow

1. S3 GET request for encrypted object
2. SeaweedFS extracts encrypted data key from metadata
3. KMSManager routes to OpenBao provider
4. OpenBao decrypts data key with master key
5. SeaweedFS decrypts object with data key
6. Plaintext object returned to client

🔍 Troubleshooting

Common Issues

OpenBao not starting:

# Check if port 8200 is in use
lsof -i :8200

# Check Docker logs
docker-compose logs openbao

KMS provider not found:

# Verify provider registration
go test -v -run TestProviderRegistration ./test/kms/

# Check imports in filer_kms.go
grep -n "kms/" weed/command/filer_kms.go

S3 API connection refused:

# Check SeaweedFS services
make status

# Wait for services to be ready
./wait_for_services.sh

Debug Commands

# Test OpenBao directly
curl -H "X-Vault-Token: root-token-for-testing" \
  http://127.0.0.1:8200/v1/sys/health

# Test transit engine
curl -X POST \
  -H "X-Vault-Token: root-token-for-testing" \
  -d '{"plaintext":"SGVsbG8gV29ybGQ="}' \
  http://127.0.0.1:8200/v1/transit/encrypt/test-key-1

# Test S3 API
aws s3 ls --endpoint-url http://127.0.0.1:8333

🎯 AWS KMS Integration Testing

This test suite simulates AWS KMS behavior using OpenBao, enabling:

✅ Compatibility Validation

  • S3 API compatibility - Same headers, same behavior as AWS S3
  • KMS API patterns - GenerateDataKey, Decrypt, DescribeKey operations
  • Error codes - AWS-compatible error responses
  • Encryption context - Proper context handling and validation

✅ Production Readiness Testing

  • Key rotation scenarios - Multiple keys per bucket
  • Performance characteristics - Latency and throughput metrics
  • Error recovery - Network failures, invalid keys, timeout handling
  • Security validation - Encryption/decryption correctness

✅ Integration Patterns

  • Bucket-level configuration - Different KMS keys per bucket
  • Cross-region simulation - Multiple KMS providers
  • Caching behavior - Data key caching validation
  • Metadata handling - Encrypted metadata storage

📈 Performance Expectations

Typical performance metrics (local testing):

  • Data key generation: ~50-100ms (including network roundtrip)
  • Data key decryption: ~30-50ms (cached provider instance)
  • Object encryption: ~1-5ms per MB (AES-256-GCM)
  • S3 PUT with SSE-KMS: +100-200ms overhead vs. unencrypted

🚀 Production Deployment

After successful integration testing, deploy with real KMS providers:

[kms.providers.aws-prod]
type = "aws"
region = "us-east-1"
# IAM roles preferred over access keys

[kms.providers.azure-prod]  
type = "azure"
vault_url = "https://prod-vault.vault.azure.net/"
use_default_creds = true # Managed identity

[kms.providers.gcp-prod]
type = "gcp" 
project_id = "prod-project"
use_default_credentials = true # Service account

🎉 Success Criteria

Tests pass when:

  • ✅ All KMS providers register successfully
  • ✅ Data key generation/decryption works end-to-end
  • ✅ S3 API encryption headers are handled correctly
  • ✅ Bucket-level KMS configuration is respected
  • ✅ Multipart uploads maintain encryption consistency
  • ✅ Performance meets acceptable thresholds
  • ✅ Error scenarios are handled gracefully

📞 Support

For issues with KMS integration tests:

  1. Check logs: make logs
  2. Verify environment: make status
  3. Run debug: make debug
  4. Clean restart: make clean && make setup

Happy testing! 🔐✨