Skip to content

Commit 8ddc8dc

Browse files
committed
docs: add comprehensive documentation for secure credential storage
- Add security best practices reference page covering all storage methods - Update authentication docs with keyring storage option - Update installation docs to mention secure-storage feature - Update profiles documentation with detailed keyring usage - Add security page to documentation index Completes documentation for #180
1 parent d95dff0 commit 8ddc8dc

File tree

5 files changed

+510
-14
lines changed

5 files changed

+510
-14
lines changed

docs/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878

7979
- [Environment Variables](./reference/environment-variables.md)
8080
- [Configuration File](./reference/config-file.md)
81+
- [Security Best Practices](./reference/security.md)
8182
- [Troubleshooting](./reference/troubleshooting.md)
8283
- [Best Practices](./reference/best-practices.md)
8384
- [API Reference](./reference/api.md)

docs/src/features/profiles.md

Lines changed: 132 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,29 +215,150 @@ jobs:
215215
--data @database.json --wait
216216
```
217217
218+
## Secure Credential Storage
219+
220+
### Using OS Keyring (Recommended)
221+
222+
When compiled with the `secure-storage` feature, redisctl can store credentials in your operating system's secure keyring instead of plaintext in the config file.
223+
224+
#### Supported Platforms
225+
- **macOS**: Keychain
226+
- **Windows**: Windows Credential Store
227+
- **Linux**: Secret Service (GNOME Keyring, KWallet)
228+
229+
#### Installation with Secure Storage
230+
```bash
231+
# Install from source with secure storage
232+
cargo install redisctl --features secure-storage
233+
234+
# Or build locally
235+
cargo build --release --features secure-storage
236+
```
237+
238+
#### Creating Secure Profiles
239+
```bash
240+
# Create profile with keyring storage
241+
redisctl profile set prod-secure \
242+
--deployment cloud \
243+
--api-key "your-api-key" \
244+
--api-secret "your-api-secret" \
245+
--use-keyring # Store in OS keyring
246+
247+
# For Enterprise profiles
248+
redisctl profile set enterprise-secure \
249+
--deployment enterprise \
250+
--url "https://cluster.example.com:9443" \
251+
--username "[email protected]" \
252+
--password "your-password" \
253+
--use-keyring
254+
```
255+
256+
#### How It Works
257+
When using `--use-keyring`, credentials are:
258+
1. Stored securely in your OS keyring
259+
2. Referenced in config.toml with `keyring:` prefix
260+
3. Retrieved automatically when needed
261+
262+
Example config.toml with keyring references:
263+
```toml
264+
[profiles.prod-secure]
265+
deployment_type = "cloud"
266+
api_key = "keyring:prod-secure-api-key" # Stored in keyring
267+
api_secret = "keyring:prod-secure-api-secret" # Stored in keyring
268+
api_url = "https://api.redislabs.com/v1" # Non-sensitive, plaintext
269+
```
270+
271+
#### Storage Priority
272+
Credentials are resolved in this order:
273+
1. **Environment variables** (highest priority)
274+
2. **OS keyring** (if value starts with `keyring:`)
275+
3. **Plaintext** in config file (fallback)
276+
277+
#### Managing Keyring Credentials
278+
```bash
279+
# Update credentials (will update keyring if already using it)
280+
redisctl profile set prod-secure \
281+
--api-key "new-key" \
282+
--use-keyring
283+
284+
# View profile (keyring values are masked)
285+
redisctl profile show prod-secure
286+
# Output:
287+
# Profile: prod-secure
288+
# Type: cloud
289+
# API Key: keyring:...
290+
# API URL: https://api.redislabs.com/v1
291+
```
292+
218293
## Security Best Practices
219294

220-
### Protecting Credentials
295+
### Credential Storage Options
296+
297+
Choose the appropriate storage method based on your security requirements:
298+
299+
1. **OS Keyring (Most Secure)**
300+
- Use `--use-keyring` when creating profiles
301+
- Credentials encrypted by OS
302+
- Requires `secure-storage` feature
303+
```bash
304+
redisctl profile set prod --use-keyring ...
305+
```
306+
307+
2. **Environment Variables (CI/CD Friendly)**
308+
- No storage, runtime only
309+
- Good for automation
310+
```bash
311+
export REDIS_CLOUD_API_KEY="key"
312+
export REDIS_CLOUD_API_SECRET="secret"
313+
```
221314

222-
1. **Never commit credentials**: Keep config.toml in .gitignore
223-
2. **Use environment variables**: Store secrets in environment
224-
3. **Restrict file permissions**:
315+
3. **Plaintext Config (Development Only)**
316+
- Simple but insecure
317+
- Only for development/testing
318+
- Protect with file permissions:
225319
```bash
226320
chmod 600 ~/.config/redisctl/config.toml
227321
```
228-
4. **Rotate credentials regularly**: Update API keys periodically
229322

230-
### Secure Profile Template
323+
### Security Checklist
324+
325+
1. **Never commit credentials**: Add config.toml to .gitignore
326+
2. **Use keyring for production**: Store production credentials securely
327+
3. **Rotate credentials regularly**: Update API keys periodically
328+
4. **Audit profile usage**: Monitor credential access
329+
5. **Use environment variables in CI/CD**: Keep secrets out of config files
330+
331+
### Secure Profile Templates
332+
333+
#### Production with Keyring
334+
```bash
335+
# Create secure production profile
336+
redisctl profile set production \
337+
--deployment cloud \
338+
--api-key "$PROD_KEY" \
339+
--api-secret "$PROD_SECRET" \
340+
--use-keyring
341+
```
342+
343+
#### CI/CD with Environment Variables
231344
```toml
232-
# Use environment variables for sensitive data
233-
[profiles.secure]
345+
# config.toml for CI/CD
346+
[profiles.ci]
234347
deployment_type = "cloud"
235348
api_key = "${REDIS_CLOUD_API_KEY}"
236349
api_secret = "${REDIS_CLOUD_API_SECRET}"
350+
api_url = "${REDIS_API_URL:-https://api.redislabs.com/v1}"
351+
```
237352

238-
# Store in secure vault
239-
# export REDIS_CLOUD_API_KEY=$(vault read -field=key secret/redis)
240-
# export REDIS_CLOUD_API_SECRET=$(vault read -field=secret secret/redis)
353+
#### Development with Mixed Storage
354+
```toml
355+
# Development profile with mixed storage
356+
[profiles.dev]
357+
deployment_type = "enterprise"
358+
url = "https://dev-cluster:9443" # Non-sensitive
359+
username = "[email protected]" # Non-sensitive
360+
password = "keyring:dev-password" # Sensitive, in keyring
361+
insecure = true # Dev setting
241362
```
242363

243364
### Profile Audit

docs/src/getting-started/authentication.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,36 @@ Redis Cloud uses API key authentication:
1717

1818
### Setting Up Authentication
1919

20-
Use environment variables:
20+
#### Option 1: Secure OS Keyring (Recommended)
21+
22+
When compiled with the `secure-storage` feature, store credentials securely in your OS keyring:
23+
24+
```bash
25+
# Install with secure storage support
26+
cargo install redisctl --features secure-storage
27+
28+
# Create secure profile
29+
redisctl profile set cloud \
30+
--deployment cloud \
31+
--api-key "your-account-key" \
32+
--api-secret "your-secret-key" \
33+
--use-keyring # Stores in OS keyring
34+
35+
# Test it works
36+
redisctl --profile cloud api cloud get /
37+
```
38+
39+
Your config will contain secure references:
40+
```toml
41+
[profiles.cloud]
42+
deployment_type = "cloud"
43+
api_key = "keyring:cloud-api-key" # Actual value in OS keyring
44+
api_secret = "keyring:cloud-api-secret" # Actual value in OS keyring
45+
```
46+
47+
#### Option 2: Environment Variables
48+
49+
Use environment variables (good for CI/CD):
2150

2251
```bash
2352
export REDIS_CLOUD_API_KEY="your-account-key"
@@ -27,7 +56,9 @@ export REDIS_CLOUD_API_SECRET="your-secret-key"
2756
redisctl api cloud get /
2857
```
2958

30-
Or create a configuration file at `~/.config/redisctl/config.toml`:
59+
#### Option 3: Configuration File (Development Only)
60+
61+
For development only, you can use plaintext config at `~/.config/redisctl/config.toml`:
3162

3263
```toml
3364
[profiles.cloud]
@@ -36,6 +67,8 @@ api_key = "your-account-key"
3667
api_secret = "your-secret-key"
3768
```
3869

70+
⚠️ **Warning**: This stores credentials in plaintext. Use keyring or environment variables for production!
71+
3972
## Redis Enterprise
4073

4174
Redis Enterprise uses basic authentication with username/password.
@@ -47,6 +80,38 @@ Redis Enterprise uses basic authentication with username/password.
4780

4881
### Setting Up Authentication
4982

83+
#### Option 1: Secure OS Keyring (Recommended)
84+
85+
Store credentials securely in your OS keyring:
86+
87+
```bash
88+
# Create secure profile
89+
redisctl profile set enterprise \
90+
--deployment enterprise \
91+
--url "https://cluster.example.com:9443" \
92+
--username "[email protected]" \
93+
--password "your-password" \
94+
--use-keyring # Stores in OS keyring
95+
96+
# For self-signed certificates
97+
redisctl profile set enterprise --insecure true
98+
99+
# Test it works
100+
redisctl --profile enterprise api enterprise get /v1/cluster
101+
```
102+
103+
Your config will contain secure references:
104+
```toml
105+
[profiles.enterprise]
106+
deployment_type = "enterprise"
107+
url = "https://cluster.example.com:9443"
108+
username = "keyring:enterprise-username" # Actual value in OS keyring
109+
password = "keyring:enterprise-password" # Actual value in OS keyring
110+
insecure = false
111+
```
112+
113+
#### Option 2: Environment Variables
114+
50115
Use environment variables:
51116

52117
```bash
@@ -61,7 +126,9 @@ export REDIS_ENTERPRISE_INSECURE="true"
61126
redisctl api enterprise get /v1/cluster
62127
```
63128

64-
Or add to `~/.config/redisctl/config.toml`:
129+
#### Option 3: Configuration File (Development Only)
130+
131+
For development only, add to `~/.config/redisctl/config.toml`:
65132

66133
```toml
67134
[profiles.enterprise]
@@ -72,6 +139,8 @@ password = "your-password"
72139
insecure = true # For self-signed certs
73140
```
74141

142+
⚠️ **Warning**: This stores credentials in plaintext. Use keyring or environment variables for production!
143+
75144
## Security Tips
76145

77146
1. **Never commit credentials** - Use environment variables or secure vaults

docs/src/getting-started/installation.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,35 @@ Download the `.zip` file from the releases page and extract to a directory in yo
2424
If you have Rust installed:
2525

2626
```bash
27+
# Basic installation
2728
cargo install redisctl
29+
30+
# With secure credential storage support (recommended)
31+
cargo install redisctl --features secure-storage
2832
```
2933

34+
### Feature Flags
35+
36+
| Feature | Description |
37+
|---------|-------------|
38+
| `secure-storage` | Enables OS keyring support for secure credential storage (recommended) |
39+
| `cloud-only` | Builds only Cloud functionality (smaller binary) |
40+
| `enterprise-only` | Builds only Enterprise functionality (smaller binary) |
41+
3042
## From Source
3143

3244
```bash
3345
git clone https://github.com/joshrotenberg/redisctl.git
3446
cd redisctl
47+
48+
# Basic installation
3549
cargo install --path crates/redisctl
50+
51+
# With secure storage support (recommended)
52+
cargo install --path crates/redisctl --features secure-storage
53+
54+
# Development build with all features
55+
cargo build --release --all-features
3656
```
3757

3858
## Docker

0 commit comments

Comments
 (0)