I have a workstation with Ubuntu 18.04.3 LTS. And I have a remote server with nginx + WebDAV. (It's under FreeBSD but it doesn't seem important.) I configured mounting of the webdav share on my workstation using this manual. And everything has been working very well.
But, the other day, I found out that it stopped working :( It looked like a mounting error:
$ sudo mount -t davfs https://site.domain.com:8888 /mnt/RemoteStorage/
Please enter the username to authenticate with server
https://site.domain.com:8888 or hit enter for none.
Username: myuser
Please enter the password to authenticate user myuser with server
https://site.domain.com:8888 or hit enter for none.
Password:
/sbin/mount.davfs: mounting failed; the server does not support WebDAV
And everything looked normal on the server side:
123.45.67.89 - - [16/Nov/2019:23:29:53 +0300] "OPTIONS / HTTP/1.1" 401 179 "-" "davfs2/1.5.4 neon/0.30.2" "-"
123.45.67.89 - myuser [16/Nov/2019:23:29:53 +0300] "OPTIONS / HTTP/1.1" 200 0 "-" "davfs2/1.5.4 neon/0.30.2" "-"
We see that the client sent a request without auth firstly, then it got rejecting (401), then it repeated the request with auth and got OK (200). The behavior seems to be regular.
I turned on the davfs2 debug and saw the following in the log (quoting from the moment of getting 401):
..
Nov 16 21:38:36 Station2 mount.davfs: auth: Got challenge (code 401).
Nov 16 21:38:36 Station2 mount.davfs: auth: Got 'Basic' challenge.
Nov 16 21:38:36 Station2 mount.davfs: auth: Trying Basic challenge...
Nov 16 21:38:36 Station2 mount.davfs: auth: Accepted Basic challenge.
Nov 16 21:38:36 Station2 mount.davfs: Running pre_send hooks
Nov 16 21:38:36 Station2 mount.davfs: auth: Sending 'Basic' response.
Nov 16 21:38:36 Station2 mount.davfs: Sending request headers:#012OPTIONS / HTTP/1.1#015#012User-Agent: davfs2/1.5.4 neon/0.30.2#015#012Keep-Alive: #015#012Connection: TE, Keep-Alive#015#012TE: trailers#015#012Host: site.domain.com:8888#015#012Authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 16 21:38:36 Station2 mount.davfs: Sending request-line and headers:
Nov 16 21:38:36 Station2 mount.davfs: Request sent; retry is 1.
Nov 16 21:38:36 Station2 mount.davfs: [status-line] < HTTP/1.1 200 OK
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Server: nginx/1.16.1
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [server], Value: [nginx/1.16.1]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Date: Sat, 16 Nov 2019 18:38:36 GMT
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [date], Value: [Sat, 16 Nov 2019 18:38:36 GMT]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Content-Length: 0
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [content-length], Value: [0]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Connection: keep-alive
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [connection], Value: [keep-alive]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] DAV: 2
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [dav], Value: [2]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Allow: GET,HEAD,PUT,DELETE,MKCOL,COPY,MOVE,PROPFIND,OPTIONS,LOCK,UNLOCK
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [allow], Value: [GET,HEAD,PUT,DELETE,MKCOL,COPY,MOVE,PROPFIND,OPTIONS,LOCK,UNLOCK]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Expires: Thu, 31 Dec 2037 23:55:55 GMT
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [expires], Value: [Thu, 31 Dec 2037 23:55:55 GMT]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Cache-Control: max-age=315360000
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [cache-control], Value: [max-age=315360000]
Nov 16 21:38:36 Station2 mount.davfs: [hdr] Allow: OPTIONS, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND
Nov 16 21:38:36 Station2 mount.davfs: Header Name: [allow], Value: [OPTIONS, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND]
Nov 16 21:38:36 Station2 mount.davfs: [hdr]
Nov 16 21:38:36 Station2 mount.davfs: End of headers.
Nov 16 21:38:36 Station2 mount.davfs: Running post_headers hooks
Nov 16 21:38:36 Station2 mount.davfs: Running post_send hooks
Nov 16 21:38:36 Station2 mount.davfs: ah_post_send (#1), code is 200 (want 401), WWW-Authenticate is (none)
Nov 16 21:38:36 Station2 mount.davfs: Request ends, status 200 class 2xx, error line:#012200 OK
Nov 16 21:38:36 Station2 mount.davfs: Running destroy hooks.
Nov 16 21:38:36 Station2 mount.davfs: Request ends.
It turns out that the client repeated the request with auth but 'forgot' about it and, having received the answer 200, recognized it wrong because it was expecting 401.
What's wrong with all this?
P.S. I have installed davfs2 1.5.4-2. The other day, I've made an update of Ubuntu software but this package hasn't been updated (I saw in the apt logs).
P.P.S. Alse, I have WebDAV clients on Android and Windows. They use that share successfully.
0 Answers