Giter VIP home page Giter VIP logo

datagrip-vault-plugin's Introduction

datagrip-vault-plugin

Build Version Downloads

This plugin provides database credentials using Vault dynamic secrets.

Vault login is not handled by this plugin.

You should manually log in into Vault, which will, using the default Token Helper, create a Vault token file in $HOME/.vault-token.

The recommended way to use this plugin is with a Vault Agent, with Auto-Auth and cache enabled.

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "datagrip-vault-plugin" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > โš™๏ธ > Install plugin from disk...

Screenshots

datagrip-vault-plugin.png

Vault Agent

This plugin will request new credentials everytime a connection is open to the database. To re-use already existing and valid credentials a Vault Agent is recommended.

This is an example, with AWS Authenticaton. Save it as vault-agent-datagrip.hcl and edit accordingly:

auto_auth {
    method "aws" {
        config = {
            type = "iam"
            role = "zzz"
            access_key = "xxx"
            secret_key = "yyy"
            header_value = "https://vault.example.com"
        }  
    }

    sink "file" {
        config = {
            path = "/opt/vault/vault-token-datagrip"
        }
    }
}

vault {
    address = "https://vault.example.com"
}

cache {  
    use_auto_auth_token = true
}

listener "tcp" {
    address = "127.0.0.1:8101"
    tls_disable = true
}

Launch the Vault Agent with vault agent -log-level=debug -config vault-agent-datagrip.hcl.

Configure a DataGrip database connection with:

  • Address: 127.0.0.1:8101
  • Token file: /opt/vault/vault-token-datagrip

Launching Vault Agent automatically

To skip launching the Vault Agent manually, you can configure your system manager to launch it on startup. For systemd create a ~/.config/systemd/user/vault-agent-datagrip.service with:

[Unit]
Description="Vault Agent to serve Tokens - DataGrip"

[Service]
SyslogIdentifier=vault-agent-datagrip
ExecStart=/usr/bin/vault agent -config=/opt/vault-agent-datagrip.hcl
Restart=always

[Install]
WantedBy=default.target

Enable the Vault system unit with systemctl --user enable vault-agent-datagrip and launch the Vault Agent with systemctl --user start vault-agent-datagrip.

Limitations

Support for parsing Vault config file from environment variable VAULT_CONFIG_PATH or default ~/.vault is restricted to JSON syntax only. It does not support native HCL syntax.

datagrip-vault-plugin's People

Contributors

actions-user avatar froque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

datagrip-vault-plugin's Issues

Retries for authentication failure

Since adding caching support in #14 I've managed to successfully use this plugin! Thanks!

One issue I've noticed is that it takes ~10 seconds for our replica's to have the credentials to authenticate which results in multiple login attempts to be able to query.

It would be nice if we could introduce some retry logic to handle this. Perhaps with some user controllable input to make it fail fast by default.

Plugin is not compatible with Vault token helper

If Vault is configured with a Vault token Helper, like https://github.com/joemiller/vault-token-helper, it will not be possible for the Dbeaver plugin to read the token file.

Possible solutions:

New Vault 1.10+ token format is not supported

Problem

The current plugin does not work with new vault 1.10+ tokens.

Env

  • Datagrip Vault Plugin 1.3.2
  • Vault 1.15+
  • Goland 2023.2

Steps to reproduce

  1. Take new Vault 1.10+ instance
  2. Configure the plugin to use it.
  3. Authorize in Vault, get token.
  4. Try to get credentials using the plugin.

Awaited

ok

Got

fail

Possible Reason

Since version 1.10 Vault has changed token format
token format

Developer documentation on Tokens states, that:

Warning
Tokens are opaque values so their structure is undocumented and subject to change. Scripts and automations that rely on the internal structure of a token in scripts will break.

Infer Vault address from VAULT_ADDR env

Hi. Thanks for the awesome plugin. It's nice that it has the default setting for the Token file and I believe it will make the configuration even easier if it could read the Address from the VAULT_ADDR environment variable

Any plans for future updates?

The plugin has worked great for older versions of DataSpell and Pycharm (2021.3.3). Are there any plans to update it to be compatible with the most recent versions?

Compatibility with DataGrip version DB-223.7571.180

Hey Filipe. Thanks for the amazing plugin!

Are there any planes for it to be updated for compatibility with the new 2022.3 release of DataGrip?

Plugin 'Datagrip-Vault' (version '1.0.1') is not compatible with the current version of the IDE, because it requires build 222.* or older but the current build is DB-223.7571.180

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.