Git Product home page Git Product logo

mostafahussein / conceal Goto Github PK

View Code? Open in Web Editor NEW
61.0 2.0 3.0 48 KB

A command line utility that provides a secure method to get your secrets from your existing password manager. :lock:

Home Page: https://mostafahussein.github.io/projects/conceal/

License: Apache License 2.0

Makefile 6.74% Go 93.26%
automation compliance cybersecurity devops devops-tools secrets-management security-tools kubectl kubernetes openshift

conceal's Introduction

License GitHub release (latest by date)

1  Conceal main

Conceal is an open‑source command line utility. It provides a secure method to get your secrets from your existing password manager.

Features

Conceal provides the following features:

  • Configured Session:
    • You can configure for how long your main password will be valid.
    • The password you entered will be saved locally and encrypted with OpenPGP.
  • Integration with different password managers:
    • Currently, we support Enpass, but more will come soon.

Getting Started

Installation

Linux (AMD64)

curl -Lo conceal https://github.com/mostafahussein/conceal/releases/download/$(curl -s https://api.github.com/repos/mostafahussein/conceal/releases/latest | grep tag_name | cut -d '"' -f 4)/conceal-linux-amd64
chmod +x conceal
sudo mv conceal /usr/local/bin/conceal

Linux (ARM64)

curl -Lo conceal https://github.com/mostafahussein/conceal/releases/download/$(curl -s https://api.github.com/repos/mostafahussein/conceal/releases/latest | grep tag_name | cut -d '"' -f 4)/conceal-linux-arm64
chmod +x conceal
sudo mv conceal /usr/local/bin/conceal

Linux (ARM7)

curl -Lo conceal https://github.com/mostafahussein/conceal/releases/download/$(curl -s https://api.github.com/repos/mostafahussein/conceal/releases/latest | grep tag_name | cut -d '"' -f 4)/conceal-linux-arm
chmod +x conceal
sudo mv conceal /usr/local/bin/conceal

macOS (AMD64)

curl -Lo conceal https://github.com/mostafahussein/conceal/releases/download/$(curl -s https://api.github.com/repos/mostafahussein/conceal/releases/latest | grep tag_name | cut -d '"' -f 4)/conceal-darwin-amd64
chmod +x conceal
sudo mv conceal /usr/local/bin/conceal

macOS (ARM64)

curl -Lo conceal https://github.com/mostafahussein/conceal/releases/download/$(curl -s https://api.github.com/repos/mostafahussein/conceal/releases/latest | grep tag_name | cut -d '"' -f 4)/conceal-darwin-arm64
chmod +x conceal
sudo mv conceal /usr/local/bin/conceal

How it works

Conceal will start connecting to your password manager and fetches the needed secrets (e.g. username and password) and set these values as environment variables based on what you have defined in the configuration file.

Roadmap

  • Integrate with Secret managers
  • Ability to execute different command-line utilities (e.g. kubectl, oc, aws)
  • Support for different environments (e.g. dev, prod)
  • CI/CD integration
    • Github Actions
    • Gitlab CI

Usage

A cli utility that provides a secure method to get your secrets from your existing password manager.

Usage:
  conceal [command]

Available Commands:
  exec        Execute commands for a given profile
  gen         Generate command alias
  init        Initialize Conceal Configuration
  version     Print the version number of conceal

Flags:
  -h, --help   help for conceal

Configuration

After adding the binary to your system, you need to create a local directory and add the configuration file, this can be done by executing:

$ conceal init

conceal init offers 3 flags:

  • --secret-manager (-s for short) a flag that is utilized for the secret manager that you are going to use, by default it will be enpass
  • --timeout (-t for short) a flag that is utilized for keeping the password valid for defined number of minutes, by default it will be 15 minutes
  • --vault-location (-l for short) a flag that is utilized for defining the secret manager location, by default it will use a default location for enpass which will be ~/Documents/Enpass/Vaults/primary

Adding command configuration

In order to add a new command configuration, you need to add resource block to ~/.conceal/config.hcl.

Scenario 1

Let's see how kubectl will work with conceal:

Assuming that, you have kubectl installed and the authentication to your kubernetes cluster is being done through AWS IAM

  1. In Enpass, create a new login with the name AWS_ACCESS_KEY
  2. Add the value of AWS_ACCESS_KEY_ID as the username and the value of AWS_SECRET_ACCESS_KEY as the password
  3. Add the following block to ~/.conceal/config.hcl
resource "profile" "k8s" {
  environment "default" {
    command = "kubectl"
    env = {
      id = "AWS_ACCESS_KEY"
      login = "AWS_ACCESS_KEY_ID"
      password = "AWS_SECRET_ACCESS_KEY"
    }
  }
}

The block above tells conceal the following:

  • We need to define two environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY where the values can be found under AWS_ACCESS_KEY inside Enpass.
  • Execute kubectl command

Scenario 2

Another example in case you are using OpenShift and you want to avoid using oc login every time you access your cluster.

  1. In Enpass, create a new login with the name openshift_login
  2. Add your openshift username in the username field value and the password in the password field value
  3. Add the following block to ~/.conceal/config.hcl
resource "profile" "openshift" {
  environment "default" {
    command = "oc"
    args = "login -u $OC_USERNAME -p $OC_PASSWORD https://localhost:8443"
    env = {
      id = "openshift_login"
      login = "OC_USERNAME"
      password = "OC_PASSWORD"
    }
  }
}

The above block tells conceal the following:

  • Define a system environment variables named OC_USERNAME and OC_PASSWORD based on the values that we have added to openshift_login inside Enpass.
  • We need to execute oc command as follows:
oc login -u $OC_USERNAME -p $OC_PASSWORD https://localhost:8443

Note: If you want to pass specific arguments you need to define args like in the oc command example otherwise no need to add it.

Supporting Multiple environments

If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY on development environment are different from the production environment, and you want to make conceal handle both environments, you can update your config like below

resource "profile" "amazon" {
  environment "default" {
    command = "aws"
    env = {
      id = "AWS_ACCESS_KEY_DEV"
      login = "AWS_ACCESS_KEY_ID"
      password = "AWS_SECRET_ACCESS_KEY"
    }
  }
  environment "prod" {
    command = "aws"
    env = {
      id = "AWS_ACCESS_KEY_PROD"
      login = "AWS_ACCESS_KEY_ID"
      password = "AWS_SECRET_ACCESS_KEY"
    }
  }
}

Note: You can switch between environments by passing -e default or -e prod

Adding command aliases

Once the configuration step is done, you can execute kubectl commands using the following command

conceal -p k8s "get pods"

But as this will look different than the normal kubectl commands and might be harder to type, you can generate an alias for kubectl and then add it to your .bashrc file or its equivalent depends on which shell you use.

In order to generate an alias you can execute the following command

conceal gen -a kubectl -p k8s -e default

The above command will generate an alias for kubectl so you can start typing normal kubectl commands and it will be handled by conceal.

Contributing

We'd love for you to contribute to this tool. You can request new features by creating an issue, or submit a pull request with your contribution.

License

Copyright © 2022 Mostafa Hussein

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

conceal's People

Contributors

amrebada avatar mostafahussein 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  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

conceal's Issues

[RFC] 1Password and OTP Support

Just discovered this tool and love the approach of it. IMO this has great potential.

However I'd like to ask about two things that are missing for my case and might be a great benefit for others too.

1st: 1Password support - great tool that comes with a CLI to interact with. In commercial areas I guess 1PW is a very common password manager and it should not miss on the list of supported password managers.

2nd: The possibility to also read a One-Time Code/Password from an entry since this is more than common to have configured. Sth like:

resource "profile" "some-service" {
  environment "default" {
    command = "SERVICE_PW=$MY_SERVICE_PW some-command"
    args = "login -u $MY_SERVICE_LOGIN --password --otp $OTP"
    env = {
      id = "MY_SERVICE"
      login = "MY_SERVICE_LOGIN"
      password = "MY_SERVICE_PW"
      otp = "MY_SERVICE_OTP
    }
  }
}

So this is just an RFC - what do you think about it?

Best,
Jan

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.