All Projects → azohra → ptolemy

azohra / ptolemy

Licence: MIT license
Elixir Application Environment Variable Management

Programming Languages

elixir
2628 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to ptolemy

Serverless Vault With Cloud Run
Guide to running Vault on Cloud Run
Stars: ✭ 225 (+1630.77%)
Mutual labels:  vault
vault-converter
Support converting Vault Secrets to diffrent formats.
Stars: ✭ 15 (+15.38%)
Mutual labels:  vault
kubevault
🔐 KubeVault Documentation
Stars: ✭ 210 (+1515.38%)
Mutual labels:  vault
Terraform Provider Vault
Terraform Vault provider
Stars: ✭ 244 (+1776.92%)
Mutual labels:  vault
expo-file-manager
A file manager app made with React Native & Expo
Stars: ✭ 110 (+746.15%)
Mutual labels:  vault
tfenv
Transform environment variables for use with Terraform (e.g. `HOSTNAME` ⇨ `TF_VAR_hostname`)
Stars: ✭ 120 (+823.08%)
Mutual labels:  env
Vsh
vsh - HashiCorp Vault interactive shell and cli tool
Stars: ✭ 209 (+1507.69%)
Mutual labels:  vault
vaultrs
An asynchronous Rust client library for the Hashicorp Vault API
Stars: ✭ 63 (+384.62%)
Mutual labels:  vault
envsafe
🔒 Makes sure you don't accidentally deploy apps with missing or invalid environment variables.
Stars: ✭ 705 (+5323.08%)
Mutual labels:  env
hashicorp-labs
Deploy locally on VM an Hashicorp cluster formed by Vault, Consul and Nomad. Ready for deploying and testing your apps.
Stars: ✭ 32 (+146.15%)
Mutual labels:  vault
tfvaultenv
A utility for configuring Terraform provider environment variables from HashiCorp Vault secrets
Stars: ✭ 46 (+253.85%)
Mutual labels:  vault
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+453.85%)
Mutual labels:  env
keyscope
Keyscope is a key and secret workflow (validation, invalidation, etc.) tool built in Rust
Stars: ✭ 369 (+2738.46%)
Mutual labels:  vault
Vault Secrets Gen
A Vault secrets plugin for generating high entropy passwords and passphrases.
Stars: ✭ 238 (+1730.77%)
Mutual labels:  vault
schluessel
Node.js package for storing application credentials (API keys, database passwords, etc.) encrypted in your repository.
Stars: ✭ 27 (+107.69%)
Mutual labels:  vault
Spring Cloud Vault
Configuration Integration with HashiCorp Vault
Stars: ✭ 210 (+1515.38%)
Mutual labels:  vault
EtherKit
No description or website provided.
Stars: ✭ 40 (+207.69%)
Mutual labels:  vault
hubble
hubbling the universe nebula by nebula
Stars: ✭ 18 (+38.46%)
Mutual labels:  vault
vault-plugin-secrets-wireguard
Vault's plugin for managing server and dynamic client configurations
Stars: ✭ 41 (+215.38%)
Mutual labels:  vault
vault-consul-kubernetes
vault + consul on kubernetes
Stars: ✭ 60 (+361.54%)
Mutual labels:  vault


Ptolemy is an application environment manager for your Elixir projects. It provides a simple interface to authenticate and interact (via CRUD operations) with a remote backend that stores secrets and sensitive information. As well as providing these functionality Ptolemy also features a dynamic application environment variable loader that loads secrets from a remote backend such as Hashicorp's Vault and handle its lifecycle by refreshing the secret when they are about to expire.

Features

  • Application environment management.
  • Authentication through Google's Cloud IAP
  • Hashicorp Vault integration (tested against Vault v0.11.5 but will support v0.10.4 and later):
    • Supported authentication methods:
      • GCP
      • Approle
    • Supported secret engines:
      • Key-Value Version 2 (KV2)
      • Public Key Infrastructure (PKI)
      • Google Cloud Platform (GCP)

Installation

Ptolemy is available on hex you can install it by following these steps:

  1. Add ptolemy to your deps
def deps do
  [
    {:ptolemy, "~> 0.2.0"}
  ]
end
  1. Run mix deps.get && mix deps.compile

Example Usage

Intergrating Ptolemy With Your Project

Within examples/ we provide an example repository called Simple app. The configuration file in the project shall be served as an example for key values and PKI engine. More configuration specifications can be found in the Configuration section below.

Follow the README.md found in examples/ instructions to get started.

Example CLI usage

You will need to configure the application to point to remote backend. Edit the config.exs to point to remote backend.

Start iex with Ptolemy's modules loaded by entering:

bash-3.2$ cd ptolemy/ && iex -S mix
Erlang/OTP 21 [erts-10.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> {:ok, server} = Ptolemy.start(:server1, :production)
iex(2)> Ptolemy.read(server, :kv_engine1, [:ptolemy, true])
{:ok, %{"test" => "foo"}}

Configuration

There are two configuration blocks that exist in ptolemy as of version 0.2. Both are independent of one another and do not have to be used at the same time.

  1. :vaults configuration is responsible for holding the Vault server configurations
  2. :loader configuration manages the dynamic loading of secrets from providers, e.g. Vault, System Environment

In order to get the most of the library, we recommend to configrure both blocks. Example configuration files can be found in config/test.exs, examples/config/config.exs.

Configuring :vaults

The :vaults key configures ptolemy various backend providers (Hashicorp vault is the only backend currently supported). Each key within the :vaults block represents a specific server in which ptolemy can query to retrieve values such as application secrets currently stored in vault.

config :ptolemy, vaults: [
  server2: %{
    vault_url: "https://test-vault.com",
    engines: [
      kv_engine1: %{
        engine_type: :KV,
        engine_path: "secret/",
        secrets: %{
          test_secret: "/test_secret"
        }
      },
      gcp_engine1: %{
        engine_type: :GCP,
        engine_path: "gcp/"
      },
      pki_engine1: %{
        engine_type: :PKI,
        engine_path: "pki/",
        roles: %{
            test_role1: "/role1"
          }
      }
    ],
    auth: %{
      method: :Approle,
      credentials: %{
        role_id: "test",
        secret_id: "test"
      },
      auto_renew: true,
      opts: []
    }
  }
]

Additional details about usage within the :vaults configuration block can be found in Ptolemy's module docs.

Configuring :loader

If Ptolemy.Loader is being used to dynamically manage application environment variables, then an extra configuration block should also be added:

Specifying this block will allow Ptolemy.Loader to populate the application specific env vars at runtime.

  config :ptolemy, loader: [
    env: [
      {{:app_name, :secret_key}, {Ptolemy.Providers.SystemEnv, "PATH"}},
      {{:app_name, :another_secret_key}, {Ptolemy.Providers.Vault, [:engine_name, [opt1, opt2], [key1, key2]]}},
      # ...
    ]
  ]

Additional details about usage the keys within the :loader configuration block can be found in Ptolemy.Loader's module doc.

Development

Running a local dev environment of ptolemy requires:

  • JQ
  • Docker and docker-compose

Before developing you must issue these commands:

  1. Start up the dockerized version of vault via docker-compose
$ docker-compose up
  1. In a different terminal issue:
$ . ./vault_init.sh

This will setup a local vault server accessible at http://localhost:8200 along with setting up a the docker-composed vault server with a testing approle, the credentials for the role will be exported to your environment variable of the current shell used SECRET_ID and ROLE_ID.

Troubleshooting

What do I do if I get Authentication Failed with error role requires that JWTs must expire within X seconds for GCP authentication?

There is something wrong with your system time, please make sure that you are using a reputable Network Time Protocol (NTP) server as your time provider or force an update for you system type.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].