Coder Social home page Coder Social logo

apptio / breakglass Goto Github PK

View Code? Open in Web Editor NEW
34.0 5.0 7.0 39 KB

A command line tool to provide login credentials from Hashicorp Vault

License: MIT License

Makefile 0.53% Go 99.47%
vault hashicorp-vault ease mysql-server golang golang-application

breakglass's Introduction

Breakglass

Breakglass is a tool that will make API calls to Hashicorp Vault servers and then retrieve credentials for you.

It's designed to ease the process of getting elevated login credentials for a variety of servers.

It currently supports MySQL servers and SSH Command line access

Features

  • Grab MySQL passwords for any vault enabled database
  • Grab a one-time-use SSH user and password to get root access to servers
  • Configuration file, so if you do the same command over and over, you don't need to remember a million flags

Vault Configuration

The tool currently assumes you have mounted your databases and hosts into vault under specific paths.

All mysql databases should be mounted under /mysql/<hostname> in vault for example. For more information, please see the docs

Using

To use breakglass, simply download the binary. Run the command with no arguments to see the possible commands:

breakglass allows you to get login credentials for a variety of vault backends, such as databases servers, Linux servers (ssh credentials)
and AWS IAM roles

Usage:
  breakglass [command]

Available Commands:
  help        Help about any command
  mysql       Get temporary login credentials for mysql servers
  ssh         Get temporary SSH credentials for Linux serers

Flags:
      --config string      config file (default is $HOME/.breakglass/config.yaml)
      --debug              enable debug logging
      --vault string   vault host to authenticate against
      --port int      port of vault servers to use when authenticating (default 8200)

Use "breakglass [command] --help" for more information about a command.

For more help on the subcommands, run breakglass mysql help

Config

breakglass will do its best to try and detect sane defaults for you. However, some options will need to be configured.

They are configurable by either flag (meaning you have to set them every time you run breakglass) or for ease of use you can use a config file.

Place the config file in $HOME/.breakglass/config.yaml

An example config file looks like this:

username: "lbriggs"
authmethod: "ldap"
vault: "consulserver-1.example.com"
debug: false

These options can be modified as follows:

username:

This should be the username you use to authenticate to LDAP. If it's not set, breakglass will use the username you're currently logged in as

authmethod:

This is the method you use to authenticate against vault. Currently only LDAP and userpass are supported. LDAP is the default.

vault:

Specify the path to the vault server you wish to use.

$ breakglass mysql --host lbriggs-mysql.exampke.com --vault consulserver-2.example.com

However if you're finding yourself using the same vaulthost over and over again, you can set the vault host in the config file, and it will always use this host.

debug

Debug will enable debug logging for troubleshooting purposes. Ops may ask you to run with the debug option if you're experiencing problems.

MySQL Credentials

Assuming you've configured breakglass with the config options above, simply run breakglass and specify the MySQL Server you want access to:

$ breakglass --host lbriggs-mysql.example.com
Your MySQL Credentials are below
 username: read-ldap-f273c0
 password: <redacted>

You can then use these credentials to connect to the MySQL server you specified.

SSH Credentials

Assuming you've configured breakglass with the config options above, simple run breakglass and specify the SSH server you want access to:

Please enter your password:
Your SSH Credentials are:
 username: breakglass
 password: <redacted>

You can then use these credentials to connect to the Linux server you specified.

Building

See the docs

Contributing

Fork the repo in gitlab and send a merge request!

Caveats

There are currently no tests, and the code is not very DRY.

This was Apptio's first exercise in Go, and pull requests are very welcome.

breakglass's People

Contributors

dudemcbacon avatar grounded042 avatar jaxxstorm avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

breakglass's Issues

Add vault docs

We need to add documentation about to configure vault, so this tool can be used

Add a version command

Need to add a version command and proper version management so we can do automated released

Set a default vault server

Currently, you always need to provide a vault server, either on the command line or via the config file.

We should default to "vault". That way, you can make use of DNS correctly to find the vault service (assuming you've set up service.consul in your search names)

Add a changelog

So that the link on the releases page actually means something.

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.