|
5 | 5 | [](LICENSE) |
6 | 6 | [](https://github.com/eznix86/kseal/actions/workflows/test.yml) |
7 | 7 |
|
8 | | -A kubeseal companion CLI for viewing, exporting, and encrypting Kubernetes Secrets. |
| 8 | +A kubeseal companion CLI for viewing, exporting, encrypting, and **offline decrypting** Kubernetes Secrets. |
9 | 9 |
|
10 | 10 | ## Installation |
11 | 11 |
|
@@ -33,20 +33,25 @@ pip install kseal |
33 | 33 | ### Requirements |
34 | 34 |
|
35 | 35 | - Python 3.12+ |
36 | | -- Kubernetes cluster access |
| 36 | +- Kubernetes cluster access (not required for offline decryption) |
37 | 37 | - Sealed Secrets controller installed in cluster |
38 | 38 |
|
39 | 39 | ## Quick Start |
40 | 40 |
|
41 | 41 | ```bash |
42 | | -# View a decrypted secret |
| 42 | +# View a decrypted secret (requires cluster access) |
43 | 43 | kseal cat secrets/app.yaml |
44 | 44 |
|
45 | 45 | # Export all secrets to files |
46 | 46 | kseal export --all |
47 | 47 |
|
48 | 48 | # Encrypt a plaintext secret |
49 | 49 | kseal encrypt secret.yaml -o sealed.yaml |
| 50 | + |
| 51 | +# Offline decryption (no cluster access needed) |
| 52 | +kseal export-keys # Backup keys while you have access |
| 53 | +kseal decrypt sealed.yaml # Decrypt using local keys |
| 54 | +kseal decrypt-all --in-place # Decrypt all SealedSecrets |
50 | 55 | ``` |
51 | 56 |
|
52 | 57 | ## Commands |
@@ -89,8 +94,59 @@ kseal encrypt secret.yaml |
89 | 94 | # To file |
90 | 95 | kseal encrypt secret.yaml -o sealed.yaml |
91 | 96 |
|
92 | | -# Replace original |
93 | | -kseal encrypt secret.yaml --replace |
| 97 | +# Replace original file |
| 98 | +kseal encrypt secret.yaml --in-place |
| 99 | +``` |
| 100 | + |
| 101 | +### `kseal export-keys` |
| 102 | + |
| 103 | +Export sealed-secrets private keys from cluster for offline decryption. |
| 104 | + |
| 105 | +```bash |
| 106 | +# Export to default location |
| 107 | +kseal export-keys # → .kseal-keys/ |
| 108 | + |
| 109 | +# Custom output directory |
| 110 | +kseal export-keys -o ./backup |
| 111 | + |
| 112 | +# From different namespace |
| 113 | +kseal export-keys -n kube-system |
| 114 | +``` |
| 115 | + |
| 116 | +### `kseal decrypt` |
| 117 | + |
| 118 | +Decrypt a SealedSecret using local private keys (no cluster access needed). |
| 119 | + |
| 120 | +```bash |
| 121 | +# Using keys from default location |
| 122 | +kseal decrypt sealed.yaml |
| 123 | + |
| 124 | +# Using specific key file |
| 125 | +kseal decrypt sealed.yaml --private-key ./key.pem |
| 126 | + |
| 127 | +# From stdin |
| 128 | +cat sealed.yaml | kseal decrypt |
| 129 | + |
| 130 | +# Filter keys by pattern |
| 131 | +kseal decrypt sealed.yaml --private-keys-regex "2025" |
| 132 | +``` |
| 133 | + |
| 134 | +### `kseal decrypt-all` |
| 135 | + |
| 136 | +Decrypt all SealedSecrets in a directory using local private keys. |
| 137 | + |
| 138 | +```bash |
| 139 | +# Search current directory, output to stdout |
| 140 | +kseal decrypt-all |
| 141 | + |
| 142 | +# Search specific directory |
| 143 | +kseal decrypt-all ./manifests |
| 144 | + |
| 145 | +# Replace files in-place |
| 146 | +kseal decrypt-all --in-place |
| 147 | + |
| 148 | +# Custom keys location |
| 149 | +kseal decrypt-all --private-keys-path ./backup |
94 | 150 | ``` |
95 | 151 |
|
96 | 152 | ### `kseal init` |
@@ -160,9 +216,10 @@ kseal automatically manages kubeseal binary versions: |
160 | 216 |
|
161 | 217 | ## Security |
162 | 218 |
|
163 | | -- Add `.unsealed/` to your `.gitignore` |
164 | | -- Never commit plaintext secrets to version control |
165 | | -- Requires cluster access to decrypt secrets |
| 219 | +- Add `.unsealed/` and `.kseal-keys/` to your `.gitignore` |
| 220 | +- Never commit plaintext secrets or private keys to version control |
| 221 | +- Store exported keys securely (e.g., password manager, encrypted backup) |
| 222 | +- Offline decryption with `kseal decrypt` requires the private keys - keep them safe |
166 | 223 |
|
167 | 224 | ## Contributing |
168 | 225 |
|
|
0 commit comments