Skip to main content

Configuration Reference

Complete reference for secretctl configuration options, environment variables, and file structure.

Environment Variables​

Vault Configuration​

VariableDescriptionDefault
SECRETCTL_VAULT_DIRDirectory containing the vault files~/.secretctl
SECRETCTL_PASSWORDMaster password for vault operations(none)

Usage Examples:

# Use a custom vault directory
export SECRETCTL_VAULT_DIR=/path/to/custom/vault
secretctl list

# Provide password via environment variable (non-interactive)
SECRETCTL_PASSWORD=mypassword secretctl get API_KEY

# MCP server uses SECRETCTL_PASSWORD for authentication
SECRETCTL_PASSWORD=mypassword secretctl mcp-server

Security Notes​

  • SECRETCTL_PASSWORD is automatically cleared from the environment after reading
  • Avoid setting SECRETCTL_PASSWORD in shell profiles or persistent environment
  • For MCP server, use process-level environment variables in your MCP client configuration

File Structure​

Vault Directory​

The default vault directory is ~/.secretctl. The structure is:

~/.secretctl/
├── vault.salt # Cryptographic salt (16 bytes)
├── vault.meta # Vault metadata (encrypted)
├── vault.db # SQLite database (encrypted)
├── vault.lock # Lock file for concurrent access
├── audit/ # Audit logs directory
│ └── *.jsonl # JSON Lines audit log files
└── mcp-policy.yaml # MCP server policy (optional)

File Permissions​

All files are created with secure permissions:

File/DirectoryPermissionsDescription
~/.secretctl/0700Directory accessible only by owner
vault.salt0600Salt file (owner read/write only)
vault.meta0600Metadata file (owner read/write only)
vault.db0600Database file (owner read/write only)
mcp-policy.yaml0600Policy file (required for MCP server)
audit/0700Audit logs directory

Important: The MCP policy file must have 0600 permissions and be owned by the current user. Symlinks are not allowed for security reasons.


MCP Policy Configuration​

Create ~/.secretctl/mcp-policy.yaml to configure the MCP server:

version: 1
default_action: deny

# Commands that are always blocked (hardcoded)
# - env, printenv, set, export, cat /proc/*/environ

# User-defined denied commands (checked first)
denied_commands:
- rm
- mv
- sudo

# Allowed commands (checked second)
allowed_commands:
- aws
- gcloud
- kubectl
- curl
- wget
- ./deploy.sh

# Environment aliases for key transformation
env_aliases:
dev:
- pattern: "db/*"
target: "dev/db/*"
- pattern: "api/*"
target: "dev/api/*"
staging:
- pattern: "db/*"
target: "staging/db/*"
- pattern: "api/*"
target: "staging/api/*"
prod:
- pattern: "db/*"
target: "prod/db/*"
- pattern: "api/*"
target: "prod/api/*"

Policy Fields​

FieldTypeRequiredDescription
versionintegerYesPolicy version (must be 1)
default_actionstringNoDefault action: allow or deny (default: deny)
denied_commandsstring[]NoCommands to always block
allowed_commandsstring[]NoCommands to allow
env_aliasesmapNoEnvironment alias mappings

Policy Evaluation Order​

  1. Hardcoded denies: env, printenv, set, export, cat /proc/*/environ
  2. User denied_commands: Explicitly blocked commands
  3. User allowed_commands: Explicitly allowed commands
  4. default_action: Fallback (default: deny)

Environment Aliases​

Environment aliases allow different secret key mappings per environment:

env_aliases:
dev:
- pattern: "db/*" # Match keys like db/host, db/password
target: "dev/db/*" # Transform to dev/db/host, dev/db/password
prod:
- pattern: "db/*"
target: "prod/db/*"

Usage:

# CLI: Use --env flag
secretctl run --env=prod -k "db/*" -- ./deploy.sh

# MCP: Use env parameter
{
"keys": ["db/*"],
"command": "./deploy.sh",
"env": "prod"
}

Validation Limits​

Master Password​

ConstraintValue
Minimum length8 characters
Maximum length128 characters

Secret Keys​

ConstraintValue
Minimum length1 character
Maximum length256 characters
Allowed charactersAlphanumeric, -, _, /, .

Secret Values​

ConstraintValue
Maximum size1 MB (1,048,576 bytes)

Metadata​

ConstraintValue
Maximum notes size10 KB (10,240 bytes)
Maximum URL length2,048 characters
Maximum tag count10 tags
Maximum tag length64 characters

Unlock Cooldown​

To protect against brute-force attacks, secretctl implements progressive cooldowns after failed unlock attempts:

Failed AttemptsCooldown Duration
530 seconds
105 minutes
2030 minutes

The cooldown counter resets after a successful unlock.


Disk Space Requirements​

secretctl monitors available disk space:

ThresholdAction
< 10 MB freeVault operations blocked
> 90% usedWarning displayed
< 1 MB freeAudit logging blocked

Cryptographic Parameters​

Key Derivation (Argon2id)​

ParameterValue
AlgorithmArgon2id
Memory64 MB
Iterations3
Parallelism4 threads
Salt length16 bytes (128-bit)
Output length32 bytes (256-bit)

These parameters follow OWASP recommendations for high-security applications.

Encryption (AES-256-GCM)​

ParameterValue
AlgorithmAES-256-GCM
Key length256 bits
Nonce length12 bytes (96-bit)
Tag length16 bytes (128-bit)

HMAC (Audit Chain)​

ParameterValue
AlgorithmHMAC-SHA256
Key derivationHKDF-SHA256
Chain validationSequential verification

Shell Completion​

Install shell completion for enhanced CLI experience:

Bash​

secretctl completion bash > /etc/bash_completion.d/secretctl
# or for user-level installation
secretctl completion bash > ~/.local/share/bash-completion/completions/secretctl

Zsh​

secretctl completion zsh > "${fpath[1]}/_secretctl"
# or specify a custom directory
secretctl completion zsh > ~/.zsh/completions/_secretctl

Fish​

secretctl completion fish > ~/.config/fish/completions/secretctl.fish

PowerShell​

secretctl completion powershell | Out-String | Invoke-Expression
# or save to profile
secretctl completion powershell >> $PROFILE

Claude Code Integration​

Configure secretctl MCP server in ~/.claude.json:

{
"mcpServers": {
"secretctl": {
"command": "/path/to/secretctl",
"args": ["mcp-server"],
"env": {
"SECRETCTL_PASSWORD": "your-master-password"
}
}
}
}

Security Considerations:

  • Store SECRETCTL_PASSWORD securely (consider using a keychain or secret manager)
  • The MCP server only exposes metadata and masked values to AI agents
  • Configure mcp-policy.yaml to restrict which commands can be executed

See MCP Integration Guide for detailed setup instructions.