All Projects → wintoncode → vault-plugin-auth-kerberos

wintoncode / vault-plugin-auth-kerberos

Licence: MPL-2.0 license
[DEPRECATED] Plugin for Hashicorp Vault enabling Kerberos authentication

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to vault-plugin-auth-kerberos

vault-plugin-secrets-wireguard
Vault's plugin for managing server and dynamic client configurations
Stars: ✭ 41 (+13.89%)
Mutual labels:  vault, vault-plugins
ansible-vault-editor-idea-plugin
Ansible Vault Editor IntelliJ Plugin with auto encryption/decryption
Stars: ✭ 29 (-19.44%)
Mutual labels:  vault
rundeck-vault-plugin
Development continues here:
Stars: ✭ 17 (-52.78%)
Mutual labels:  vault
offensive-infrastructure
Offensive Infrastructure with Modern Technologies
Stars: ✭ 88 (+144.44%)
Mutual labels:  vault
artifactory-secrets-plugin
HashiCorp Vault Artifactory Secrets Plugin
Stars: ✭ 17 (-52.78%)
Mutual labels:  vault
hcat
Hashicorp Configuration and Templating library (hcat, pronounced hashicat)
Stars: ✭ 89 (+147.22%)
Mutual labels:  vault
vault
Is a plugin for project management system Redmine. Allows you to store various passwords/keys in one place for the project.
Stars: ✭ 44 (+22.22%)
Mutual labels:  vault
vault-plugin-secrets-kafka
A vault plugin for generating ACLs for dynamic users
Stars: ✭ 20 (-44.44%)
Mutual labels:  vault
vault-consul-swarm
Deploy Vault and Consul with Docker Swarm
Stars: ✭ 20 (-44.44%)
Mutual labels:  vault
jupyterhub-kdcauthenticator
A Kerberos authenticator module for the JupyterHub platform
Stars: ✭ 22 (-38.89%)
Mutual labels:  kerberos
nanvault
A standalone CLI tool to encrypt and decrypt files in the Ansible Vault format
Stars: ✭ 33 (-8.33%)
Mutual labels:  vault
vaultlib
Lightweight Go client library for reading Vault kv secrets
Stars: ✭ 21 (-41.67%)
Mutual labels:  vault
kerby
Go wrapper for Kerberos GSSAPI
Stars: ✭ 33 (-8.33%)
Mutual labels:  kerberos
vault-token-helper
@hashicorp Vault Token Helper for macOS, Linux and Windows with support for secure token storage and multiple Vault servers 🔐
Stars: ✭ 74 (+105.56%)
Mutual labels:  vault
teller
Cloud native secrets management for developers - never leave your command line for secrets.
Stars: ✭ 998 (+2672.22%)
Mutual labels:  vault
concourse-ci-formula
All-in-one Concourse VM with S3-compatible storage and Vault secret manager
Stars: ✭ 26 (-27.78%)
Mutual labels:  vault
vault-migrator
migrate vault data between different physical backends
Stars: ✭ 51 (+41.67%)
Mutual labels:  vault
cryptorious
CLI Password Manager
Stars: ✭ 15 (-58.33%)
Mutual labels:  vault
kubernetes-vault
Run Hashicorp Vault on top of Kubernetes (GKE). Includes instructions for automated backups (GCS) and day-to-day usage.
Stars: ✭ 15 (-58.33%)
Mutual labels:  vault
vault-load-testing
Automated load tests for Vault and Consul using the locust.io Python framework
Stars: ✭ 44 (+22.22%)
Mutual labels:  vault

[DEPRECATED] Vault Plugin: Kerberos Auth Backend

⚠️ This repo is no longer maintained: It has been taken over by Hashicorp as an official plugin which you can find here

This is a standalone backend plugin for use with Hashicorp Vault. This plugin allows for users to authenticate with Vault via Kerberos/SPNEGO.

You can find binaries on the Release page.

Usage

Authentication

You can authenticate by posting a valid SPNEGO Negotiate header to /v1/auth/kerberos/login.

try:
    import kerberos
except:
    import winkerberos as kerberos
import requests

service = "HTTP/vault.domain"
rc, vc = kerberos.authGSSClientInit(service=service, mech_oid=kerberos.GSS_MECH_OID_SPNEGO)
kerberos.authGSSClientStep(vc, "")
kerberos_token = kerberos.authGSSClientResponse(vc)

r = requests.post("https://vault.domain:8200/v1/auth/kerberos/login",
                  json={'authorization': 'Negotiate ' + kerberos_token})
print('Vault token:', r.json()['auth']['client_token'])

Configuration

  1. Install and register the plugin.

Put the plugin binary (vault-plugin-auth-kerberos) into a location of your choice. This directory will be specified as the plugin_directory in the Vault config used to start the server.

...
plugin_directory = "path/to/plugin/directory"
...
$ vault write sys/plugins/catalog/auth/kerberos sha_256="$(shasum -a 256 'vault-plugin-auth-kerberos' | cut -d ' ' -f1)" command="vault-plugin-auth-kerberos -client-cert server.crt -client-key server.key"
  1. Enable the Kerberos auth method:
$ vault auth enable -passthrough-request-headers=Authorization -allowed-response-headers=www-authenticate kerberos
Success! Enabled kerberos auth method at: kerberos/
  1. Use the /config endpoint to configure Kerberos.

Create a keytab for the kerberos plugin:

$ ktutil
ktutil:  addent -password -p [email protected] -e aes256-cts -k 1
Password for [email protected]:
ktutil:  list -e
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    1            [email protected] (aes256-cts-hmac-sha1-96)
ktutil:  wkt vault.keytab

The KVNO (-k 1) should match the KVNO of the service account. An error will show in the vault logs if this is incorrect.

Different encryption types can also be added to the keytab, for example -e rc4-hmac with additional addent commands.

Then base64 encode it:

base64 vault.keytab > vault.keytab.base64
vault write auth/kerberos/config [email protected] service_account="your_service_account"
  1. Add a SPNs (Service Principal Names) to your KDC for your service and service account. This should map the vault service to the account it is running as:
# for Windows/Active Directory
setspn.exe -U -S HTTP/vault.domain:8200 your_service_account
setspn.exe -U -S HTTP/vault.domain your_service_account
  1. Configure LDAP backend to look up Vault policies. Configuration for LDAP is identical to the LDAP auth method, but writing to to the Kerberos endpoint:
vault write auth/kerberos/config/ldap @vault-config/auth/ldap/config
vault write auth/kerberos/groups/example-role @vault-config/auth/ldap/groups/example-role

In non-kerberos mode, the LDAP bind and lookup works via the user that is currently trying to authenticate. If you're running LDAP together with Kerberos you might want to set a binddn/bindpass in the ldap config.

Developing

If you wish to work on this plugin, you'll first need Go installed on your machine.

For local dev first make sure Go is properly installed, including setting up a GOPATH. Next, clone this repository into $GOPATH/src/github.com/wintoncode/vault-plugin-auth-kerberos. You can then download any required build tools by bootstrapping your environment:

$ make bootstrap

To compile a development version of this plugin, run make or make dev. This will put the plugin binary in the bin and $GOPATH/bin folders. dev mode will only generate the binary for your platform and is faster:

$ make
$ make dev

Put the plugin binary into a location of your choice. This directory will be specified as the plugin_directory in the Vault config used to start the server.

...
plugin_directory = "path/to/plugin/directory"
...

Start a Vault server with this config file:

$ vault server -config=path/to/config.json ...
...

Once the server is started, register the plugin in the Vault server's plugin catalog:

$ vault write sys/plugins/catalog/kerberos \
        sha_256=<expected SHA256 Hex value of the plugin binary> \
        command="vault-plugin-auth-kerberos"
...
Success! Data written to: sys/plugins/catalog/kerberos

Note you should generate a new sha256 checksum if you have made changes to the plugin. Example using openssl:

openssl dgst -sha256 $GOPATH/vault-plugin-auth-kerberos
...
SHA256(.../go/bin/vault-plugin-auth-kerberos)= 896c13c0f5305daed381952a128322e02bc28a57d0c862a78cbc2ea66e8c6fa1

Enable the auth plugin backend using the Kerberos auth plugin:

$ vault auth-enable -plugin-name='kerberos' plugin
...

Successfully enabled 'plugin' at 'kerberos'!

Tests

If you are developing this plugin and want to verify it is still functioning (and you haven't broken anything else), we recommend running the tests.

To run the tests, invoke make test:

$ make test

You can also specify a TESTARGS variable to filter tests like so:

$ make test TESTARGS='--run=TestConfig'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].