Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Not able to authenticate after changing password #32

Closed
guga-kudos opened this issue Jun 25, 2020 · 5 comments
Closed

Not able to authenticate after changing password #32

guga-kudos opened this issue Jun 25, 2020 · 5 comments

Comments

@guga-kudos
Copy link

Hey Guys, I don't know If I am doing something wrong!

I am installing the chart in a Kubernetes Cluster using the following command:

helm install mygraph RELEASE_URL --set core.standalone=true --set acceptLicenseAgreement=yes --set neo4jPassword=mySecretPassword

The deploy goes well and I can see the following message:

Changed password for user 'neo4j'.
Remote interface available at http://graphdb-neo4j-core-0.graphdb-neo4j.default.svc.cluster.local:7474

But then when we try to authenticate to db in our node.js service using user=neo4j and password=mySecretPassword we see the following message being returning by db:

Failed authentication attempt for 'neo4j' from 100.101.66.28

Also I have also trying doing a curl inside the neo4j container:

curl  http://neo4j:mySecretPassword@graphdb-neo4j-core-0.graphdb-neo4j.default.svc.cluster.local:7474/user/neo4j
{
  "errors" : [ {
    "code" : "Neo.ClientError.Security.Unauthorized",
    "message" : "Invalid username or password."
  } ]

Am I doing something wrong ?

PS. When I set authEnabled: false in the chart, everything works as expected :)

@moxious
Copy link
Contributor

moxious commented Jun 26, 2020

I'm not sure what's happening here because this bit is tested, and I can't reproduce.

Could you paste the exact command you're using to connect using this password, and what it's result is? Can you verify that the secret was installed in kubernetes, and that it's base64 decoded value is mySecretPassword?

A final thing to try is the default neo4j/neo4j. If the container failed to set your desired password (for some reason, which I doubt) then the password would be neo4j.

@moxious
Copy link
Contributor

moxious commented Jun 30, 2020

Any update here?

@guga-kudos
Copy link
Author

Hey @moxious , thanks for your quick response and sorry for my late one.

So I investigated a little bit more and it seems to be related to persistent volumes. If I install the chart once, delete it, and install it again with a different password it will keep the first password stored in the volume.

I don't know if that is an issue, but it might get people confused.

Here is what a I did to reproduce:
(make sure to clean up all the persistent volumes and claims using kubectl, or install chart with a different name)

  1. Install the chart for the first time:
helm install graphdb RELEASE_URL --set core.standalone=true --set acceptLicenseAgreement=yes --set neo4jPassword=pass1
  1. Run inside the cluster:
# this should work
curl http://neo4j:pass1@graphdb-neo4j-core-0.graphdb-neo4j.default.svc.cluster.local:7474/user/neo4j
  1. Delete chart:
helm delete graphdb --purge
  1. Install it again with different password:
helm install graphdb RELEASE_URL --set core.standalone=true --set acceptLicenseAgreement=yes --set neo4jPassword=pass2
  1. Run inside the cluster:
# this should not work
curl http://neo4j:pass2@graphdb-neo4j-core-0.graphdb-neo4j.default.svc.cluster.local:7474/user/neo4j

# this should work
curl http://neo4j:pass1@graphdb-neo4j-core-0.graphdb-neo4j.default.svc.cluster.local:7474/user/neo4j

@moxious
Copy link
Contributor

moxious commented Jun 30, 2020

Yes, this makes sense. When you set a password in neo4j 4.0+, it writes something to the system database. If you retain disk images between launches, then when your new database starts up, it will have the state on disk of the old system database, which of course has the old password.

This can be avoided several ways:

  • When redeploying, use a different name
  • Prior to redeploying, delete the PVCs associated with the old deploy
  • Prior to redeploying, use other tooling to delete the /data/databases folders in the PVC mount point.

Unfortunately, as your'e describing this situation, it's working as intended. Helm doesn't auto-delete the PVCs associated with the install when you delete -- because the purpose of PVCs is to retain the data.

@guga-kudos
Copy link
Author

@moxious, yes indeed!

Sorry, I guess it was misinformation from my end.

But it is a good headsup if anyone stubble upon this in the future :)

Thanks a lot for your help

@moxious moxious closed this as completed Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants