Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The htpasswd authentication provider fails on windows (crypt module is not supported on windows) #417

Closed
weis opened this issue Mar 24, 2021 · 2 comments

Comments

@weis
Copy link

weis commented Mar 24, 2021

We are not able to implement the htpasswd authentication on windows.
With the server configuration part

  "auth": {
    "type": "htpasswd",
     "htpasswd_path": "<PATH_TO>\\.htpasswd"
  }

we got after running launcher.py:

ModuleNotFoundError: No module named '_crypt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "launcher.py", line 11, in <module>
    main.main()
  File "src\main.py", line 81, in main
    server_config = server_conf.from_json(SERVER_CONF_PATH, TEMP_FOLDER)
  File "src\model\server_conf.py", line 104, in from_json
    config.authenticator = create_authenticator(auth_config, temp_folder)
  File "src\model\server_conf.py", line 159, in create_authenticator
    from auth.auth_htpasswd import HtpasswdAuthenticator
  File "src\auth\auth_htpasswd.py", line 1, in <module>
    import crypt
  File "C:\Users\demdevwin\AppData\Local\Programs\Python\Python39\lib\crypt.py", line 9, in <module>
    raise ImportError("The crypt module is not supported on Windows")
ImportError: The crypt module is not supported on Windows

What can we do ?

bugy added a commit that referenced this issue Mar 24, 2021
@bugy
Copy link
Owner

bugy commented Mar 24, 2021

Hi @weis, I made a fix, which is available in dev version.
If you would like to stay on stable version, then I would suggest installing htpasswd utility on the machine, where script server is running (and restart the script server instance).

@bugy bugy added the bug label Mar 24, 2021
@bugy bugy added this to the 1.17.0 milestone Mar 24, 2021
@bugy bugy added the resolved label Mar 24, 2021
@weis
Copy link
Author

weis commented Mar 24, 2021

Hi, thank you for the very fast answer.
It's running!
One notice: i have to remove comments (lines beginning with a #) from the htpasswd file.
Otherwise an error occured:

File "src\auth\auth_htpasswd.py", line 124, in _parse_htpasswd
    (username, password) = line.split(':', 1)
ValueError: not enough values to unpack (expected 2, got 1)

@weis weis closed this as completed Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants