Skip to content

SayHeyD/sops-age-manager

Repository files navigation

Test and Build Lint

sops-age-manager (sam)

sam is a tool to easily manage your sops configuration when using multiple age keys. This is useful when f.ex. you have a k8s cluster where you have per-namespace decryption keys.

Table of contents

Why isn't sops enough?

With the tooling that sops provides currently, changing the configured age key required entering the public key as an argument with every operation or defining an environment variable with the private key of the key to use. Both options are rather cumbersome when having to change keys frequently.

What exactly does sam do?

sam provides a configurable layer on top of sops. This means sam is basically a wrapper for sops when using age keys. you can configure which key to use by name and execute sops commands with the configured key. In addition, sam also provides some small helper commands to manage and access your key data.

User guide

Prerequisites

sam requires sops to be installed before it can be used. If sops is not installed everything still works as expected aside from the base command, which passes its args to sops. sam also requires sops to be in the PATH.

age isn't per se a requirement, but you will already need to have age keys to use sam. Sam will not create age keys for you.

General

After installation add the age key files to the following path $HOME/.age/. sam will detect age keys in this directory automatically by default. The filename should follow the following format: <KEY_NAME>.txt.

The default config file for sam will be created at $HOME/.sops-age-manager/config.yaml on first usage of sam if it doesn't exist already.

Installation

Download the binary for your OS from the releases page on GitHub.

Make sure to set the active key before using sam, if not sops will return an error and sam will return the following error.

Could not find decryption key ""
Could not find encryption key ""

Commands

The base command of sam does nothing by itself without a -- separator after which you can execute whatever you want. The base command simply sets the SOPS_AGE_KEY environment variable to the correct value. For sops commands the --age argument will be injected automatically to the selected key.

Examples

sam key use private-helm-manifest
sam -- sops -d super-secret.enc.yaml
sam key use private-helm-manifest
sam -- sops -e super-secret.dec.yaml

The --age argument is passed automatically by sam.

COMMAND DOCUMENTATION:

Configuration

Configuration is quite minimal and lets you configure the following values:

Encryption Key

The name of the encryption key to use. This is passed to sops as the --age arg to sops. Available key names can be listed with the sam key list command.

Decryption Key

The name of the decryption key to use. This is set as the value of the SOPS_AGE_KEY environment variable which is consumed by sops. Available key names can be listed with the sam key list command.

Key dir

The directory where the age keys are stored. This has to be an absolute filepath. Environment variables are not parsed.

All keys that are not directly in the key-dir i.e. in subfolders will not be detected by sam.

About

A tool to manage multiple age keys with sops

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published