cloud

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0 Imports: 48 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cloud holds komando's own clients for cloud and secret-manager APIs, so no vendor CLI (aws, gcloud, vault) has to be installed (docs/design/built-in.md). Logins stay with the person: komando reads the credentials they already have and never stores them.

Index

Constants

This section is empty.

Variables

View Source
var ErrAWSLogin = errors.New("AWS login required")

ErrAWSLogin is wrapped by errors that a person fixes by logging in again (an expired or missing SSO session).

View Source
var ErrGCPLogin = errors.New("google cloud credentials required")

ErrGCPLogin is wrapped by errors that credentials fix.

View Source
var ErrNoConnect = errors.New("1Password Connect is not set up (OP_CONNECT_HOST and OP_CONNECT_TOKEN)")

ErrNoConnect: op:// needs a 1Password Connect server (OP_CONNECT_HOST).

Functions

func AWSConfig

func AWSConfig(ctx context.Context, profile, region string) (aws.Config, error)

AWSConfig is the SDK configuration for a profile: "" or "default" is the usual chain (environment, ~/.aws/config and credentials, SSO, roles, instance metadata). region overrides the profile's region when set.

func AWSCredentials

func AWSCredentials(ctx context.Context, profile string) (aws.Credentials, error)

AWSCredentials are the profile's current keys.

func AWSProfileAccess added in v0.3.0

func AWSProfileAccess(ctx context.Context, profile, configFile, credsFile string) (aws.Credentials, string, string, error)

AWSProfileAccess is what a profile in the given config and credentials files gives: its current keys, region and custom endpoint ("" for AWS).

func AWSProfileMissing

func AWSProfileMissing(err error) bool

AWSProfileMissing reports whether err says the profile is not in ~/.aws/config or ~/.aws/credentials.

func AWSSSOLogin

func AWSSSOLogin(ctx context.Context, profile string, show func(url, code string)) (string, error)

AWSSSOLogin logs a person in to the IAM Identity Center (SSO) of a profile, the way `aws sso login` does: the device-code flow. show gets the page and the code to confirm there. The token is written to the same cache file the aws CLI uses (~/.aws/sso/cache), so the SDK, the aws CLI and komando share the login.

func AWSSecret

func AWSSecret(ctx context.Context, id string) (string, error)

AWSSecret reads a Secrets Manager secret (name or ARN) as text.

func Bitwarden

func Bitwarden(ctx context.Context, ref string) (string, error)

Bitwarden reads bw://ITEM/FIELD. FIELD is password, username, notes, uri, totp, or the name of a custom field. ITEM is the item's name or id.

func BitwardenDecrypt

func BitwardenDecrypt(s string, key []byte) ([]byte, error)

BitwardenDecrypt opens a type 2 cipher string "2.IV|DATA|MAC" (AES-256-CBC with HMAC-SHA256, encrypt-then-MAC). key is 64 bytes.

func BitwardenEncrypt

func BitwardenEncrypt(plain, key []byte) (string, error)

BitwardenEncrypt makes a type 2 cipher string (used by tests and the e2e seeding; komando itself only reads).

func BitwardenMasterKey

func BitwardenMasterKey(password, email string, kdf, iterations, memoryMiB, parallelism int) ([]byte, error)

BitwardenMasterKey derives the 32-byte master key: kdf 0 is PBKDF2-SHA256 (salt: the e-mail in lower case), kdf 1 Argon2id (salt: its SHA-256; memory in MiB).

func BitwardenPasswordHash

func BitwardenPasswordHash(master []byte, password string) string

BitwardenPasswordHash is what the server checks at login: one more PBKDF2 round of the master key with the password as salt.

func BitwardenStretch

func BitwardenStretch(master []byte) []byte

BitwardenStretch expands the master key into an encryption and a MAC key (64 bytes: enc then mac), with HKDF-Expand.

func ECRToken

func ECRToken(ctx context.Context, profile, region string) (string, error)

ECRToken is a registry password for Amazon ECR (it lasts 12 hours).

func EKSToken

func EKSToken(ctx context.Context, profile, region, cluster, roleARN string) (string, error)

EKSToken is a bearer token for an Amazon EKS cluster, made the way `aws eks get-token` and aws-iam-authenticator make it: a presigned STS GetCallerIdentity URL naming the cluster, valid for 15 minutes. roleARN, when set, is assumed first.

func GCPAccessToken

func GCPAccessToken(ctx context.Context) (string, error)

GCPAccessToken is an OAuth access token from the application-default credentials, as gke-gcloud-auth-plugin gives GKE.

func GCPSecret

func GCPSecret(ctx context.Context, name, project string) (string, error)

GCPSecret reads the latest version of a Secret Manager secret. name is a secret id (project from project, the credentials or the gcloud config), or a full projects/P/secrets/S[/versions/V] name.

func KeePass

func KeePass(ref string) (string, error)

KeePass reads one field of an entry in a KeePass or KeePassXC file (KDBX 3.1 and 4). ref is FILE#GROUP/.../ENTRY[#FIELD]; the field is the password unless named (UserName, URL, Notes, or a custom one). The file is opened with KOMANDO_KDBX_PASSWORD and/or the key file KOMANDO_KDBX_KEYFILE.

func OnePassword

func OnePassword(ctx context.Context, ref string) (string, error)

OnePassword reads op://VAULT/ITEM[/SECTION]/FIELD from a 1Password Connect server, through its documented REST API: OP_CONNECT_HOST is the server, OP_CONNECT_TOKEN its access token. Vaults and items are matched by name or id, fields by label or id (and section when given).

func SSMDial

func SSMDial(ctx context.Context, profile, region, target, port string) (net.Conn, error)

SSMDial opens an SSH stream to an EC2 instance through Session Manager.

func VaultKV

func VaultKV(ctx context.Context, path, field string) (string, error)

VaultKV reads one field of a KV secret from HashiCorp Vault or OpenBao, the way `vault kv get -field=FIELD PATH` does: PATH starts with the mount ("secret/shop/db"), KV version 1 or 2 is found out from the mount. The address and token come from the same places the CLI uses: VAULT_ADDR, VAULT_TOKEN or ~/.vault-token, VAULT_NAMESPACE, VAULT_CACERT.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL