AgeEx.Sops.ConfigProvider (age_ex v0.1.0)

Copy Markdown View Source

A release config provider for an Elixir config file that SOPS encrypts in the binary format. It works like Config.Reader, but it decrypts the file in memory first. The plaintext does not go to disk, unless the release sets reboot_system_after_config: true. Then Elixir writes the config to a temporary file.

releases: [
  my_app: [
    config_providers: [
      {AgeEx.Sops.ConfigProvider,
       path: {:system, "RELEASE_ROOT", "/deploy/my.server/extra_config.exs"},
       identity_file: "/etc/my_app/age.key"}
    ]
  ]
]

Options

  • :path - the encrypted config file. Required. It accepts a path or {:system, "VAR", "/suffix"}.
  • :identity_file - an age key file, as age-keygen writes it. It accepts a path or {:system, "VAR", "/suffix"}.
  • :identity_env - the name of an environment variable that holds the text of an age key file, for example "SOPS_AGE_KEY". The variable stays set after the boot, and OS processes that the app starts get it too.

Give one of :identity_file and :identity_env. Other options go to Config.Reader.eval!/3, for example :env and :target.

The boot stops with an error if the file does not decrypt, or if the config code fails. The error never contains the plaintext or the key.

Security

age encryption keeps the config secret, but it does not show who wrote the file. Anyone who knows a recipient (a public key) can make a valid file, and this provider runs the file as Elixir code at boot. Thus protect the encrypted file against writes as well as you protect the release itself.