Opened at 2008-09-10T20:22:45Z
Last modified at 2021-03-30T18:40:19Z
#512 assigned defect
FTP frontend needs tests — at Version 23
Reported by: | warner | Owned by: | davidsarah |
---|---|---|---|
Priority: | major | Milestone: | soon |
Component: | code-frontend-ftp-sftp | Version: | 1.2.0 |
Keywords: | ftpd test | Cc: | |
Launchpad Bug: |
Description (last modified by daira)
Peter says it would be really useful for us to offer an FTP frontend. This could be done outside the node (in some sort of bridge process, or via a FUSE layer), but I'm currently thinking that it would work best if it were inside the node.
Twisted has some ftp server support, but I haven't looked at it in a long time. My thoughts are:
- add a config knob to the tahoe node that turns on FTP support.
- add an authorization mechanism: a table that maps username/password to rootcap. It should be possible to configure this to use the allmydata PHP-based login mechanism instead.
Change History (23)
comment:1 Changed at 2008-09-10T20:25:38Z by warner
comment:2 Changed at 2008-10-02T01:21:33Z by warner
cool, Twisted's FTP support is pretty good (although this is in SVN trunk, and it hasn't been released yet). I was able to get a little server running inside a Tahoe node this afternoon, with LIST and GET functionality working.
Next steps:
- make GET be streaming instead of the current hack of holding everything in RAM
- add PUT, and the other commands (MKDIR, RM, MV)
- add an authentication mechanism that either uses a local file of (username, password, rootcap) tuples, or a URL that points to the allmydata.com -style PHP server which accepts (username,password) and returns a rootcap
- add unit tests, ftp-client-to-self, disabled unless twisted.vfs is available
And then I want to consider adding per-user dirnode caching, with some simple safety rules like 'flush the whole cache if a MV command is performed'. That should make things pretty snappy.
comment:3 Changed at 2008-10-02T01:33:02Z by zooko
Sweet! Do you know when to expect the next Twisted release?
comment:4 Changed at 2008-10-07T01:57:58Z by warner
Nope, unfortunately. http://twistedmatrix.com/trac/roadmap suggests January for the 8.2 release (which would really make it the 9.1 release), but I suspect that their roadmap is about as unrelated to reality as our own...
incidentally, I just pushed the code to trunk. It has full upload/download/mkdir/rm/mv support, and offers two different authentication mechanisms: a file of username/password/rootcap, or a URL of a server that works like peter's native_client.php (the one that Allmydata uses for customer authentication).
What's missing:
- unit tests
- possible caching, but I'm not going to implement that until we get some experience with it and can decide if it is Fast Enough. Local testing (on my workstation, against the prodnet grid) makes me think that it might be fast enough, although it's worth noting that my 'ncftp' client is doing some fairly aggressive caching of its own.
comment:5 Changed at 2008-10-09T00:36:54Z by warner
An update on the FTP server: we're running a test instance on a public machine against the prodnet grid. BSD ftp and ncftp appear to work well, but we're having problems getting the Mac OS-X Finder's "Connect To Server" ftp client to work: it looks like the client is not correctly connecting to the PASV-mode data port.
It would be really cool to get OS-X to connect to this, since that would make native access to files work really well.
comment:6 Changed at 2008-10-09T19:03:53Z by warner
The wait-for-upload patch is in Twisted ticket #3462 .. if someone else could review it, we could probably get it committed, and the next release of Twisted will make deploying the tahoe FTP server a lot easier.
comment:7 Changed at 2008-10-09T19:07:43Z by warner
An update on compatibility: Apparently the OS-X Finder works if you don't have an "@" character in the username. Since Allmydata uses email addresses as account names, we might need to provide some sort of username-mangling function, like, translate "*" or "#" or "~" or something into an "@" before sending the username to the native_client.php service. We want to make sure that ftp: URLs work too, if there is even a spec for them, since "@" is probably used to separate the username from the hostname.
However, Peter and Zandr report that the OS-X FTP mounting code is read-only! Bummer! This was looking so promising. There are plenty of good FTP clients for the Mac, but I was hoping that we could use FTP to provide a simple virtual-drive that was available for all applications.
The Windows FTP mounting code is read-write, and it sounds like it works pretty well.
comment:8 Changed at 2008-10-09T19:50:11Z by zandr
So, some digging around this morning, I've learned the following:
The Mac OS X mount_ftp command is read only. This has been a source of much wailing and gnashing of teeth on the intarwebs, but apparently not enough to cause either apple or anyone else to write a r/w replacement. :)
Indeed, changing my email address in the database from zandr@… to zandr-allmydata-com allowed the mac to mount the tahoe/ftp server. I'm not sure this is tied to the URL handling stuff, since the mac uses anonymous / cfnetwork@… as a user/pass combo for anonymous FTP.
So, if FTP doesn't work for the mac, that leaves us a couple of alternatives:
WebDAV: Horrid. Run Away. Has the benefit of being well supported by Apple for iDisk.
SFTP: Interesting. Well supported by standalone ftp clients, and it appears that sshfs is actually more like sftpfs. Also, as RobK pointed out, easy to implement alongside FTP in twisted.
I fired up MacFuse? and sshfs on my machine pointed at my linux box in colo. Aside from some oddities about getting the drive to show up in the finder (has to be mounted -o local to appear, though I think RobK might know some other magic) it seems pretty solid.
Looking at top on the linux box, it appears that sshfs is using SFTP for the heavy lifting:
5891 n6mod 20 0 69464 3104 1052 S 0 0.2 0:01.00 sshd: n6mod@notty 5892 n6mod 20 0 40036 1992 1300 S 0 0.1 0:00.19 /usr/lib/openssh/sftp-server
So, I think the next step is going to be to run sshfs against an sshd with logging turned up to 11 to see how sshfs works. But I'm out of time for today.
comment:9 Changed at 2008-10-09T20:05:13Z by zandr
OK, I lied. I had to look.
sshfs connects and immediately requests the SFTP subsystem.
So I think that's a win, actually.
comment:10 Changed at 2008-10-09T21:33:31Z by warner
zandr: so can the Finder natively mount SFTP as a virtual disk? Or do you have to install MacFuse and sshfs to enable that?
Peter reports that OS-X claims to support the following prefixes in the "Connect To Server" list:
- afp, at, file, ftp, http, https, nfs, smb, cifs, vnc
Which I guess excludes SFTP natively.
Hrm, maybe it's time to implement an Appletalk File Protocol server.. how card could it be? :-)
comment:11 Changed at 2008-10-10T17:14:22Z by zandr
warner: No, Yes.
SFTP does not work natively. If we want native write access from Macs, I vote for WebDAV. Yeah, it sucks, but not as badly as trying to wire Tahoe into the back of Samba.
But it would be trivial to build up an installer that dropped in MacFuse? and sshfs. In fact, the stock MacFuse? installer works great, we'd just need to add the sshfs binary, which is currently separate. Add some gratuitous icons and a mount script, and you're good to go. :)
comment:12 Changed at 2008-10-10T17:19:31Z by zandr
I should add for those playing along at home, this is not the same thing as building a FUSE<>Tahoe interface. This is using FUSE to present sftp to the Finder. sshfs dates back to LUFS, and is pretty robust these days. It was quite responsive connecting to my box in colo from home, much more so than iDisk, for example.
comment:13 Changed at 2009-01-23T20:37:10Z by warner
Incidentally, rfc-2640 describes how internationalization ought to be done for FTP. We currently have problems handling non-ascii characters in the FTP interface: Tahoe expects/provides UTF-8, but I imagine that without the "FEAT" feature test, a correctly-written client will not provide/handle it. I don't know if the FEAT command is something that's feasible for us to add, or if we'd need to wait for Twisted to provide it.
comment:14 Changed at 2010-01-15T02:44:00Z by davidsarah
- Keywords test added
http://twistedmatrix.com/trac/ticket/3462 is waiting for unit tests.
comment:15 Changed at 2010-02-06T04:13:31Z by zooko
Ed Pimentl and Jack Lloyd are offering bounties for SFTP: http://allmydata.org/pipermail/tahoe-dev/2010-February/003807.html
comment:16 Changed at 2010-02-06T04:14:49Z by zooko
Ticket #531 is about SFTP, this ticket is about FTP.
comment:17 Changed at 2010-02-07T16:43:10Z by davidsarah
- Keywords ftpd added; ftp removed
- Milestone changed from undecided to 1.7.0
- Summary changed from FTP frontend to FTP frontend needs tests
- Type changed from enhancement to defect
comment:18 Changed at 2010-04-13T17:55:08Z by davidsarah
- Milestone changed from 1.7.0 to 1.8.0
Not a priority for 1.7, but the SFTP tests (#531) are. We can then port those to FTP for 1.8.
comment:19 Changed at 2010-06-21T00:24:29Z by davidsarah
- Milestone changed from 1.8.0 to 1.7.1
- Owner set to davidsarah
- Status changed from new to assigned
comment:20 Changed at 2010-07-11T21:32:17Z by davidsarah
- Milestone changed from 1.7.1 to soon
comment:21 Changed at 2012-03-31T00:07:06Z by lebek
The beginnings of a unit test for the FTP frontend are contained in a patch at #1688, but this patch only tests timestamps returned by the FTP LIST command. It does not test that a file added via FTP (rather than by the internal Python API) is created with the right timestamp, so this ticket should incorporate that (along with tests for all the remaining commands).
comment:22 Changed at 2012-04-01T00:57:16Z by davidsarah
- Milestone changed from soon to 1.11.0
comment:23 Changed at 2013-08-13T22:52:12Z by daira
- Description modified (diff)
- Milestone changed from 1.11.0 to 1.12.0
zooko suggests we look into pyftpdlib (which is asyncore-based), since it's mature and well-supported