HashiCorp Vault Error 403 Permission denied - hashicorp-vault

Im new to HashiCorp Vault and im Doing the tutorials one by one by far i have cleared installing vault and setting up the server.. I even learnt to create a secret, no problems. Im facing an issue in secret engines.. When i type the command "vault secrets enable -path=kv kv" im getting an error saying "Error enabling: Error making API request.
URL: POST http://127.0.0.1:8200/v1/sys/mounts/kv
Code: 403. Errors:
permission denied"
Can anyone pls help me..

Vault denies access to its API endpoints by default. In order to use /sys/mounts/kv, you'll need to supply the X-Vault-Token header to your HTTP request, and that token must have sufficient permissions at the sys/mounts/kv path.
https://www.vaultproject.io/api-docs/system/mounts#enable-secrets-engine

Related

Nextcloud and Google SAML SSO: Error parsing the request, No SAML message present in request

I struggle a bit to get Nextcloud to work with Google as SSO provider. I have URL target of the iPd is https://accounts.google.com/o/saml2/idp?idpid=xxxxxxx then I get
403. That’s an error.
Error: app_not_configured_for_user
So following the suggestion here, I changed the url to
https://accounts.google.com/accountchooser?continue=https://accounts.google.com/o/saml2/idp?idpid=xxxxxx
Which redirects me to the google account chooser, but then I get, after selecting my account
null. That’s an error.
Error parsing the request, No SAML message present in request That’s all we know.
Sometimes I am not asked for a user account, so then I get the following from Nextcloud
Account not provisioned.
Your account is not provisioned, access to this service is thus not possible.
What worked for me is to configure Google having these attribute mappings
While on Nextcloud I configure SAML as follows

Vault reports missing client token when using postgres storage backend

I am using Vault with postgres storage backend along with kv secret engine. I am uisng kubernetes auth method to get the vault token. I followed the below documentation to setup the vault with kubernetes
https://learn.hashicorp.com/tutorials/vault/kubernetes-minikube?in=vault/kubernetes
When I start the webapplication for the first time and try to retrieve the tokens it is working but when I delete the webapp deployment and try to deploy webapp again and try to retrieve the vault token again with the api
v1/auth/kubernetes/login
I get the following error
error: 400 Bad Request: [{"errors":["missing client token"]}
But the request has the jwt token of service account. Please see the below image
Due to this error Pod keeps restarting and all of a sudden after some time vault honours the request and returns the vault token.
This looks strange any reason for such behavior?
UPDATE:
This issue does not happen for consul backend

Error Code 401 while using Server Side Huawei Mobile Service API for app level access token

From yesterday I am facing this error code 401 while accessing token from server using this API: https://oauth-login.cloud.huawei.com/oauth2/v3/token
Just for your information I am using Postman. Can anybody help me with this.
Error 401 usually means “unauthorized” or “request denied” because a request lacks valid credential. Although this error code is not listed in Account Kit server api, a developer can find it in other kit document - https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/webapi-error-code-0000001050163432-V5. Basically, a developer need to make sure that their API key and/or token is valid.
while using huawei auth service if error code 401 returned it means access token becomes invalid and we need to obtain a new token. Token Validity is 60 mins.

"Missing client token" when authenticating with login/pass on Hashicorp Vault

I'm trying to get login/pass authentication working on Vault.
When I try the method given in the API documentation here: https://www.vaultproject.io/api/auth/userpass/index.html#login
I get this error:
$ curl --request POST --data #payload.json https://<myurl>:8200/v1/auth/userpass/login/<mylogin> -k
{"errors":["missing client token"]}
And I can't find information on this error. It makes me wonder what happens, because I want to authenticate with login/pass to get the token, so that's just normal to not have it.
Here is the content of the payload.json:
{
"password": "foo"
}
Is there any way to login with username/password? This is the only fallback method I have when the user does not know its token.
Thanks!
OK, so I figured it out by trials.
So the userpass AUTH was indeed disabled. I have to use LDAP auth. With the Vault-UI that is installed, I managed to find the URL to authenticate. If was the following : https://******:8200/v1/auth/<ldap>/login/<user>
And that way it's working.
Unfortunately, it does not help in the end. The idea was to synchronize Vault data locally, but the Vault API is really not built for that kind of access. It requires a LOT of requests, and end up being very slow for a few secrets synchronized.
Make sure you are logging in under the correct namespace. You will get this error if your authentication method is enabled under something other than the default namespace that your CLI tool is using.
You can specify the namespace with the -ns=my/namespace/ parameter or the VAULT_NAMESPACE environment variable.
For example, if your namespace is "desserts/icecream"
vault login -ns=desserts/icecream/ -method=userpass username=ian
# OR
export VAULT_NAMESPACE=desserts/icecream/
vault login -method=userpass username=ian
In my case, i was not setting the vault token to the right environment variable.
you have to set the value to VAULT_TOKEN so that it uses it in subsequent request my env variable was Vault_Token and due to this it was always saying missing client token.
By default, Vault checks for this environment variable to find the token.
vault kv get --field "ACCESS_KEY_ID" secret/my-secret

Couldn't connect to database using Cloud SQL proxy

When using the GCloud CLI to create the service accounts and keys I get the following error
2018/02/24 22:32:35 New connection for "moodle-proj-10:europe-west2:mysqlinst10"
2018/02/24 22:32:35 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": ensure that the account has access to "moodle-proj-10:europe-west2:mysqlinst10" (and make sure there's no typo in that name). Error during createEphemeral for moodle-proj-10:europe-west2:mysqlinst10: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
When I delete the service accounts and corresponding keys are re-create it using the console, the error changes to the error below
2018/02/24 23:21:25 couldn't connect to "moodle-proj-10:europe-west2:mysqlinst10": Post https://www.googleapis.com/sql/v1beta4/projects/moodle-proj-10/instances/mysqlinst10/createEphemeral?alt=json: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error" : "invalid_grant",
"error_description" : "Invalid JWT Signature."
}
Has anyone experienced this?
I had this problem when I followed the command line instructions in this help article
Solution is to delete the original service account and create a new one in the console using this help article.