wintoncode / vault-plugin-auth-kerberos Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] Plugin for Hashicorp Vault enabling Kerberos authentication
License: Mozilla Public License 2.0
[DEPRECATED] Plugin for Hashicorp Vault enabling Kerberos authentication
License: Mozilla Public License 2.0
Hello,
please improve error messages from strconv.ParseInt
in file vendor/github.com/hashicorp/go-plugin/server.go
on line 366 and 371:
minPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MIN_PORT"), 10, 32) if err != nil { return nil, err } maxPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MAX_PORT"), 10, 32) if err != nil { return nil, err }
When I tried to enable the plugin with vault auth enable -passthrough-request-headers=Authorization -allowed-response-headers=www-authenticate kerberos
there was only following response:
Error enabling kerberos auth: Error making API request.
URL: POST http://127.0.0.1:8200/v1/sys/auth/kerberos
Code: 400. Errors:
* rpc error: code = Unknown desc = timeout waiting for connection info
The server debug log shows:
2019-05-09T11:52:04.022+0200 [DEBUG] auth.kerberos.auth_kerberos_84e98ff5.kerberos: starting plugin: metadata=true path=C:\Vault\plugins\vault-plugin-auth-kerberos.exe args=[C:\Vault\plugins\vault-plugin-auth-kerberos.exe, -ca-cert=C:/ca/ca.pem, -client-cert=C:/ca/vault_plugin_kerberos-01.pem, -client-key=C:/ca/vault_plugin_kerberos-01.key, -tls-skip-verify]
2019-05-09T11:52:04.025+0200 [DEBUG] auth.kerberos.auth_kerberos_84e98ff5.kerberos: plugin started: metadata=true path=C:\Vault\plugins\vault-plugin-auth-kerberos.exe pid=3860
2019-05-09T11:52:04.026+0200 [DEBUG] auth.kerberos.auth_kerberos_84e98ff5.kerberos: waiting for RPC address: metadata=true path=C:\Vault\plugins\vault-plugin-auth-kerberos.exe
2019-05-09T11:52:04.037+0200 [DEBUG] auth.kerberos.auth_kerberos_84e98ff5.kerberos: using plugin: metadata=true version=4
2019-05-09T11:52:04.037+0200 [DEBUG] auth.kerberos.auth_kerberos_84e98ff5.kerberos.vault-plugin-auth-kerberos.exe: plugin address: metadata=true address=127.0.0.1:10012 network=tcp timestamp=2019-05-09T11:52:04.036+0200
2019-05-09T11:52:04.038+0200 [TRACE] auth.kerberos.auth_kerberos_84e98ff5.kerberos: setup: transport=gRPC status=started
2019-05-09 11:52:04.039625 I | [ERR] plugin: plugin acceptAndServe error: strconv.ParseInt: parsing "": invalid syntax
2019-05-09T11:52:09.048+0200 [TRACE] auth.kerberos.auth_kerberos_84e98ff5.kerberos: setup: transport=gRPC status=finished err="rpc error: code = Unknown desc = timeout waiting for connection info" took=5.0100258s
2019-05-09T11:52:09.049+0200 [ERROR] secrets.system.system_76024223: enable auth mount failed: path=kerberos/ error="rpc error: code = Unknown desc = timeout waiting for connection info"
Please add a error description like "Please set the env variables PLUGIN_MIN_PORT
and PLUGIN_MAX_PORT
"
Thank you!
Hello,
I am having trouble configuring this plugin. I filled out the auth/kerberos/config
path with the base64-encoded keytab file content and the service_account
entry (in the format HTTP/[email protected]
). The plugin seems to be properly mounted, but when trying to authenticate against this backend (using both the example Python script from README and a custom curl
command call yields the same result), I receive the following error from the API:
{u'errors': [u'[Root cause: Decrypting_Error] Decrypting_Error: Error decrypting encpart of service ticket provided: [KRB Error: (45) KRB_AP_ERR_NOKEY Service key not available - Could not get key from keytab: Matching key not found in keytab. Looking for [HTTP/[email protected]] realm: EXAMPLE.COM kvno: 1 etype: 18]']}
However, when I klist -kt
the keytab used, the principal that I put into the service_account
config entry is there.
Has anybody seen such an issue, or do you have any idea how to resolve this? Thanks a lot.
The below code fails when running from a windows machine:
import requests
import winkerberos as kerberos
service = "HTTP/vault.DOMAIN@REALM"
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/v1/auth/kerberos/login", json={'authorization': 'Negotiate ' + kerberos_token}, verify=False)
See error below:
{"time":"2018-05-29T21:48:01.052877076Z","type":"response","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null,"entity_id":""},"request":{"id":"e03ae638-16fb-8bb9-513c-ebe0334acbdc","operation":"update","client_token":"","client_token_accessor":"","path":"auth/kerberos/login","data":{"authorization":"hmac-sha256:1705419e6936724587ae0e5b1a4560736ecd6124ca9c0b63050c76ea17862c53"},"policy_override":false,"remote_address":"127.0.0.1","wrap_ttl":0,"headers":{}},"response":{},"error":"error processing ClientClaimsInfo: error parsing byte stream headers: Malformed NDR steam: Not enough bytes."}
This works fine from a linux machine. Only difference is we then use standard python kerberos module.
Does this work from a windows machine by any chance?
We have the following setup
# vault config
plugin_directory = "/etc/vault_plugins"
# kerberos-auth-plugin registration
vault write sys/plugins/catalog/kerberos-auth-plugin sha_256=PLUGIN_SHA command="vault-plugin-auth-kerberos -ca-cert /etc/vault_pki/consul.pem -client-cert /etc/vault_pki/consul.crt /etc/vault_pki/consul.key -tls-skip-verify"
# where in /etc/vault_pki we have the certifcates we use for communicating with consul backend
# These certificates work with our consul clients and vault works fine with them.
# Enabling vault with this command.
vault auth enable -path=kerberos -plugin-name=kerberos-auth-plugin plugin
# returns error below
Error enabling plugin auth: Error making API request.
URL: POST http://127.0.0.1:8200/v1/sys/auth/kerberos
Code: 400. Errors:
* plugin exited before we could connect
# In syslog we have:
Apr 17 16:47:33 node_name vault[17802]: 2018/04/17 16:47:33.631477 [ERROR] sys: enable auth mount failed: path=kerberos/ error=plugin exited before we could connect
Vault version:
ault v0.9.6+ent
Consul version:
Consul v1.0.6
Any help with getting this working will be appreciated.
Apologies if this isn't the correct place for this type of question but has anyone got this working with a .NET/C# client?
I can't for the life of me get it to work, my local user has permissions via kerberos and works with the README python code:
var spn = "HTTP/[email protected]";
KerberosSecurityTokenProvider tokenProvider = new KerberosSecurityTokenProvider(spn,
TokenImpersonationLevel.Impersonation, CredentialCache.DefaultNetworkCredentials);
KerberosRequestorSecurityToken securityToken = tokenProvider.GetToken(TimeSpan.FromMinutes(1)) as KerberosRequestorSecurityToken;
var token = Convert.ToBase64String(securityToken.GetRequest());
HttpClient client = new HttpClient();//new HttpClientHandler { UseDefaultCredentials = true, PreAuthenticate = true });
var serializeObject = JsonConvert.SerializeObject(new { authorization = "Negotiate " + token });
var resp = await client.PostAsync(new Uri(vaultUri, "v1/auth/kerberos/login"),
new StringContent(serializeObject)); // 500 error
var content = await resp.Content.ReadAsStringAsync(); // {"errors":["SPNEGO negotiation token is not a NegTokenInit: OID does not match SPNEGO OID 1.3.6.1.5.5.2"]}
Hi,
This may be related to the latest version of vault/vault-plugin-auth-kerberos as this was working pre upgrade to latest versions of vault and vault-plugin-auth-kerberos.
Issue - I am able to authenticate correctly to vault using the plugin and I do get a token back. However the user is not granted the policies defined in auth/kerberos/groups/ldap_group. I can confirm that reading this config with root taken yields the required policies. The user which definetely belongs to ldap_group gets only the "default" vault permission.
auth/kerberos/groups/ldap_group policies='devops_admin, systems_admin, vault_list_secrets'
vault read auth/kerberos/groups/ldap_group
Key Value
--- -----
policies [devops_admin systems_admin vault_list_secrets]
Authenticating with plain ldap as the same user does work.
Does anyone have a working setup using vault Vault v0.10.1
and the latest vault-plugin-auth-kerberos plugin?
Thanks.
Hello,
I cannot seem to get the authentication to work when the key in my keytab has a KVNO higher than one. I've looked into the code of both the plugin and the underlying gokrb5
library extensively, but haven't been able to decipher the exact way the KVNO is parsed and checked (I suspect it's done in https://github.com/jcmturner/gokrb5/blob/master/messages/APReq.go#L124 but I'm not sure).
I don't have a way to reset the KVNO to 1 because of the way that the ipa-getkeytab
command in FreeIPA works (increasing the KVNO after each keytab retrieval). I've tried to work-around this temporarily by skipping the KVNO check, but the authentication started failing on an integrity verification failed
error.
Could you please help me find out whether this is an issue with the gokrb5
library itself, or rather in the way the plugin handles the keytab and passes it to the library? Thanks a lot.
Hi, perhaps I am just not understanding correctly. My situation:
When requesting a token via ldap auth and then logging into vault, my user is showing the correct group/policy mapping:
Key Value
--- -----
token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
token_accessor xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
token_duration 767h59m46s
token_renewable true
token_policies [default custom-application]
token_meta_username jeremyjohnson
I created this group delegation like this:
# vault write "auth/ldap/users/jeremy johnson" groups=custom-application
So, that's all working great... But when I request a token via kerberos auth and log into vault there is no such group mapping:
Key Value
--- -----
token yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
token_accessor yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
token_duration 767h59m41s
token_renewable false
token_policies [default]
token_meta_user jeremyjohnson
token_meta_realm REALM
If anyone could offer some advise I would greatly appreciate it. Thank you!
Jeremy
When I try to login via SPNEGO I got following error:
{"errors":["SPNEGO OID of MechToken is not of type KRB5"]}
When I look via WireShark in my request there are 4 mechTypes:
MechType: 1.3.6.1.4.1.311.2.2.10 (NTLMSSP - Microsoft NTLM Security Support Provider)
MechType: 1.2.840.48018.1.2.2 (MS KRB5 - Microsoft Kerberos 5)
MechType: 1.2.840.113554.1.2.2 (KRB5 - Kerberos 5)
MechType: 1.3.6.1.4.1.311.2.2.30 (NEGOEX - SPNEGO Extended Negotiation Security Mechanism)
Seems like only the first one is checked.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.