@@ -210,27 +210,10 @@ All secret-storage-core traits are fully implemented for HashiCorp Vault:
210210# Start Vault with Docker Compose
211211docker-compose -f docker-compose.vault.yml up -d
212212
213- # Check status
214- docker-compose -f docker-compose.vault.yml ps
215-
216- # View logs
217- docker-compose -f docker-compose.vault.yml logs -f vault
218-
219213# Stop and clean up
220214docker-compose -f docker-compose.vault.yml down
221215```
222216
223- ## 🧪 Testing
224-
225- ### ** Unit Tests**
226- ``` bash
227- # Test Vault adapter
228- cargo test --package vault-adapter
229-
230- # Test storage factory (includes all adapters)
231- cargo test --package storage-factory
232- ```
233-
234217### ** Integration Tests**
235218``` bash
236219# Start Vault development server
@@ -244,22 +227,6 @@ cargo run --package storage-factory --example iota_vault_demo
244227
245228## 🚀 Production Deployment
246229
247- ### ** Standard Vault Configuration**
248- ``` hcl
249- # Enable Transit secrets engine
250- vault secrets enable -path=iota-transit transit
251-
252- # Create policy for IOTA operations
253- vault policy write iota-policy - <<EOF
254- path "iota-transit/keys/*" {
255- capabilities = ["create", "read", "update", "delete", "list"]
256- }
257- path "iota-transit/sign/*" {
258- capabilities = ["update"]
259- }
260- EOF
261- ```
262-
263230### ** Environment Configuration (Standard Mode)**
264231``` bash
265232# Production environment
@@ -272,179 +239,6 @@ export VAULT_MOUNT_PATH="iota-transit"
272239
273240The recommended approach for Kubernetes deployments uses the Vault Agent sidecar pattern for enhanced security.
274241
275- ** Benefits:**
276- - ✅ No long-lived secrets in pods
277- - ✅ Automatic token rotation (e.g., TTL 1h)
278- - ✅ ServiceAccount-based authentication
279- - ✅ Reduced attack surface
280- - ✅ Zero secret management in app code
281-
282- ** Step 1: Enable Kubernetes Authentication in Vault**
283-
284- ``` bash
285- # Enable Kubernetes auth method
286- vault auth enable kubernetes
287-
288- # Configure Kubernetes authentication
289- vault write auth/kubernetes/config \
290- kubernetes_host=" https://kubernetes.default.svc" \
291- kubernetes_ca_cert=@/var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
292- token_reviewer_jwt=@/var/run/secrets/kubernetes.io/serviceaccount/token
293-
294- # Create role for IOTA app
295- vault write auth/kubernetes/role/iota-app \
296- bound_service_account_names=iota-app \
297- bound_service_account_namespaces=iota \
298- policies=iota-policy \
299- ttl=1h
300- ```
301-
302- ** Step 2: Create Vault Agent ConfigMap**
303-
304- ``` yaml
305- apiVersion : v1
306- kind : ConfigMap
307- metadata :
308- name : vault-agent-config
309- namespace : iota
310- data :
311- agent.hcl : |
312- # Auto-authentication using Kubernetes ServiceAccount
313- auto_auth {
314- method "kubernetes" {
315- mount_path = "auth/kubernetes"
316- config = {
317- role = "iota-app"
318- }
319- }
320-
321- sink "file" {
322- config = {
323- path = "/vault/secrets/token"
324- }
325- }
326- }
327-
328- # API proxy with automatic token injection
329- api_proxy {
330- use_auto_auth_token = true
331- }
332-
333- # Local listener for app connections
334- listener "tcp" {
335- address = "127.0.0.1:8100"
336- tls_disable = true
337- }
338-
339- # Vault server address
340- vault {
341- address = "https://vault.company.com:8200"
342- }
343- ` ` `
344-
345- **Step 3: Deploy Application with Sidecar**
346-
347- ` ` ` yaml
348- apiVersion : v1
349- kind : ServiceAccount
350- metadata :
351- name : iota-app
352- namespace : iota
353- ---
354- apiVersion : apps/v1
355- kind : Deployment
356- metadata :
357- name : iota-app
358- namespace : iota
359- spec :
360- replicas : 3
361- selector :
362- matchLabels :
363- app : iota-app
364- template :
365- metadata :
366- labels :
367- app : iota-app
368- spec :
369- serviceAccountName : iota-app
370-
371- containers :
372- # Main application container
373- - name : app
374- image : iota-app:latest
375- env :
376- # Point to local Vault Agent proxy
377- - name : VAULT_ADDR
378- value : " http://127.0.0.1:8100"
379- # Enable Vault Agent mode (no token needed)
380- - name : VAULT_AGENT_MODE
381- value : " true"
382- - name : VAULT_MOUNT_PATH
383- value : " iota-transit"
384- ports :
385- - containerPort : 8080
386- resources :
387- requests :
388- cpu : 100m
389- memory : 128Mi
390- limits :
391- cpu : 500m
392- memory : 512Mi
393-
394- # Vault Agent sidecar
395- - name : vault-agent
396- image : hashicorp/vault:1.15
397- args :
398- - " agent"
399- - " -config=/vault/config/agent.hcl"
400- env :
401- - name : VAULT_ADDR
402- value : " https://vault.company.com:8200"
403- volumeMounts :
404- - name : vault-config
405- mountPath : /vault/config
406- - name : vault-secrets
407- mountPath : /vault/secrets
408- resources :
409- requests :
410- cpu : 50m
411- memory : 64Mi
412- limits :
413- cpu : 200m
414- memory : 256Mi
415-
416- volumes :
417- - name : vault-config
418- configMap :
419- name : vault-agent-config
420- - name : vault-secrets
421- emptyDir :
422- medium : Memory
423- ` ` `
424-
425- **Step 4: Deploy and Verify**
426-
427- ` ` ` bash
428- # Apply all resources
429- kubectl apply -f vault-agent-configmap.yaml
430- kubectl apply -f iota-app-deployment.yaml
431-
432- # Check pod status
433- kubectl get pods -n iota
434-
435- # Verify both containers are running
436- kubectl describe pod -n iota <pod-name>
437-
438- # Check application logs
439- kubectl logs -n iota <pod-name> -c app
440-
441- # Check Vault Agent logs
442- kubectl logs -n iota <pod-name> -c vault-agent
443-
444- # Test the application
445- kubectl port-forward -n iota <pod-name> 8080:8080
446- ```
447-
448242** Application Code (No Changes Required!):**
449243
450244``` rust
@@ -465,21 +259,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
465259}
466260```
467261
468- ## 📊 Performance Characteristics
469-
470- - ** Key Generation** : ~ 200-500ms (network dependent)
471- - ** Signing Operations** : ~ 100-300ms (network dependent)
472- - ** Concurrent Operations** : Supported (Vault handles concurrency)
473- - ** Scalability** : Enterprise-grade with Vault clustering
474-
475- ## 🔒 Security Features
476-
477- - ** Hardware Security** : Keys secured in Vault's encryption boundary
478- - ** Audit Logging** : Complete audit trail through Vault logs
479- - ** Access Control** : Fine-grained policies and authentication
480- - ** Network Security** : TLS encryption for all communications
481- - ** Key Isolation** : Strong isolation between different applications/tenants
482-
483262## 🎉 Summary
484263
485264The HashiCorp Vault adapter provides a complete, enterprise-ready alternative to AWS KMS for IOTA secret storage, featuring:
0 commit comments