Code Monkey home page Code Monkey logo

summon-keyring's Introduction

summon-keyring

Cross-platform provider for Summon that talks to keyrings.

Wraps the Python keyring library to allow summon to fetch credentials from:

  • OSX Keychain
  • Linux Secret Service
  • Windows Credential Vault
  • gnome-keyring
  • kwallet

Requirements

To use this provider, you will need to install:

  • Summon
  • Python and pip
  • The Python keyring library.
    • Note: v21+ of this library requires Python 3.6+.

To install the Python keyring library, run:

$ pip install keyring

Installation

Install the keyring provider by cloning the repo and creating a symlink in the /usr/local/lib/summon directory.

You may need to run the following commands as a super user.

$ git clone [email protected]:cyberark/summon-keyring.git
$ cd summon-keyring
$ mkdir -p /usr/local/lib/summon
$ ln -s "$PWD/ring.py" /usr/local/lib/summon/keyring.py

Note: If you copy the ring.py file to /usr/local/lib/summon/ instead of symbolically linking it, you may see an error like:

Traceback (most recent call last):
  File "/usr/local/lib/summon/ring.py", line 22, in <module>
    value = keyring.get_password(
AttributeError: module 'keyring' has no attribute 'get_password'

This can be resolved by creating a symbolic link instead.

Usage instructions

To use this provider, invoke Summon as usual. If you have multiple providers installed, be sure to provide the path to the keyring provider using the --provider flag:

summon --provider keyring.py \
  --yaml 'MY_ENV_VAR: !var secret/path' \
  my_command

By default, this provider fetches secrets from the service summon. To retrieve secrets from another service, set the SUMMON_KEYRING_SERVICE environment variable.

Example

Let's use the OSX keychain to store a secret and fetch it with summon.

First, we add the secret:

$ security add-generic-password -s "summon" -a "secret/path" -w "secretvalue"

Note: You can also add a secret to the OSX keychain through the Keychain Access utility. The "Keychain Item Name" field should be summon, the "Account Name" should be the secret path, and the "Password" field should contain the secret value. If you are using other secret stores, you can also use the keyring command utility installed with the keyring Python package to set the secret:

$ keyring set summon secret/path # enter "secretvalue" when prompted

Once the secret has been added, we can fetch it with summon by using this provider.

$ summon --provider keyring.py \
  --yaml 'MYSECRET: !var secret/path' \
  printenv MYSECRET

secretvalue

Using summon, you can easily switch between this keyring provider for development and use and more appropriate provider, like Conjur, in production.

Contributing

We welcome contributions of all kinds to this repository. For instructions on how to get started and descriptions of our development workflows, please see our contributing guide.

License

Copyright (c) 2020 CyberArk Software Ltd. All rights reserved.

Licensed under the MIT License (MIT).

For the full license text see LICENSE.

summon-keyring's People

Contributors

andytinkham avatar doodlesbykumbi avatar dustinmm80 avatar hughsaunders avatar izgeri avatar jakequilty avatar jtuttle avatar juniortaeza avatar rpothier avatar sgnn7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

summon-keyring's Issues

TLS version error installing keyring

When trying to install keyring with pip (pip install keyring), pip returns a TLS error. I think you need to update your certs to support the new version.

Error returned from pip:

Collecting keyring
  Could not fetch URL https://pypi.python.org/simple/keyring/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
  Could not find a version that satisfies the requirement keyring (from versions: )
No matching distribution found for keyring

Convert ring.py to Python 3

Python 2.7 is deprecating in a little over a month.

Converting ring.py to support Python 3 will allow users (such as myself) to continue using Summon to secure my local development.

Add CI pipeline

This project does not have a Jenkinsfile and so does not currently have a CI pipeline.

The Keyring provider does not work on Windows

Summary

When trying to use Summon with the ring.py keyring provider, I encounter an error that "ring.py is not a valid Win32 application"

Steps to Reproduce

  1. Using Summon with the keyring provider on Windows...
  2. Store a secret in the keyring
  3. Use Summon to invoke a child process using the keyring provider
  4. observe error

Expected Results

Summon should use the keyring provider, obtain the secret from the keyring, and inject it as an environment variable for the child process

Actual Results

An error that ring.py is not a valid Win32 application

Reproducible

  • Always
  • Sometimes
  • Non-Reproducible

Version/Tag number

Latest

Environment setup

Summon on Windows 10 workstation, using the keyring provider, run as Administrator

Additional Information

Windows is interpreting ring.py as an EXE instead of expanding it using python3.exe. This appears to be a Go limitation on Windows:

"Unlike the “system” library call from C and other languages, the os/exec package intentionally does not invoke the system shell and does not expand any glob patterns or handle other expansions, pipelines, or redirections typically done by shells."

Sample doesn't work with keyring provider

summon -p keyring.py --yaml 'MYSECRET: !var secret/path' printenv MYSECRET

results in the following error:

Error fetching variable MYSECRET: Traceback (most recent call last):
File "/usr/local/lib/summon/keyring.py", line 22, in
value = keyring.get_password(
AttributeError: 'module' object has no attribute 'get_password'

If I run "python -m keyring get summon secret/path", then the value is correct.

This is with summon 0.4.0 - and it appears on both Mac OSX, and Ubuntu 14.0.4

Ensure documentation is accurate

Is your feature request related to a problem? Please describe.

We have had sporadic reports of the instructions needing updates but nothing conncrete. This story is about ensuring that the README is accurate and up-to-date.

Describe the solution you would like

AC:

  • Readme is updated and ensured to be correct

standardised CHANGELOG exists, and is validated via pipeline

If the repo has a changelog that doesn't meet the standard, do try to change earlier entries to match the standard.
If the repo doesn't have a changelog use this as a starter:

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

Acceptance criteria

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.