Commit graph

19 commits

Author SHA1 Message Date
Harald Hoyer 92f37d6b37 chore(logging): update log level for vault_hier to trace
- Changed log level directive for `vault_hier` from `info` to `trace`.
- Enables more detailed logging for debugging purposes.
2025-03-20 16:52:14 +01:00
Harald Hoyer b445634b53 feat(test): enhance test_local.sh with error handling and API port
- Added fixed API_PORT and API_URL variables for easier debugging.
- Introduced robust error handling functions and cleanup traps.
- Enhanced test flow with detailed logs and fallback logic for token creation.
- Increased server start wait time for reliability and added new document operations.
2025-03-20 16:31:40 +01:00
Harald Hoyer 26e81cef17 feat: add CLI commands and server default behavior
- Introduced CLI commands for server, login, upload, sign, verify, and more using `clap`.
- Updated Dockerfile and docker-compose to default to `server` command on startup.
- Enhanced `test_local.sh` for testing the server and client operations.
- Added multipart support to `reqwest` and new CLI documentation in `README.md`.
- Updated `Cargo.toml` with new dependencies to support CLI and multipart uploads.
2025-03-20 16:23:29 +01:00
Harald Hoyer c662dfbfd8 feat(test): enhance test_local.sh with better cleanup
- Replace `curl` with `wget` for Vault health check.
- Ensure cleanup of temporary files and directories.
2025-03-20 15:51:13 +01:00
Harald Hoyer fbc8e689d4 refactor: remove tokio TcpListener and simplify address setup
- Replaced `tokio::net::TcpListener` with direct `SocketAddr` setup.
- Simplified server address configuration while maintaining functionality.
- Reduced unnecessary dependencies for cleaner API handling.
2025-03-20 15:49:38 +01:00
Harald Hoyer 5c0dcdb97a feat: disable Vault UI in local testing and compose setup
- Set `ui` to `false` in test_local.sh and docker-compose.yml.
- This change ensures the Vault UI is disabled for local tests.
- Helps streamline configurations for non-UI testing environments.
2025-03-20 15:49:25 +01:00
Harald Hoyer 430970b375 feat(vault): add automated Vault initialization and unseal
- Introduced `initialize_vault` function to handle Vault setup, including health checks, initialization, and unsealing.
- Moved Vault-related logic into dedicated modules (`vault_init` and `vault_setup`) for cleaner separation of concerns.
- Simplified `main.rs` by delegating Vault initialization to a modular function.
2025-03-20 15:31:04 +01:00
Harald Hoyer c3902ff0f1 docs: add development guidelines in CLAUDE.md
- Introduce coding standards, testing commands, and tool usage.
- Outline architecture notes, style, and logging conventions.
- Provide guidance on modular design and authentication protocols.
2025-03-20 15:10:10 +01:00
Harald Hoyer 8f28cc1af2 feat: integrate tracing for structured logging
- Added `tracing` and `tracing-subscriber` for improved logging, replacing `println` statements with `info`, `debug`, `warn`, and `error`.
- Annotated key methods with `#[instrument]` for better tracing of function calls and arguments.
- Configured logging initialization in `main.rs` with `EnvFilter` to control log verbosity.
2025-03-20 15:04:52 +01:00
Harald Hoyer f11b83ddf4 feat: add hierarchical document signing with Vault API
- Introduced a new hierarchical signing system using HashiCorp Vault.
- Added Rust modules for user management, secrets setup, and document API.
- Implemented API endpoints for login, document upload, signing, and verification.
- Updated README with features, usage, and API examples.
2025-03-20 14:39:22 +01:00
Harald Hoyer 0dc662865f Update test script to use jq and readarray
- Use jq for JSON credential extraction
- Use readarray with process substitution for elegant key parsing
- Assume modern Bash for readarray support (version 5+)
- Improve array handling for environment variables
- Streamline key extraction and application

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 13:56:33 +01:00
Harald Hoyer a3fa6c2e8d Improve test script portability
- Replace #!/bin/bash with #!/usr/bin/env bash for better portability
- This helps ensure scripts run correctly on different systems where bash
  might be located in different paths

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 13:19:17 +01:00
Harald Hoyer 9b3ac63c3e Implement JSON credential storage
- Add JSON format for storing Vault credentials
- Update save_credentials function to support both formats
- Save both .json and .txt files for compatibility
- Update test_docker.sh to use jq for reliable JSON parsing
- Improve key extraction for unseal operations
- Update .gitignore to exclude JSON credentials

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 13:16:39 +01:00
Harald Hoyer 98384791c3 Improve Vault status detection in test script
- Use better pattern matching to extract sealed status
- Add more verbose logging of seal status
- Make status checks more resilient to formatting differences
- Ensure test correctly interprets Vault status output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:58:09 +01:00
Harald Hoyer d27bd8c57a Enhance Docker test script for more reliable Vault testing
- Use direct Vault commands for unsealing
- Improve key extraction and handling
- Clarify test messages to match expected state
- Fix array handling and proper Bash syntax

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:57:24 +01:00
Harald Hoyer 8595cdead3 Use grep for more reliable JSON value detection in test script
- Replace Bash pattern matching with grep for more consistent testing
- Add more explicit comments about detecting sealed/unsealed status
- Improve overall reliability of the test script

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:55:53 +01:00
Harald Hoyer 334fc50ac7 Fix vault status checks in Docker test script
- Update JSON parsing to handle Vault status response correctly
- Remove redundant status extraction with grep
- Use safer string matching approach with Bash pattern matching

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:55:09 +01:00
Harald Hoyer f44dcd1f98 Add Docker Compose test script
This script provides comprehensive testing for the vault-hier project with Docker Compose:
- Tests initial setup, initialization, and unsealing
- Verifies credential file generation
- Tests restart scenario and automatic unsealing
- Validates basic Vault operations (login, secrets, etc.)
- Includes proper cleanup and error handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:52:05 +01:00
Harald Hoyer 07cf031bbb Initial commit: Vault Hierarchical Initializer
This commit adds the full implementation of vault-hier, a Rust utility for:
- Initializing HashiCorp Vault in production mode (non-dev)
- Handling Vault seal/unseal operations with key thresholds
- Using Docker Compose for containerized operation
- Supporting persistent storage via Docker volumes

Key components:
- Rust application for Vault interaction
- Docker and Docker Compose configuration
- Test scripts for local development
- Nix flake for development dependencies

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-20 12:49:44 +01:00