GithubHelp home page GithubHelp logo

ismarc / conjur-in-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doodlesbykumbi/conjur-in-go

0.0 1.0 0.0 71 KB

Conjur written in Go. Built to be interoperable with Conjur in Ruby

Go 100.00%

conjur-in-go's Introduction

conjur-in-go

Conjur server written in Go. Written to be interoperable with Conjur in Ruby. This project started off mostly about exploring the crypto side of things, trying to replicate and better understand slosilo. It turns out once you have that working you're good to Go :_)

Currently supports

  • authn, authz, secret retrieval

Like Conjur in Ruby, this server uses the datakey to decrypt/encrypt all the things (secrets, tokenSigningPrivateKey etc.) from and to the database.

Authn, though it doesn't verify your api key it allows you to assume the user you pass in. Like Conjur the account needs an associated tokenSigningPrivateKey in the slosilo keystore. The token is used both to sign new access tokens, and to verify access tokens as part of authz. Also supports base64 encoding of the token.

curl -X POST \
  -H 'Accept-Encoding: base64' \
  -v \
  "http://localhost:8000/authn/myConjurAccount/Dave@BotApp/authenticate"

Secret retrieval + authn + authz. For authn, as with Conjur in Ruby, tokens are verified against the token signing keys (from the slosilo keystore) based on the key id + fingerprint. From authn, we get the identity and use the stored procedure (is_role_allowed_to) to check for permissions before serving secrets to authenticated users. The data key is used to decrypt the secrets from the db.

token=...
curl \
  -H 'Authorization: Token token="'$token'"' \
  -v \
  "http://localhost:8000/secrets/myConjurAccount/variable/BotApp%2FsecretVar"

Run

Build and run

go build -o conjurctl ./cmd/conjurctl

DATABASE_URL="postgres://postgres@localhost/postgres" \
CONJUR_DATA_KEY="2AP/N4ajPY3rsjpaIagjjA+JHjDbIw+hI+uI32jnrP4=" \
 ./conjurctl server

Development

A great way to develop this project is to run cyberark/conjur-quickstart. It will bootstrap that database using Conjur in Ruby. This project is meant to be interoperable with the Conjur in Ruby.

Replace the database service in the docker-compose.yml with the following:

  database:
    image: postgres:10.15
    container_name: postgres_database
    environment:
      POSTGRES_HOST_AUTH_METHOD: trust
    ports:
      - 5432:5432
  pgadmin:
#    https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: [email protected]
      PGADMIN_DEFAULT_PASSWORD: SuperSecret
    ports:
      - 80:80

Visit http://localhost:80 and use the pgadmin UI to navigate the Conjur database. This really helps while tinkering. You can see all the tables and explore the Conjur database with such ease.

Cool ideas!

  1. OpenTelemetry, get some metrics and traces going.
  2. This could be used to create a lightweight "Conjur" that has a, say, in-memory backing store for extremely fast reads. In this case the server needs to just do authn, authz and secrets fetching. Who knows the kinds of performance you could squeeze.
  3. Refactor + unit tests should be fun.

conjur-in-go's People

Contributors

doodlesbykumbi avatar

Watchers

James Cloos avatar

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.