Seafdav can not login with seafile email and passwod, cause 401 (seafile-pro 8.0.11)

401 Access not authorized

seafdav log:

Is it really my email password wrong? or it has a default login id with a password?

seafdav.access.log

my nginx config follows:

Use account email not login id, there could be webdav specific password if your server is configured to use it instead account password, you would see that at seahub profile setting as “WebDav Password”, if you don’t see that there then webdav password is same as account password.

Whats your seafdav.conf file content ?

Thank you very much for your kind answers

seafdav.log:

seafdav.access.log

my seafdav.conf follows, is it any else have not configured?

    [WEBDAV]
    enabled = true

    port = 8080

    # fastcgi = false

    # share_name = /seafdav

    share_name = /drive

try this config:

log_format seafileformat '$http_x_forwarded_for $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_response_time';

location /drive { # trailing slash produce unnecessary implicit redirect
    set $dest $http_destination;
    #  you had wrong port 8888 instead 8080 in your config here you don't have to specify it
    if ( $dest ~* ^https?://[^/]+(?<destination_match>/drive/.+)$ ) { 
        set $dest $destination_match;
    }
    proxy_set_header           Destination $dest;
    proxy_pass                 http://127.0.0.1:8080/drive; # you were missing the share_name here
    proxy_set_header           Host $http_host; # variable $host does not contain port
    proxy_set_header           X-Real-IP $remote_addr;
    proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header           X-Forwarded-Host $server_name;
    proxy_set_header           X-Forwarded-Proto $scheme;
    proxy_read_timeout         1200s;
    client_max_body_size       0;
    proxy_buffering            off;
    proxy_request_buffering    off;

    # your logs seems old, to keep logings:
    access_log      /var/log/nginx/seafdav.access.log seafileformat; 
    error_log       /var/log/nginx/seafdav.error.log;
    # note that seafileformat has to be defined with log_format directive
}

:joy:
thanks~
I have try it and it is can not login too!
I use the port 8888 , because i have configed it in nginx listening ports.

have you restarted your nginx server ? what in your logs now ? btw in case your server is running long time, webdav is linked with both seahub and seafile server, when you change config in seafdav.conf you have to restart both.

yearh, i have restart the nginx and seafile-servers

seahub server too ? like this:

./seafile.sh stop
./seahub.sh stop
./seafile.sh start
./seahub.sh start

i’m mentioning this because i had strange issue before when one of the server perserved some information cached, stoping them both was required

now i see you had proxy_http_version in config before for good reason, its missing in the one i posted

2022-05-11 02:29:17.246 - <140207437379328> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:29:17] "GET /" elap=0.000sec -> 401 Not Authorized
2022-05-11 02:34:42.928 - <139986100471616> wsgidav.dc.seahub_db        INFO    :  Init seahub database...
2022-05-11 02:34:43.356 - <139986100471616> wsgidav.wsgidav_app         INFO    :  WsgiDAV/3.0.4 Python/3.8.10 Linux-5.4.0-109-generic-x86_64-with-glibc2.29
2022-05-11 02:34:43.357 - <139986100471616> wsgidav.wsgidav_app         INFO    :  Lock manager:      LockManager(LockStorageDict)
2022-05-11 02:34:43.357 - <139986100471616> wsgidav.wsgidav_app         INFO    :  Property manager:  None
2022-05-11 02:34:43.357 - <139986100471616> wsgidav.wsgidav_app         INFO    :  Domain controller: SeafileDomainController()
2022-05-11 02:34:43.357 - <139986100471616> wsgidav.wsgidav_app         INFO    :  Registered DAV providers by route:
2022-05-11 02:34:43.357 - <139986100471616> wsgidav.wsgidav_app         INFO    :    - '/:dir_browser': FilesystemProvider for path '/opt/seafile/seafile-pro-server-8.0.11/seahub/thirdpart/wsgidav/dir_browser/htdocs' (Read-Only)
2022-05-11 02:34:43.358 - <139986100471616> wsgidav.wsgidav_app         INFO    :    - '/drive': SeafileProvider for Seafile (Read-Write)
2022-05-11 02:34:43.358 - <139986100471616> wsgidav.wsgidav_app         WARNING :  Basic authentication is enabled: It is highly recommended to enable SSL.
2022-05-11 02:34:43.358 - <139986100471616> wsgidav                     WARNING :  Could not import lxml: using xml instead (up to 10% slower). Consider `pip install lxml`(see https://pypi.python.org/pypi/lxml).
2022-05-11 02:34:55.150 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:34:55] "GET " elap=0.000sec -> 401 Not Authorized
2022-05-11 02:34:56.330 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:34:56] "GET " elap=0.000sec -> 401 Not Authorized
2022-05-11 02:34:59.670 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:34:59] "GET " elap=0.000sec -> 401 Not Authorized
2022-05-11 02:35:16.465 - <139986053109504> wsgidav.dc.domain_controller WARNING :  Failed to login: type object 'constance_config' has no attribute 'constance_key'
2022-05-11 02:35:16.466 - <139986053109504> wsgidav.http_authenticator  WARNING :  Authentication (basic) failed for user xxx.gmail.com', realm 'Seafile Authentication'.
2022-05-11 02:35:16.466 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:35:16] "GET " elap=0.004sec -> 401 Not Authorized
2022-05-11 02:35:19.754 - <139986053109504> wsgidav.dc.domain_controller WARNING :  Failed to login: type object 'constance_config' has no attribute 'constance_key'
2022-05-11 02:35:19.755 - <139986053109504> wsgidav.http_authenticator  WARNING :  Authentication (basic) failed for user 'xxx.gmail.com', realm 'Seafile Authentication'.
2022-05-11 02:35:19.755 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:35:19] "GET " elap=0.001sec -> 401 Not Authorized
2022-05-11 02:35:21.099 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:35:21] "GET " elap=0.000sec -> 401 Not Authorized
2022-05-11 02:37:15.783 - <139986053109504> wsgidav.wsgidav_app         INFO    :  127.0.0.1 - (anonymous) - [2022-05-10 18:37:15] "GET /" length=0, elap=0.000sec -> 401 Not Authorized

update logs please

in your logs you are trying to access the /seafdav instead /drive

$ ./seafile.sh start

** Message: 02:34:31.227: seafile-controller.c(932): loading seafdav config from /opt/seafile/conf/seafdav.conf

2022-05-11 02:34:31 ../common/seaf-utils.c(409): Use database Mysql

2022-05-11 02:34:31 http-server.c(230): fileserver: worker_threads = 10

2022-05-11 02:34:31 http-server.c(243): fileserver: backlog = 32

2022-05-11 02:34:31 http-server.c(258): fileserver: fixed_block_size = 2097152

2022-05-11 02:34:31 http-server.c(273): fileserver: web_token_expire_time = 3600

2022-05-11 02:34:31 http-server.c(288): fileserver: max_indexing_threads = 10

2022-05-11 02:34:31 http-server.c(303): fileserver: max_index_processing_threads= 3

2022-05-11 02:34:31 http-server.c(325): fileserver: cluster_shared_temp_file_mode = 600

2022-05-11 02:34:31 http-server.c(403): fileserver: enable_async_indexing = 0

2022-05-11 02:34:31 http-server.c(415): fileserver: async_indexing_threshold = 700

2022-05-11 02:34:31 http-server.c(427): fileserver: fs_id_list_request_timeout = 300

2022-05-11 02:34:31 http-server.c(440): fileserver: max_sync_file_count = 100000

Starting seafile server, please wait ...

** Message: 02:34:31.258: seafile-controller.c(932): loading seafdav config from /opt/seafile/conf/seafdav.conf

Seafile server started

Done.

$ ./seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8

Starting seahub at port 8000 ...

Seahub is started

Done.

do you have enabled two factor authentication ?


i have used the default config, everthing as before.

two factor authentication i have not configured

in the proxy_pass http://127.0.0.1:8080/drive; the /drive is share_name and it must match the share_name = /drive in seafdav.conf, in case you are trying original “seafdav” nginx config, btw the original will not work since you are using ssl

but the error in your log “Failed to login: type object ‘constance_config’ has no attribute ‘constance_key’” is related to the seahub web settings itself when there is check for two factor authorization

you could try to enable and disable two factor authorization or adding ENABLE_SETTINGS_VIA_WEB = False to the seahub_settings.py to test if anything changes

1 Like

Great,! It is working now!

Thank you very much!Thank you for your enthusiastic help

This is the right answer:

Adding ENABLE_SETTINGS_VIA_WEB = False to the seahub_settings.py

The nginx config follows:

      location /drive { # trailing slash produce unnecessary implicit redirect
              set $dest $http_destination;
              #  you had wrong port 8888 instead 8080 in your config here you don't have to specify it
              if ( $dest ~* ^https?://[^/]+(?<destination_match>/drive/.+)$ ) {
                  set $dest $destination_match;
              }
              proxy_set_header           Destination $dest;
              proxy_pass                 http://127.0.0.1:8080/drive; # you were missing the share_name here
              proxy_set_header           Host $http_host; # variable $host does not contain port
              proxy_set_header           X-Real-IP $remote_addr;
              proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header           X-Forwarded-Host $server_name;
              proxy_set_header           X-Forwarded-Proto $scheme;
              proxy_read_timeout         1200s;
              client_max_body_size       0;
              proxy_buffering            off;
              proxy_request_buffering    off;
          }

i would say its just partial solution, you disabled convenient way of setting your server via web, guess the real issue could be: unapplied update script, bug in server application or data corruption, its definitely kind of internal error, unrelated to configuration. changelog seems to not mention anything directly related to this, but update worth a try (even for other reasons like security etc).

yeah, the error is caused by my poor understanding of the seafile configuration, even 2fa i am still not good at~