Closed Ledenel closed 4 years ago
@Ledenel, please can you confirm that you're not using the nativeauthenticator
fork provided out-of-the-box with the mlhub
Docker image? I've been able to replicate the error message you report from a fresh Docker pull/run, using all the default settings/components (MacOS Catalina, Docker Desktop 2.1.0.5, Tornado 5.1.1).
However, using the standard out-of-the-box nativeauthenticator
provided by 'mlhub' (https://github.com/ml-tooling/nativeauthenticator), I am able to create a new user with the username admin
and a password of my choosing (despite the exception being thrown). Instructions relating to this are provided with the README.md
(https://github.com/ml-tooling/ml-hub#default-login).
Further investigation of this issue has found that the call to authenticate()
actually passes the username and password as separate positional arguments (https://github.com/ml-tooling/nativeauthenticator/blob/master/nativeauthenticator/handlers.py#L86), despite the method signature actually accepting these together as a dictionary (i.e. as a single positional parameter) (https://github.com/ml-tooling/nativeauthenticator/blob/master/nativeauthenticator/nativeauthenticator.py#L127).
Changing the function signature from def authenticate(self, handler, data):
to def authenticate(self, handler, username, password):
seems to address the issue, but I've noted this function hasn't been updated in the original repo from jupyterhub (https://github.com/jupyterhub/nativeauthenticator/blob/master/nativeauthenticator/nativeauthenticator.py#L127), and there are no issues I can find reporting this elsewhere, which I find somewhat surprising?
@raethlein - any thoughts? I can raise a PR with the changes I've described above if that would be useful, but I'm not very familiar with Tornado/Jupyterhub auth so wanted to sanity check this with someone first?
Update to my previous comments above:
authenticate()
(https://github.com/ml-tooling/nativeauthenticator/blob/master/nativeauthenticator/handlers.py#L86) doesn't exist in the original jupyterhub/nativeauthenticator
(https://github.com/jupyterhub/nativeauthenticator/blob/master/nativeauthenticator/handlers.py#L67), so this explains why I can't replicate this in the standard Jupyterhub Docker image. This must be needed for something specific to MLHub, but I'm unsure at this stage what this is).
I'll propose a modification and raise as a PR in ml-tooling/nativeauthenticator
(https://github.com/ml-tooling/nativeauthenticator)
Thanks for reporting the issue @Ledenel and thanks for looking into it @cgddrd!
In fact, the reported issue with authenticate()
- while, of course, not nice - should actually be ignorable and should not cause the error that the admin
user cannot login.
@Ledenel have you added some configurations for the authenticator in your jupyterhub config file, e.g. c.Authenticator.admin_users
?
@cgddrd The mentioned line was added in commit a5fcce293d4051112c84cf06a5d6fe0fbaff5f48 when I cherry-picked the changes from this pull request of the original repo. Though, after taking over the work-in-progress changes, I did not follow up on it.
@Ledenel, please can you confirm that you're not using the
nativeauthenticator
fork provided out-of-the-box with themlhub
Docker image? I've been able to replicate the error message you report from a fresh Docker pull/run, using all the default settings/components (MacOS Catalina, Docker Desktop 2.1.0.5, Tornado 5.1.1).However, using the standard out-of-the-box
nativeauthenticator
provided by 'mlhub' (https://github.com/ml-tooling/nativeauthenticator), I am able to create a new user with the usernameadmin
and a password of my choosing (despite the exception being thrown). Instructions relating to this are provided with theREADME.md
(https://github.com/ml-tooling/ml-hub#default-login).Further investigation of this issue has found that the call to
authenticate()
actually passes the username and password as separate positional arguments (https://github.com/ml-tooling/nativeauthenticator/blob/master/nativeauthenticator/handlers.py#L86), despite the method signature actually accepting these together as a dictionary (i.e. as a single positional parameter) (https://github.com/ml-tooling/nativeauthenticator/blob/master/nativeauthenticator/nativeauthenticator.py#L127).Changing the function signature from
def authenticate(self, handler, data):
todef authenticate(self, handler, username, password):
seems to address the issue, but I've noted this function hasn't been updated in the original repo from jupyterhub (https://github.com/jupyterhub/nativeauthenticator/blob/master/nativeauthenticator/nativeauthenticator.py#L127), and there are no issues I can find reporting this elsewhere, which I find somewhat surprising?@raethlein - any thoughts? I can raise a PR with the changes I've described above if that would be useful, but I'm not very familiar with Tornado/Jupyterhub auth so wanted to sanity check this with someone first?
Thanks for the reply.
Actually I did almost nothing, just pull out the docker image and find it failed to create account admin.
Extra try is not the point.
So to my knowledge the only thing infect the NativeAuthenticator
version is in the DockerFile.
Now I found the relavant part is: https://github.com/ml-tooling/ml-hub/blob/b96c316d67a8a183035496ccb05d92972e61f66a/Dockerfile#L96 commit hash matches with https://github.com/ml-tooling/nativeauthenticator/master.
Sorry my fault. Actually extra try is the key point, which leaves some old jupyterhub files I forgot to clean up. In another word, /data/ml-hub-data is actuall not empty, which caused that issue. Clean up the data folder solved the issue.
Oh, yes then the admin account probably already existed with a password. Thanks for the update! I am going to close this issue then.
Describe the bug:
I'd like to create a hub on a remote server. mlhub is running, but I failed to create any account, got this error
Expected behaviour:
I'd like to sign up a user called
admin
. No error in the server log.Steps to reproduce the issue:
docker run \ -p 8849:8080 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /data/ml-hub-data:/data \ mltooling/ml-hub:0.1.10
admin
for username andadminadmin
for password.admin
.admin
inside and outside the container, and set proper passwordTechnical details:
Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:24:18 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683