haiwen / seafile-docker

A Docker image for Seafile server
Other
545 stars 184 forks source link

Install pycryptodome for ENABLE_WEBDAV_SECRET on CE #265

Closed AlexVonB closed 2 years ago

AlexVonB commented 3 years ago

Hi! When using Seafile 8.0.7 Docker, enabling ENABLE_WEBDAV_SECRET and then trying to set a WebDAV password, I get the error

[ERROR] django.request:222 log_response Internal Server Error: /seafile/api/v2.1/webdav-secret/
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/rest_framework/views.py", line 505, in dispatch
    response = self.handle_exception(exc)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/rest_framework/views.py", line 465, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/rest_framework/views.py", line 476, in raise_uncaught_exception
    raise exc
  File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/rest_framework/views.py", line 502, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-8.0.7/seahub/seahub/api2/endpoints/webdav_secret.py", line 44, in put
    aes = AESPasswordHasher()
  File "/opt/seafile/seafile-server-8.0.7/seahub/seahub/utils/hasher.py", line 39, in __init__
    self.cipher = AES.new(secret.encode('utf-8'), AES.MODE_ECB)
AttributeError: 'NoneType' object has no attribute 'new'

which seems to indicate that pycryptodome, as documented in https://manual.seafile.com/config/seahub_settings_py/, is not present. Should the Docker image include this package? The pro images seem to include the package, the ce images do not.

Best, Alex

I also reported this here

AlexVonB commented 3 years ago

Super hacky workaround after every reboot:

docker-compose exec seafile /bin/bash
pip install pycryptodome
./seafile-server-latest/seahub.sh stop
./seafile-server-latest/seafile.sh stop
./seafile-server-latest/seafile.sh start
./seafile-server-latest/seahub.sh start
AlexVonB commented 2 years ago

This seems to be closed for 9.0 images with d858eace0e417520ad443aad2eb6d5c3dffd56c0, thanks!