Internal server error when opening "settings" when Webdav password set (v7.1.5)

Hi

Since the update form 7.0.5 to 7.1.3, the “settings” page doesn’t work anymore when a user previously had set an Webdav password. If the user didn’t set one, the settings page works fine.

Error log:

2020-03-31 15:20:45,596 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /profile/
Traceback (most recent call last):
File “/home/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/home/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/home/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/home/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile/seafile-server-7.1.3/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/home/seafile/seafile-server-7.1.3/seahub/seahub/profile/views.py”, line 82, in edit_profile
decoded = UserOptions.objects.get_webdav_decoded_secret(username)
File “/home/seafile/seafile-server-7.1.3/seahub/seahub/options/models.py”, line 267, in get_webdav_decoded_secret
aes = AESPasswordHasher()
File “/home/seafile/seafile-server-7.1.3/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’

Still getting the error on 7.1.4:

[ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /profile/
Traceback (most recent call last):
File “/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/home/seafile/seafile-server-7.1.4/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile/seafile-server-7.1.4/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/home/seafile/seafile-server-7.1.4/seahub/seahub/profile/views.py”, line 82, in edit_profile
decoded = UserOptions.objects.get_webdav_decoded_secret(username)
File “/home/seafile/seafile-server-7.1.4/seahub/seahub/options/models.py”, line 267, in get_webdav_decoded_secret
aes = AESPasswordHasher()
File “/home/seafile/seafile-server-7.1.4/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’

Does anybody have an Idea?

@Jonathan ping

Any update on this?

Still the same Error in 7.1.5:

2020-10-08 08:38:45,138 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /profile/
Traceback (most recent call last):
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/profile/views.py”, line 82, in edit_profile
decoded = UserOptions.objects.get_webdav_decoded_secret(username)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/options/models.py”, line 267, in get_webdav_decoded_secret
aes = AESPasswordHasher()
File “/home/seafile/seafile-server-7.1.5/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’

I guess you did not remove fastcgi in seafdav.conf.

It is disabled. My config looks like this:

[WEBDAV]
enabled = true
port = 8080
fastcgi = false
share_name = /webdav

Pretty identical to the documentation (https://seafile.readthedocs.io/en/latest/config/seafile/seadav/)

You need to remove the line, not disable it. The documentation you linked is not the official one.

Take a look at the official documentation:

https://download.seafile.com/published/seafile-manual/extension/webdav.md

Yes sorry that was the wrong manual. I removed the line and restarted the services:

[WEBDAV]
enabled = true
port = 8080
share_name = /webdav

However the error is still present (seahub log):

[ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /profile/
Traceback (most recent call last):
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/home/seafile/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/profile/views.py”, line 82, in edit_profile
decoded = UserOptions.objects.get_webdav_decoded_secret(username)
File “/home/seafile/seafile-server-7.1.5/seahub/seahub/options/models.py”, line 267, in get_webdav_decoded_secret
aes = AESPasswordHasher()
File “/home/seafile/seafile-server-7.1.5/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’

Looking closer, the error states that it cannot find AES. Did you install cryptography as stated in https://manual.seafile.com/deploy_pro/adfs/?

sudo pip install cryptography

Yes it is installed:
[root@localhost ~]# pip3 install cryptography
Requirement already satisfied: cryptography in /usr/lib64/python3.6/site-packages (2.3)
Requirement already satisfied: idna>=2.1 in /usr/lib/python3.6/site-packages (from cryptography) (2.5)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3.6/site-packages (from cryptography) (0.24.0)
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.6/site-packages (from cryptography) (1.11.0)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in /usr/lib64/python3.6/site-packages (from cryptography) (1.11.5)
Requirement already satisfied: pycparser in /usr/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.7->cryptography) (2.14)

However, PyCrypt was not installed, after installing PyCrypt /profile worked again:
yum install gcc gcc-c++ python3-devel
pip3 install pycrypto