Documentation
¶
Overview ¶
Package vault stores secrets (passwords, key passphrases, tokens) encrypted with AES-256-GCM, each bound to its name. The key is derived with scrypt from $KOMANDO_VAULT_PASS when set (N=2^17, r=8, p=1: the OWASP minimum), otherwise from a random 32-byte key file (vault.key, mode 0600).
Index ¶
Constants ¶
const MinPassphrase = 15
MinPassphrase is the shortest passphrase doctor accepts without a warning.
Variables ¶
var ErrNotFound = errors.New("secret not found")
var PassphraseN = 1 << 17
PassphraseN is the scrypt cost for passphrase vaults (OWASP Password Storage Cheat Sheet: N=2^17, r=8, p=1). Tests lower it.
var Refs = []string{
"secret:NAME (komando's vault)",
"env:VAR",
"file:PATH",
"op://VAULT/ITEM/FIELD (1Password Connect)",
"bw://ITEM/FIELD (Bitwarden, Vaultwarden)",
"kdbx:FILE#GROUP/ENTRY[#FIELD] (KeePass, KeePassXC)",
"vault:PATH#FIELD (HashiCorp Vault or OpenBao, KV)",
"aws-sm:NAME[#JSON_KEY] (AWS Secrets Manager)",
"gcp-sm:NAME[@PROJECT] (Google Secret Manager)",
}
Refs are the kinds of secret reference komando understands, with an example each, for help texts and errors.
Functions ¶
func Passphrase ¶ added in v0.2.0
func Passphrase() string
Passphrase returns $KOMANDO_VAULT_PASS and removes it from this process's environment, so programs komando starts (kubectl, credential plugins, VPN clients, docker) never inherit it.
func Resolve ¶
Resolve turns a reference into a value:
secret:<name> -> komando's vault env:<VAR> -> environment variable file:<path> -> file contents (trailing newline trimmed) op://v/item/field -> 1Password Connect (OP_CONNECT_HOST, OP_CONNECT_TOKEN); the op CLI until it is removed bw://item/field -> Bitwarden or Vaultwarden, decrypted here (KOMANDO_BW_*) kdbx:file#group/entry[#field] -> a KeePass file (KOMANDO_KDBX_PASSWORD / KOMANDO_KDBX_KEYFILE) vault:path#field -> HashiCorp Vault / OpenBao KV (VAULT_ADDR and a token, as the CLI uses them) aws-sm:name[#key] -> AWS Secrets Manager (the usual AWS credentials; a JSON key when given) gcp-sm:name[@project]-> Google Secret Manager, latest version (application-default credentials)
komando talks to those services itself (internal/cloud); the login stays with the person and komando never stores the values.
Types ¶
type Strength ¶ added in v0.2.0
type Strength struct {
Mode string `json:"mode"`
ScryptN int `json:"scrypt_n"`
ShortPass bool `json:"short_passphrase,omitempty"`
OldKDF bool `json:"old_kdf,omitempty"`
NoVaultYet bool `json:"no_vault_yet,omitempty"`
}
Strength describes the vault's protection for `komando doctor`: the mode, the scrypt cost and, for a passphrase, whether it is long enough (NIST SP 800-63B asks for 15 characters when it is the only factor).