Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Configuration of HashiCorp Vault Paremeter Context : Error "Cannot login using Kubernetes: permission denied"

avatar
Contributor

Hello 

I'm trying to use Nifi Hashi Corp Vault Parameter Provider with Kubernetes authentication.
 - Nifi versions is 2.4.0
 - Hashi Corp version is 1.19.5

From my Nifi pod I get to authenticate successfully using the following curl 

curl -s -k -X POST -H 'X-Vault-Namespace: DATA/DATAOPE/EC002I002621/' -H 'X-Vault-Request: true' -d '{"jwt": "<content of file /var/run/secrets/kubernetes.io/serviceaccount/token>", "role": "role_k8s_auth_demo_re_ns002i007839"}' https://hvault.staging.my_company/v1/auth/kubernetes_demo_re_ns002i007839/login

From the pod I then get to make a successful secret retrieval with the follwing curl

curl -H "X-Vault-Request: true" -H "X-Vault-Namespace: DATA/DATAOPE/EC002I002621/" -H "X-Vault-Token: <token retrieved by previous command>" https://hvault.staging.my_company/v1/secret/data/test

I try to make sense of the doc and cannot get to a working configuration

I setup my HashiCorp Vault Client with the following properties direct properties

vault.kubernetes.kubernetes-path                       kubernetes_demo_re_ns002i007839
vault.kubernetes.role                                  role_k8s_auth_demo_re_ns002i007839
vault.namespace                                        DATA/DATAOPE/EC002I002621/
and set up the SSL context service appropriately.

I set up my Parameter Provider with the following direct properties
key value path :                     DATA/DATAOPE/EC002I002621/secret/
version :                                    kv 2
secret name pattern :           .*

I get the following error message : 
Error fetching parameters for ParameterProvider[id=xxxx]:
Cannot login using Kubernetes: permission denied

Can someone help me sort out what I'm doing wrong ?
Is there a way to dump the API calls made by the Parameter Provider ?

Regards.

 

 

 

 

 
Regards

1 REPLY 1

avatar
Master Collaborator

Hello @Alf015, 

I found two thing that may be causing this issue. 
First, the "vault.namespace" should not have the "/" at the end: 
https://docs.spring.io/spring-vault/docs/2.3.x/reference/html/#vault.core.environment-vault-configur...

On the Paramenter Provider, "key value path" should be only "secret", all the rest is taken from the header. 
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-hashicorp-vault-nar/1.28.0/or... 

Try those changes and let us know if this fails. 
If it does, maybe the Debug level for those modules can provide more information: 

<logger name="org.apache.nifi.vault" level="DEBUG"/>
<logger name="org.apache.nifi.parameter" level="DEBUG"/>
<logger name="org.springframework.vault" level="DEBUG"/>

Regards,
Andrés Fallas
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs-up button.