vaulttool 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vaulttool-2.0.0 → vaulttool-2.0.2}/PKG-INFO +227 -49
- {vaulttool-2.0.0 → vaulttool-2.0.2}/README.md +222 -45
- {vaulttool-2.0.0 → vaulttool-2.0.2}/pyproject.toml +4 -4
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/__init__.py +14 -14
- vaulttool-2.0.2/vaulttool/cli.py +651 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/config.py +30 -30
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/core.py +219 -140
- vaulttool-2.0.2/vaulttool/tests/conftest.py +29 -0
- vaulttool-2.0.2/vaulttool/tests/test_checksum_trigger.py +58 -0
- vaulttool-2.0.2/vaulttool/tests/test_suffix_switch_bug.py +142 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/utils.py +39 -39
- vaulttool-2.0.0/vaulttool/cli.py +0 -365
- vaulttool-2.0.0/vaulttool/tests/test_checksum_trigger.py +0 -48
- {vaulttool-2.0.0 → vaulttool-2.0.2}/LICENSE +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/__main__.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_config.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_core.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_decrypt_missing_sources.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_env_config.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_error_aggregation.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_gitignore.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_key_file_validation.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_main_integration.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_priority3_fixes.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_security_and_edge_cases.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_suffix_fallback.py +0 -0
- {vaulttool-2.0.0 → vaulttool-2.0.2}/vaulttool/tests/test_utils.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: vaulttool
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Secure file encryption for secrets/configs
|
|
5
|
-
Home-page: https://github.com/yourusername/vaulttool
|
|
6
5
|
License: Apache-2
|
|
6
|
+
License-File: LICENSE
|
|
7
7
|
Author: Josef Fuchs
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
9
|
Classifier: License :: Other/Proprietary License
|
|
@@ -12,10 +12,11 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
16
|
Requires-Dist: cryptography
|
|
16
|
-
Requires-Dist: pytest (>=8.4.2,<9.0.0)
|
|
17
17
|
Requires-Dist: pyyaml
|
|
18
18
|
Requires-Dist: typer
|
|
19
|
+
Project-URL: Homepage, https://github.com/yourusername/vaulttool
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
|
|
21
22
|
# Vault Tool
|
|
@@ -65,47 +66,69 @@ vaulttool refresh
|
|
|
65
66
|
|
|
66
67
|
## Table of Contents
|
|
67
68
|
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
69
|
+
- [Vault Tool](#vault-tool)
|
|
70
|
+
- [TL;DR](#tldr)
|
|
71
|
+
- [Table of Contents](#table-of-contents)
|
|
72
|
+
- [Features](#features)
|
|
73
|
+
- [What's New in Version 2.0.0](#whats-new-in-version-200)
|
|
74
|
+
- [Cryptographic Components](#cryptographic-components)
|
|
71
75
|
- [Vault File Format](#vault-file-format)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- [Requirements](#requirements)
|
|
81
|
-
- [Installation](#installation)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- [
|
|
85
|
-
|
|
86
|
-
- [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- [
|
|
97
|
-
- [
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
103
|
-
- [
|
|
104
|
-
- [
|
|
105
|
-
- [
|
|
106
|
-
- [
|
|
107
|
-
- [
|
|
108
|
-
- [
|
|
76
|
+
- [Simplified Installation](#simplified-installation)
|
|
77
|
+
- [Enhanced Security \& Reliability](#enhanced-security--reliability)
|
|
78
|
+
- [Better Error Messages](#better-error-messages)
|
|
79
|
+
- [Comprehensive Logging](#comprehensive-logging)
|
|
80
|
+
- [Improved Error Handling](#improved-error-handling)
|
|
81
|
+
- [Test Coverage](#test-coverage)
|
|
82
|
+
- [What This Means For You](#what-this-means-for-you)
|
|
83
|
+
- [Upgrade Path](#upgrade-path)
|
|
84
|
+
- [Requirements](#requirements)
|
|
85
|
+
- [Installation](#installation)
|
|
86
|
+
- [Install Vault Tool (Recommended: Poetry)](#install-vault-tool-recommended-poetry)
|
|
87
|
+
- [Development/Local Installation](#developmentlocal-installation)
|
|
88
|
+
- [Running the CLI](#running-the-cli)
|
|
89
|
+
- [Generate Encryption Key](#generate-encryption-key)
|
|
90
|
+
- [Configuration](#configuration)
|
|
91
|
+
- [Environment Variable Configuration](#environment-variable-configuration)
|
|
92
|
+
- [Environment Variable Naming Pattern](#environment-variable-naming-pattern)
|
|
93
|
+
- [Data Types](#data-types)
|
|
94
|
+
- [Example: CI/CD Pipeline](#example-cicd-pipeline)
|
|
95
|
+
- [Example: Docker Container](#example-docker-container)
|
|
96
|
+
- [Validation Rules](#validation-rules)
|
|
97
|
+
- [Usage](#usage)
|
|
98
|
+
- [Generate example configuration](#generate-example-configuration)
|
|
99
|
+
- [Display version information](#display-version-information)
|
|
100
|
+
- [Generate or rotate encryption key](#generate-or-rotate-encryption-key)
|
|
101
|
+
- [Encrypt Files](#encrypt-files)
|
|
102
|
+
- [Remove all vault files](#remove-all-vault-files)
|
|
103
|
+
- [Refresh plaintext from vaults](#refresh-plaintext-from-vaults)
|
|
104
|
+
- [Ensure Plaintext Files Are Added to .gitignore](#ensure-plaintext-files-are-added-to-gitignore)
|
|
105
|
+
- [Example Workflow](#example-workflow)
|
|
106
|
+
- [Initial Setup](#initial-setup)
|
|
107
|
+
- [Daily Workflow](#daily-workflow)
|
|
108
|
+
- [Pre-commit Installation](#pre-commit-installation)
|
|
109
|
+
- [Pre-commit Integration](#pre-commit-integration)
|
|
110
|
+
- [Related Tools](#related-tools)
|
|
111
|
+
- [Contributing](#contributing)
|
|
112
|
+
- [How to Contribute](#how-to-contribute)
|
|
113
|
+
- [Development Setup](#development-setup)
|
|
114
|
+
- [Releasing to PyPI](#releasing-to-pypi)
|
|
115
|
+
- [1. Setup GitHub Secret (One-Time)](#1-setup-github-secret-one-time)
|
|
116
|
+
- [2. Release Process](#2-release-process)
|
|
117
|
+
- [3. Automated Steps](#3-automated-steps)
|
|
118
|
+
- [4. Quick Commands](#4-quick-commands)
|
|
119
|
+
- [5. Monitor Release](#5-monitor-release)
|
|
120
|
+
- [Python API Usage](#python-api-usage)
|
|
121
|
+
- [Utility Functions](#utility-functions)
|
|
122
|
+
- [Security Best Practices](#security-best-practices)
|
|
123
|
+
- [Troubleshooting](#troubleshooting)
|
|
124
|
+
- [Common Issues](#common-issues)
|
|
125
|
+
- [Key file too small](#key-file-too-small)
|
|
126
|
+
- [Permission denied](#permission-denied)
|
|
127
|
+
- [Key file missing](#key-file-missing)
|
|
128
|
+
- [Configuration not found](#configuration-not-found)
|
|
129
|
+
- [Cryptography module errors](#cryptography-module-errors)
|
|
130
|
+
- [Getting Help](#getting-help)
|
|
131
|
+
- [License](#license)
|
|
109
132
|
|
|
110
133
|
## Features
|
|
111
134
|
|
|
@@ -293,7 +316,7 @@ except OSError as e:
|
|
|
293
316
|
|
|
294
317
|
**Comprehensive Test Suite:**
|
|
295
318
|
|
|
296
|
-
- **
|
|
319
|
+
- **99 tests** covering all functionality (was 56)
|
|
297
320
|
- **15 new tests** specifically for error handling paths
|
|
298
321
|
- **100% pass rate** with 2.5s execution time
|
|
299
322
|
- **Zero regressions** - all original tests still passing
|
|
@@ -388,15 +411,52 @@ pipx install dist/vaulttool-*.whl --force
|
|
|
388
411
|
|
|
389
412
|
### Generate Encryption Key
|
|
390
413
|
|
|
391
|
-
To create a secure encryption key for your vault, you can use the
|
|
414
|
+
To create a secure encryption key for your vault, you can use the built-in command or generate one manually:
|
|
392
415
|
|
|
393
|
-
**Option 1: Using
|
|
416
|
+
**Option 1: Using VaultTool CLI (Recommended):**
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Generate new key (reads path from .vaulttool.yml)
|
|
420
|
+
vaulttool generate-key
|
|
421
|
+
|
|
422
|
+
# Generate key in custom location
|
|
423
|
+
vaulttool generate-key --key-file ~/.vaulttool/vault.key
|
|
424
|
+
|
|
425
|
+
# Replace existing key with backup
|
|
426
|
+
vaulttool generate-key --force
|
|
427
|
+
|
|
428
|
+
# Replace key AND re-encrypt all vault files
|
|
429
|
+
vaulttool generate-key --rekey --force
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
The `generate-key` command provides:
|
|
433
|
+
- Automatic key generation with proper entropy (64 hex chars = 32 bytes)
|
|
434
|
+
- Automatic backup of existing keys with timestamp
|
|
435
|
+
- Optional rekey functionality to re-encrypt all vaults with new key
|
|
436
|
+
- Proper file permissions (600 - owner read/write only)
|
|
437
|
+
- Interactive prompts for safety (unless `--force` is used)
|
|
438
|
+
|
|
439
|
+
**Rekey Process:**
|
|
440
|
+
|
|
441
|
+
When using `--rekey`, the command performs these steps automatically:
|
|
442
|
+
1. Restores all plaintext files from existing vaults
|
|
443
|
+
2. Removes all old vault files
|
|
444
|
+
3. Backs up the old key with timestamp
|
|
445
|
+
4. Writes the new key
|
|
446
|
+
5. Re-encrypts all files with the new key
|
|
447
|
+
|
|
448
|
+
This is useful when:
|
|
449
|
+
- You need to rotate encryption keys for security
|
|
450
|
+
- A key may have been compromised
|
|
451
|
+
- Migrating to a new key management system
|
|
452
|
+
|
|
453
|
+
**Option 2: Using the provided script:**
|
|
394
454
|
|
|
395
455
|
```bash
|
|
396
456
|
./vaulttool-generate-key.sh
|
|
397
457
|
```
|
|
398
458
|
|
|
399
|
-
**Option
|
|
459
|
+
**Option 3: Manual generation using Python:**
|
|
400
460
|
|
|
401
461
|
```bash
|
|
402
462
|
# Create vaulttool directory in home
|
|
@@ -409,7 +469,7 @@ python3 -c "import secrets; print(secrets.token_hex(32))" > "$HOME/.vaulttool/va
|
|
|
409
469
|
chmod 600 "$HOME/.vaulttool/vault.key"
|
|
410
470
|
```
|
|
411
471
|
|
|
412
|
-
**Option
|
|
472
|
+
**Option 4: Manual generation using OpenSSL (if available):**
|
|
413
473
|
|
|
414
474
|
```bash
|
|
415
475
|
mkdir -p "$HOME/.vaulttool"
|
|
@@ -592,6 +652,46 @@ vaulttool gen-vaulttool > .vaulttool.yml
|
|
|
592
652
|
vaulttool version
|
|
593
653
|
```
|
|
594
654
|
|
|
655
|
+
### Generate or rotate encryption key
|
|
656
|
+
|
|
657
|
+
Generate a new encryption key or rotate an existing one:
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
vaulttool generate-key [OPTIONS]
|
|
661
|
+
|
|
662
|
+
OPTIONS:
|
|
663
|
+
--key-file -k Path to key file (default: from .vaulttool.yml config)
|
|
664
|
+
--rekey Re-encrypt all vault files with the new key
|
|
665
|
+
--force Skip confirmation prompts (use with caution)
|
|
666
|
+
--verbose -v Enable verbose debug logging
|
|
667
|
+
--quiet -q Show only errors (suppress info/warning)
|
|
668
|
+
--help Show this message and exit.
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Examples:
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
# Generate new key using path from config
|
|
675
|
+
vaulttool generate-key
|
|
676
|
+
|
|
677
|
+
# Generate key in specific location
|
|
678
|
+
vaulttool generate-key --key-file ~/.vaulttool/vault.key
|
|
679
|
+
|
|
680
|
+
# Replace existing key (with backup)
|
|
681
|
+
vaulttool generate-key --force
|
|
682
|
+
|
|
683
|
+
# Rotate key and re-encrypt all vaults
|
|
684
|
+
vaulttool generate-key --rekey --force
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
The command will:
|
|
688
|
+
- Create a new key if none exists
|
|
689
|
+
- Backup existing key with timestamp before replacing
|
|
690
|
+
- Optionally re-encrypt all vault files with new key (`--rekey`)
|
|
691
|
+
- Set proper file permissions (600)
|
|
692
|
+
|
|
693
|
+
**Important:** Always test decryption after rekeying before deleting backup keys!
|
|
694
|
+
|
|
595
695
|
### Encrypt Files
|
|
596
696
|
|
|
597
697
|
To encrypt your sensitive files, navigate to your project directory and run:
|
|
@@ -747,6 +847,84 @@ pip install -e .[dev]
|
|
|
747
847
|
pre-commit install
|
|
748
848
|
```
|
|
749
849
|
|
|
850
|
+
### Releasing to PyPI
|
|
851
|
+
|
|
852
|
+
VaultTool uses automated GitHub Actions to publish releases to PyPI. Here's the quick guide:
|
|
853
|
+
|
|
854
|
+
#### 1. Setup GitHub Secret (One-Time)
|
|
855
|
+
|
|
856
|
+
**Choose one approach:**
|
|
857
|
+
|
|
858
|
+
**Option A: Repository Secret** (Simple, automatic releases)
|
|
859
|
+
1. Get PyPI token: https://pypi.org/manage/account/token/
|
|
860
|
+
2. Go to: https://github.com/jifox/vaulttool/settings/secrets/actions
|
|
861
|
+
3. Add secret: Name = `PYPI_TOKEN`, Value = your token
|
|
862
|
+
|
|
863
|
+
**Option B: Environment Secret** (More secure, requires approval)
|
|
864
|
+
1. Get PyPI token: https://pypi.org/manage/account/token/
|
|
865
|
+
2. Go to: https://github.com/jifox/vaulttool/settings/environments
|
|
866
|
+
3. Create environment: `pypi-production` with protection rules
|
|
867
|
+
4. Add secret to environment: Name = `PYPI_TOKEN`
|
|
868
|
+
5. Uncomment `environment: pypi-production` in `.github/workflows/release.yml`
|
|
869
|
+
|
|
870
|
+
#### 2. Release Process
|
|
871
|
+
|
|
872
|
+
```bash
|
|
873
|
+
# Update version
|
|
874
|
+
poetry version 2.0.1
|
|
875
|
+
|
|
876
|
+
# Update CHANGELOG.md with release notes
|
|
877
|
+
|
|
878
|
+
# Commit changes
|
|
879
|
+
git add pyproject.toml CHANGELOG.md
|
|
880
|
+
git commit -m "chore: prepare release v2.0.1"
|
|
881
|
+
git push origin main
|
|
882
|
+
|
|
883
|
+
# Create and push tag (triggers automated release)
|
|
884
|
+
git tag v2.0.1
|
|
885
|
+
git push origin v2.0.1
|
|
886
|
+
```
|
|
887
|
+
|
|
888
|
+
#### 3. Automated Steps
|
|
889
|
+
|
|
890
|
+
When you push a `v*` tag, GitHub Actions automatically:
|
|
891
|
+
|
|
892
|
+
1. ✅ Validates version matches tag
|
|
893
|
+
2. ✅ Runs all tests
|
|
894
|
+
3. ✅ Builds wheel and source distribution
|
|
895
|
+
4. ✅ Publishes to PyPI
|
|
896
|
+
5. ✅ Creates GitHub release with artifacts
|
|
897
|
+
|
|
898
|
+
#### 4. Quick Commands
|
|
899
|
+
|
|
900
|
+
```bash
|
|
901
|
+
# Patch release (2.0.0 → 2.0.1)
|
|
902
|
+
poetry version patch && git add pyproject.toml CHANGELOG.md && \
|
|
903
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
904
|
+
git tag v$(poetry version -s) && \
|
|
905
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
906
|
+
|
|
907
|
+
# Minor release (2.0.0 → 2.1.0)
|
|
908
|
+
poetry version minor && git add pyproject.toml CHANGELOG.md && \
|
|
909
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
910
|
+
git tag v$(poetry version -s) && \
|
|
911
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
912
|
+
|
|
913
|
+
# Pre-release (beta/RC)
|
|
914
|
+
poetry version 2.1.0-beta.1 && git add pyproject.toml CHANGELOG.md && \
|
|
915
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
916
|
+
git tag v$(poetry version -s) && \
|
|
917
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
#### 5. Monitor Release
|
|
921
|
+
|
|
922
|
+
- **Workflow**: https://github.com/jifox/vaulttool/actions/workflows/release.yml
|
|
923
|
+
- **Releases**: https://github.com/jifox/vaulttool/releases
|
|
924
|
+
- **PyPI**: https://pypi.org/project/vaulttool/
|
|
925
|
+
|
|
926
|
+
For detailed documentation, see [docs/PYPI_RELEASE_WORKFLOW.md](docs/PYPI_RELEASE_WORKFLOW.md)
|
|
927
|
+
|
|
750
928
|
## Python API Usage
|
|
751
929
|
|
|
752
930
|
```python
|
|
@@ -45,47 +45,69 @@ vaulttool refresh
|
|
|
45
45
|
|
|
46
46
|
## Table of Contents
|
|
47
47
|
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
48
|
+
- [Vault Tool](#vault-tool)
|
|
49
|
+
- [TL;DR](#tldr)
|
|
50
|
+
- [Table of Contents](#table-of-contents)
|
|
51
|
+
- [Features](#features)
|
|
52
|
+
- [What's New in Version 2.0.0](#whats-new-in-version-200)
|
|
53
|
+
- [Cryptographic Components](#cryptographic-components)
|
|
51
54
|
- [Vault File Format](#vault-file-format)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- [Requirements](#requirements)
|
|
61
|
-
- [Installation](#installation)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- [
|
|
65
|
-
|
|
66
|
-
- [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [
|
|
80
|
-
|
|
81
|
-
- [
|
|
82
|
-
- [
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
- [
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
55
|
+
- [Simplified Installation](#simplified-installation)
|
|
56
|
+
- [Enhanced Security \& Reliability](#enhanced-security--reliability)
|
|
57
|
+
- [Better Error Messages](#better-error-messages)
|
|
58
|
+
- [Comprehensive Logging](#comprehensive-logging)
|
|
59
|
+
- [Improved Error Handling](#improved-error-handling)
|
|
60
|
+
- [Test Coverage](#test-coverage)
|
|
61
|
+
- [What This Means For You](#what-this-means-for-you)
|
|
62
|
+
- [Upgrade Path](#upgrade-path)
|
|
63
|
+
- [Requirements](#requirements)
|
|
64
|
+
- [Installation](#installation)
|
|
65
|
+
- [Install Vault Tool (Recommended: Poetry)](#install-vault-tool-recommended-poetry)
|
|
66
|
+
- [Development/Local Installation](#developmentlocal-installation)
|
|
67
|
+
- [Running the CLI](#running-the-cli)
|
|
68
|
+
- [Generate Encryption Key](#generate-encryption-key)
|
|
69
|
+
- [Configuration](#configuration)
|
|
70
|
+
- [Environment Variable Configuration](#environment-variable-configuration)
|
|
71
|
+
- [Environment Variable Naming Pattern](#environment-variable-naming-pattern)
|
|
72
|
+
- [Data Types](#data-types)
|
|
73
|
+
- [Example: CI/CD Pipeline](#example-cicd-pipeline)
|
|
74
|
+
- [Example: Docker Container](#example-docker-container)
|
|
75
|
+
- [Validation Rules](#validation-rules)
|
|
76
|
+
- [Usage](#usage)
|
|
77
|
+
- [Generate example configuration](#generate-example-configuration)
|
|
78
|
+
- [Display version information](#display-version-information)
|
|
79
|
+
- [Generate or rotate encryption key](#generate-or-rotate-encryption-key)
|
|
80
|
+
- [Encrypt Files](#encrypt-files)
|
|
81
|
+
- [Remove all vault files](#remove-all-vault-files)
|
|
82
|
+
- [Refresh plaintext from vaults](#refresh-plaintext-from-vaults)
|
|
83
|
+
- [Ensure Plaintext Files Are Added to .gitignore](#ensure-plaintext-files-are-added-to-gitignore)
|
|
84
|
+
- [Example Workflow](#example-workflow)
|
|
85
|
+
- [Initial Setup](#initial-setup)
|
|
86
|
+
- [Daily Workflow](#daily-workflow)
|
|
87
|
+
- [Pre-commit Installation](#pre-commit-installation)
|
|
88
|
+
- [Pre-commit Integration](#pre-commit-integration)
|
|
89
|
+
- [Related Tools](#related-tools)
|
|
90
|
+
- [Contributing](#contributing)
|
|
91
|
+
- [How to Contribute](#how-to-contribute)
|
|
92
|
+
- [Development Setup](#development-setup)
|
|
93
|
+
- [Releasing to PyPI](#releasing-to-pypi)
|
|
94
|
+
- [1. Setup GitHub Secret (One-Time)](#1-setup-github-secret-one-time)
|
|
95
|
+
- [2. Release Process](#2-release-process)
|
|
96
|
+
- [3. Automated Steps](#3-automated-steps)
|
|
97
|
+
- [4. Quick Commands](#4-quick-commands)
|
|
98
|
+
- [5. Monitor Release](#5-monitor-release)
|
|
99
|
+
- [Python API Usage](#python-api-usage)
|
|
100
|
+
- [Utility Functions](#utility-functions)
|
|
101
|
+
- [Security Best Practices](#security-best-practices)
|
|
102
|
+
- [Troubleshooting](#troubleshooting)
|
|
103
|
+
- [Common Issues](#common-issues)
|
|
104
|
+
- [Key file too small](#key-file-too-small)
|
|
105
|
+
- [Permission denied](#permission-denied)
|
|
106
|
+
- [Key file missing](#key-file-missing)
|
|
107
|
+
- [Configuration not found](#configuration-not-found)
|
|
108
|
+
- [Cryptography module errors](#cryptography-module-errors)
|
|
109
|
+
- [Getting Help](#getting-help)
|
|
110
|
+
- [License](#license)
|
|
89
111
|
|
|
90
112
|
## Features
|
|
91
113
|
|
|
@@ -273,7 +295,7 @@ except OSError as e:
|
|
|
273
295
|
|
|
274
296
|
**Comprehensive Test Suite:**
|
|
275
297
|
|
|
276
|
-
- **
|
|
298
|
+
- **99 tests** covering all functionality (was 56)
|
|
277
299
|
- **15 new tests** specifically for error handling paths
|
|
278
300
|
- **100% pass rate** with 2.5s execution time
|
|
279
301
|
- **Zero regressions** - all original tests still passing
|
|
@@ -368,15 +390,52 @@ pipx install dist/vaulttool-*.whl --force
|
|
|
368
390
|
|
|
369
391
|
### Generate Encryption Key
|
|
370
392
|
|
|
371
|
-
To create a secure encryption key for your vault, you can use the
|
|
393
|
+
To create a secure encryption key for your vault, you can use the built-in command or generate one manually:
|
|
372
394
|
|
|
373
|
-
**Option 1: Using
|
|
395
|
+
**Option 1: Using VaultTool CLI (Recommended):**
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Generate new key (reads path from .vaulttool.yml)
|
|
399
|
+
vaulttool generate-key
|
|
400
|
+
|
|
401
|
+
# Generate key in custom location
|
|
402
|
+
vaulttool generate-key --key-file ~/.vaulttool/vault.key
|
|
403
|
+
|
|
404
|
+
# Replace existing key with backup
|
|
405
|
+
vaulttool generate-key --force
|
|
406
|
+
|
|
407
|
+
# Replace key AND re-encrypt all vault files
|
|
408
|
+
vaulttool generate-key --rekey --force
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The `generate-key` command provides:
|
|
412
|
+
- Automatic key generation with proper entropy (64 hex chars = 32 bytes)
|
|
413
|
+
- Automatic backup of existing keys with timestamp
|
|
414
|
+
- Optional rekey functionality to re-encrypt all vaults with new key
|
|
415
|
+
- Proper file permissions (600 - owner read/write only)
|
|
416
|
+
- Interactive prompts for safety (unless `--force` is used)
|
|
417
|
+
|
|
418
|
+
**Rekey Process:**
|
|
419
|
+
|
|
420
|
+
When using `--rekey`, the command performs these steps automatically:
|
|
421
|
+
1. Restores all plaintext files from existing vaults
|
|
422
|
+
2. Removes all old vault files
|
|
423
|
+
3. Backs up the old key with timestamp
|
|
424
|
+
4. Writes the new key
|
|
425
|
+
5. Re-encrypts all files with the new key
|
|
426
|
+
|
|
427
|
+
This is useful when:
|
|
428
|
+
- You need to rotate encryption keys for security
|
|
429
|
+
- A key may have been compromised
|
|
430
|
+
- Migrating to a new key management system
|
|
431
|
+
|
|
432
|
+
**Option 2: Using the provided script:**
|
|
374
433
|
|
|
375
434
|
```bash
|
|
376
435
|
./vaulttool-generate-key.sh
|
|
377
436
|
```
|
|
378
437
|
|
|
379
|
-
**Option
|
|
438
|
+
**Option 3: Manual generation using Python:**
|
|
380
439
|
|
|
381
440
|
```bash
|
|
382
441
|
# Create vaulttool directory in home
|
|
@@ -389,7 +448,7 @@ python3 -c "import secrets; print(secrets.token_hex(32))" > "$HOME/.vaulttool/va
|
|
|
389
448
|
chmod 600 "$HOME/.vaulttool/vault.key"
|
|
390
449
|
```
|
|
391
450
|
|
|
392
|
-
**Option
|
|
451
|
+
**Option 4: Manual generation using OpenSSL (if available):**
|
|
393
452
|
|
|
394
453
|
```bash
|
|
395
454
|
mkdir -p "$HOME/.vaulttool"
|
|
@@ -572,6 +631,46 @@ vaulttool gen-vaulttool > .vaulttool.yml
|
|
|
572
631
|
vaulttool version
|
|
573
632
|
```
|
|
574
633
|
|
|
634
|
+
### Generate or rotate encryption key
|
|
635
|
+
|
|
636
|
+
Generate a new encryption key or rotate an existing one:
|
|
637
|
+
|
|
638
|
+
```bash
|
|
639
|
+
vaulttool generate-key [OPTIONS]
|
|
640
|
+
|
|
641
|
+
OPTIONS:
|
|
642
|
+
--key-file -k Path to key file (default: from .vaulttool.yml config)
|
|
643
|
+
--rekey Re-encrypt all vault files with the new key
|
|
644
|
+
--force Skip confirmation prompts (use with caution)
|
|
645
|
+
--verbose -v Enable verbose debug logging
|
|
646
|
+
--quiet -q Show only errors (suppress info/warning)
|
|
647
|
+
--help Show this message and exit.
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
Examples:
|
|
651
|
+
|
|
652
|
+
```bash
|
|
653
|
+
# Generate new key using path from config
|
|
654
|
+
vaulttool generate-key
|
|
655
|
+
|
|
656
|
+
# Generate key in specific location
|
|
657
|
+
vaulttool generate-key --key-file ~/.vaulttool/vault.key
|
|
658
|
+
|
|
659
|
+
# Replace existing key (with backup)
|
|
660
|
+
vaulttool generate-key --force
|
|
661
|
+
|
|
662
|
+
# Rotate key and re-encrypt all vaults
|
|
663
|
+
vaulttool generate-key --rekey --force
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
The command will:
|
|
667
|
+
- Create a new key if none exists
|
|
668
|
+
- Backup existing key with timestamp before replacing
|
|
669
|
+
- Optionally re-encrypt all vault files with new key (`--rekey`)
|
|
670
|
+
- Set proper file permissions (600)
|
|
671
|
+
|
|
672
|
+
**Important:** Always test decryption after rekeying before deleting backup keys!
|
|
673
|
+
|
|
575
674
|
### Encrypt Files
|
|
576
675
|
|
|
577
676
|
To encrypt your sensitive files, navigate to your project directory and run:
|
|
@@ -727,6 +826,84 @@ pip install -e .[dev]
|
|
|
727
826
|
pre-commit install
|
|
728
827
|
```
|
|
729
828
|
|
|
829
|
+
### Releasing to PyPI
|
|
830
|
+
|
|
831
|
+
VaultTool uses automated GitHub Actions to publish releases to PyPI. Here's the quick guide:
|
|
832
|
+
|
|
833
|
+
#### 1. Setup GitHub Secret (One-Time)
|
|
834
|
+
|
|
835
|
+
**Choose one approach:**
|
|
836
|
+
|
|
837
|
+
**Option A: Repository Secret** (Simple, automatic releases)
|
|
838
|
+
1. Get PyPI token: https://pypi.org/manage/account/token/
|
|
839
|
+
2. Go to: https://github.com/jifox/vaulttool/settings/secrets/actions
|
|
840
|
+
3. Add secret: Name = `PYPI_TOKEN`, Value = your token
|
|
841
|
+
|
|
842
|
+
**Option B: Environment Secret** (More secure, requires approval)
|
|
843
|
+
1. Get PyPI token: https://pypi.org/manage/account/token/
|
|
844
|
+
2. Go to: https://github.com/jifox/vaulttool/settings/environments
|
|
845
|
+
3. Create environment: `pypi-production` with protection rules
|
|
846
|
+
4. Add secret to environment: Name = `PYPI_TOKEN`
|
|
847
|
+
5. Uncomment `environment: pypi-production` in `.github/workflows/release.yml`
|
|
848
|
+
|
|
849
|
+
#### 2. Release Process
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
# Update version
|
|
853
|
+
poetry version 2.0.1
|
|
854
|
+
|
|
855
|
+
# Update CHANGELOG.md with release notes
|
|
856
|
+
|
|
857
|
+
# Commit changes
|
|
858
|
+
git add pyproject.toml CHANGELOG.md
|
|
859
|
+
git commit -m "chore: prepare release v2.0.1"
|
|
860
|
+
git push origin main
|
|
861
|
+
|
|
862
|
+
# Create and push tag (triggers automated release)
|
|
863
|
+
git tag v2.0.1
|
|
864
|
+
git push origin v2.0.1
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
#### 3. Automated Steps
|
|
868
|
+
|
|
869
|
+
When you push a `v*` tag, GitHub Actions automatically:
|
|
870
|
+
|
|
871
|
+
1. ✅ Validates version matches tag
|
|
872
|
+
2. ✅ Runs all tests
|
|
873
|
+
3. ✅ Builds wheel and source distribution
|
|
874
|
+
4. ✅ Publishes to PyPI
|
|
875
|
+
5. ✅ Creates GitHub release with artifacts
|
|
876
|
+
|
|
877
|
+
#### 4. Quick Commands
|
|
878
|
+
|
|
879
|
+
```bash
|
|
880
|
+
# Patch release (2.0.0 → 2.0.1)
|
|
881
|
+
poetry version patch && git add pyproject.toml CHANGELOG.md && \
|
|
882
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
883
|
+
git tag v$(poetry version -s) && \
|
|
884
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
885
|
+
|
|
886
|
+
# Minor release (2.0.0 → 2.1.0)
|
|
887
|
+
poetry version minor && git add pyproject.toml CHANGELOG.md && \
|
|
888
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
889
|
+
git tag v$(poetry version -s) && \
|
|
890
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
891
|
+
|
|
892
|
+
# Pre-release (beta/RC)
|
|
893
|
+
poetry version 2.1.0-beta.1 && git add pyproject.toml CHANGELOG.md && \
|
|
894
|
+
git commit -m "chore: release v$(poetry version -s)" && \
|
|
895
|
+
git tag v$(poetry version -s) && \
|
|
896
|
+
git push origin main && git push origin v$(poetry version -s)
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
#### 5. Monitor Release
|
|
900
|
+
|
|
901
|
+
- **Workflow**: https://github.com/jifox/vaulttool/actions/workflows/release.yml
|
|
902
|
+
- **Releases**: https://github.com/jifox/vaulttool/releases
|
|
903
|
+
- **PyPI**: https://pypi.org/project/vaulttool/
|
|
904
|
+
|
|
905
|
+
For detailed documentation, see [docs/PYPI_RELEASE_WORKFLOW.md](docs/PYPI_RELEASE_WORKFLOW.md)
|
|
906
|
+
|
|
730
907
|
## Python API Usage
|
|
731
908
|
|
|
732
909
|
```python
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "vaulttool"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.2"
|
|
4
4
|
description = "Secure file encryption for secrets/configs"
|
|
5
|
-
authors = ["Josef Fuchs"]
|
|
6
|
-
license = {
|
|
5
|
+
authors = [{name = "Josef Fuchs"}]
|
|
6
|
+
license = {text = "Apache-2"}
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python = ">=3.10"
|
|
9
9
|
dependencies = [
|
|
@@ -18,7 +18,7 @@ vaulttool = "vaulttool.cli:app"
|
|
|
18
18
|
|
|
19
19
|
[tool.poetry]
|
|
20
20
|
name = "vaulttool"
|
|
21
|
-
version = "2.0.
|
|
21
|
+
version = "2.0.2"
|
|
22
22
|
description = "Secure file encryption for secrets/configs"
|
|
23
23
|
authors = ["Josef Fuchs"]
|
|
24
24
|
license = "Apache-2"
|