Sunday, April 26, 2009
WebDAV, problems all around
It seems almost incomprehensible how many problems emerge with simple WebDAV file hosting. While apache DAV server, and clients built-in into both Windows Shell and GNOME have been available fr many years, I still can't make it to work properly.
Here is a brief list of problems:
Apache 2 Server. Its problem is that it is bit difficult to make server work with both "resular" and SSL modes. This typically emerges as failure to "copy", "move" or "rename" file in non-SSL mode, while everything else seems to work.
Good explanation is available here:
The main issue was that the production system runs on https and there was a reverse proxy setup for this system. So, all the "https" requests were converted to "http" at this proxy level and forwarded to the main system. This was the main culprit.
Here is an example of HTTP request for the MOVE resource request for a WebDAV resource. For brevity I removed all unnecessary details.
MOVE contentLocation //request line, some https location, URI of webDAV resource
Destination:destinationLocation // this is the HTTP request header, should be absolute URI according to specifications.Overwrite: "F" // this is also a HTTP request header
So, when the reverse proxy sees the request line, it knows that it has to convert this to HTTP request but the header Destination also contains an HTTPS request which would be ignored by the proxy. So, when the request reached the server, we are moving the resource from an URI which begins with a http to a URI which begins with an https. Server treats this request as a request to move a WebDAV resource from one server location to another server location.(Refer RFC: http://greenbytes.de/tech/webdav/rfc2518.html#METHOD_MOVE). This was the source of the main problem.
Linux/GNOME GVFS driver: Seems to work most of the time,but
- Fails to handle paths with user name "davs://username@server.com/path". "Top listing" is shown correctly, but an attempt to change directory fails. Reason unknown;
- When using drag-and-drop, or "cut/paste" interface, it attempts to "copy" file and then "delete" the original. I could not find any way to invoke "MOVE" command.
Windows (old driver). This is "old" Windows-2000 implementation, which identifies itself as "Microsoft Data Access Internet Publishing Provider DAV". This seems almost the most reliable implementation, and it worked for me for a while, but now it shows directory "Temp" as "temp" (all other directories similarly named are OK), and obviously fails to chdir to it. Reason unknown.
Windows (new driver, XP and newer). Identifies itself as "Microsoft-WebDAV-MiniRedir/5.2.3790". Apparently only intended to work with Microsoft IIS, not compatible with Apache. This pages gives a consice overview:
For implementation of WebDAV on Windows XP and later , MSFT made it's own interpretation of the standard to work best with the Windows IIS servers. The problem due to this is three fold:
- Windows XP authenticates users using the format "domain\username" by the mechanism of "Microsoft-WebDAV-MiniRedir/5.1.2600". Whereas Windows 98SE/2000 authenticates users as "username" using the mechanism of "Microsoft Data Access Internet Publishing Provider DAV 1.1".
- The problem lies with the implementation of "Microsoft-WebDAV-MiniRedir/5.1.2600". If authentication is sent as "domain\username" then it would be received as "usernamedomain" or "usernamehostname" by the Web server and not as "username".
- Also as per "Microsoft Knowledge Base, Article ID: 841215" Windows XP disables "Basic Auth" in its "Microsoft-WebDAV-MiniRedir/5.1.2600" mechanism by default for security reasons. But WebDAV expects "Basic Auth".
There are hundreds pages how to trick it to invoke "old" implementation, including some on the same page mentioned above; there is also a separate discussion regarding Windows Vista, where "old" implementation has to be separately installed. Windows 7 status is unknown.
Platform-independent clients.
- SkunkDAV Java-based client is simple and reliable, but unfortunately I could not make it support SSL-based access;
- Cadaver is CLI-based tool. It seems to work fine.
Update (12-May-09). "Official" subversion book has a list of DAV clients. Among some known clients, some of them mentioned above, there is another Jaba-based client "DAV Explorer", it has been last updated in 2005 and looks a bit better than SkunkDAV, though I can't say there is a big difference.
Also, its help file says that in order to enable SSL in Java one has to run Java with -Dssl=true, and only from version 1.4 on; for earlier versions, one has to download special Java Secure Socket Extensions. It is likely with if run with these options, SkunkDAV will work ok with SSL DAV.
Labels: GNOME, linux, server, Ubuntu, web-services, windows
Wednesday, October 01, 2008
Mounting USB devices under Linux
For some reason, Ubuntu/Gnome often fails to mount properly USB drives when plugged-in. It is not hard to mount them manually, as long as user has super-user access and remembers necessary commands and options.
To mount anything, one has to know name of corresponding "device" file in "/dev"; under modern Linux, these are typically "/dev/sdc1", "/dev/sdd1", etc.
For some peculiar reason, there is no single utility which would print simple map "Name/manufacturer of USB disk => device file". Rather, there are four utilities which together allow user to accomplish this task:
- "lshw" is the only utility I know of which can print device names. To do that, run it like that:
sudo lshw -businfo | fgrep volume
- "lsusb" can print information about all USB devices (a lot of information with "-v"), including enough hints to identify specific device. It could be used both in "super user" mode and "regular user" mode;
- "fdisk -l" (super-user mode only) can print information about a device (if you have guessed its name).
- Finally, when you have figured out device name and file system type (FAT or NTFS), you run mount in super-user mode like that:
mount -t [vfat|ntfs] <device name, e.g. /dev/sdc1> <empty directory, e.g. /media/mydisk> -o \ rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flushOptions can be adjusted, I believe above is what Gnome uses by default when mount is successful
[sudo] lsusb [-v] sudo fdisk -l /dev/sdc1 sudo lshw -businfo sudo mount -t [vfat|ntfs] /dev/sdc1 /lacie -o rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush
Labels: GNOME, linux, Ubuntu, USB
