Subject: Anyone interested in integrating this into the wu-ftpd code?

From: Steve van der Burg <[email-masked]>
Date: Wed, 16 Dec 1998 16:22:56 -0500

[ A long-winded message follows that asks: "Does anyone
else think that giving wu-ftpd the ability to use a modified
"guest" user type, where authentication is done against a
database that can be manipulated via non-root CGI processes
(ie. a web interface), is useful?"  I've added just that (to
wu-ftpd 2.42-beta18) and it's pretty handy for me. ]

First, thanks to all the people who work on, and have worked
on, the wu-ftpd code.  A few months ago, I went out on a limb
and said (to the company that I work for) that I would:

  i) throw away a vendor's ftpd (the Solaris 2.6 daemon)
 ii) grab source for a more configurable, logging, and
     (more) securable ftp server and get it running
iii) hack a "leased, non-anonymous" ftp account feature
     into it, with a web interface.

(i) and (ii) were easy -- the build, install and configure
documentation for wu-ftpd 2.42-beta18 is pretty good, so it
didn't take long.

(iii) is now done.  To explain further:

   I liked that wu-ftpd supported three types of users -- real,
anonymous, and guest.  The "guest" user type was close to
what I wanted -- guests could be pinned down (chroot()ed and
chdir()ed) and weren't anonymous.
What I wanted to do was give users where I work the ability to
"grant" (ie. create) guest ftp accounts that would exist for a
limited time only.  We deal a lot with vendors and other
companies, etc, that don't run their own FTP servers, but
need to exchange files with people at my company. 
Everybody's got privacy concerns -- the vendors and users --
and none of them are savvy enough to be able to use
anonymous FTP set up in a "you can put and get, but you
can't get a list of files" security-through-obscurity
configuration.
I also couldn't have anyone telnetting to my ftp server to
create or edit users (to set passwords, etc), and didn't want
to bother with setting up setuid (root!) scripts to make it
easier, or use sudo, or all the other things that I've done when
regular users need to do administrative-type things.

In short (except I can't seem to handle "short" today!), I
wanted:

- to predefine a bunch of ftp-only (no shell) guest users with
locked accounts, and have a little web application that users
could grant "leases" -- credentials to use with the ftp
accounts that expired after a given time -- with.
- create a mechanism that expired the leases, killed ftp
daemons that were connected with an expired lease, delete
all the files associated with a lease, etc.

I implemented this by hacking wu-ftpd in the following way:

ftpd.c:
- adding a clone of checkuser() that checks another file that
lists "leasable" users
- hacking in a check of submitted credentials against those
stored in a gdbm database for a "leased" account
- hacking in some extra logging (again into a database) that
lets lease-granting users see when their leased accounts
have been accessed, and from where.

elsewhere:
- hacking in references to pathnames for database files
- adding in all the necessary compiler and linker stuff to get
gdbm linked into the server

Once that was done, the web interface was created, in Perl. 
It does just two things:
- grants new leases by generating ugly, hard-to-guess
passwords, encrypting them and storing them in the lease
credentials database.
- shows access information on leases

Also, another process, running as root and launched
periodically by cron, checks for expired leases, kills any ftp
daemons associated with a just-expired lease, cleans up an
expired lease user's home directory, etc, and then flags that
the lease user is ready to be reused.

- - -

That was all hacked together in a couple of days, and is
working very well.  For me to submit it as a patch, I'd need to
put #ifdef blocks around all my code (right now I've got
comments with my initials around everything) and write some
real documentation for it.

My question is:  Would anyone else like to see it?  Or try it
out?  Or integrate it into the code a bit better (with ftpaccess
support, for instance)?  It fills an obvious need at the
company where I work, but I don't know how useful it is to
anyone else.

Sorry for the rambling message.  I don't seem to be able to
write any other way today.

...Steve
--
Steve van der Burg
Technical Analyst, Information Services
London Health Sciences Centre
London, Ontario, Canada
[email-masked]