Subject: Complete Virtual Server support

From: Kent Landfield <[email-masked]>
Date: Wed, 23 Apr 1997 23:32:10 -0500 (CDT)

Once again, a period of frustration leads me to tinkering... ;-)

There are quite a few things that would be nice to have supported in 
virtual servers.  In the current baselined version, virtual servers 
are only partially supported.  The current implementation of virtual 
servers only supports setting

	- the root ftp directory, 
	- the log file and
	- the banner.

All other directives in the ftpaccess file have to be shared globally 
across all virtual servers.  A real limitation if you wanted to have 
different features supported by different servers...

In reviewing how virtual servers were implemented, I reread the virtual 
server setup FAQ.  There are two different methods documented.  First is 
the VIRTUAL support that is a part of the current beta-13 baseline.  It 
only supports the three ftpaccess file directives listed above.  The other 
method is the alternative method which requires tcpwrappers.  It then 
dawned on me that the answer to completely supporting virtual servers 
was right in front of me.

Why couldn't I simply specify which ftpaccess file to use ?  If I could do 
that then maybe it wouldn't be a major task to add support for all access 
file directives (which is basically what Karl achieved using tcpwrappers).

If changes were made to access_init() to determine which ftpaccess file to 
use (instead of the hard-coded _PATH_FTPACCESS) then all the existing acl 
features could be available to each individual virtual server.  No need for 
tcpwrappers. Support for completely independent access files should be easy
to add.

So that's how I spent Tuesday night... ;-)

Here's what I did...  First I created a new file called "ftpservers" defined
by the path _PATH_FTPSERVERS.  The file is optional so if it's missing, the 
original ftpaccess (_PATH_FTPACCESS) file is used.  An ftpservers file looks
like the following:

#
# ftpservers file
#
# Format:
#  ip-address      associated-ftpaccess-file
#
# ftpaccess file for the landfield.com domain
#
208.196.145.2	/etc/ftpd/ftpaccess
#
# ftpaccess file for the faqs.org domain
#
208.196.145.20  /etc/ftpd/ftpaccess.faqs.org
#
# ftpaccess file for the some.other domain
#
208.196.145.55  /etc/ftpd/ftpaccess.some.other

In access_init() I included a call to a new function "getaccessfilename()"
that looks up the access file based on the socket address the user is
coming in on.  The found file is then passed to readacl() as the hard-coded
_PATH_FTPACCESS was before.  Other than a minor tweak, that was all that
was needed.  Complete virtual ftpaccess support... I am currently running it 
here and it seems to work just fine. It is amazing how clear things become 
when you take the time to study the code... ;-)

I made the associated changes to ftpshut, ckconfig and my new ftprestart.  
The only program in the wu-ftpd suite that does not have the new virtual 
access file support is ftpcount.  Have to get to that tomorrow night. ;)

Besides allowing any virtual server to be able to set and use any ftpaccess
file directive, an additional benefit is that any future extensions Stan adds 
to the ftpaccess file will be automatically supported for virtual servers as 
well. Free.

All my changes were made to the latest beta-13.  (If Stan brings out beta-14 
in the next few days, I'll be re-incorporating them into that.  It'll be 
much easier now. ;-))

I plan on sending these to Stan for inclusion in a upcoming version (may even
drive to Houston to bribe him with a refreshment or two. ;-) Dallas isn't that
far away...)  I understand the situation he's in with trying to get beta-14 
out and then work on a complete release.  Because of that I'd like to see 
another site or three run these changes before I send them to him.

If you're running a virtual server configuration and need more control
over your individual virtual servers, have I gotta patch for you...  ;)

Anyone interested in running theses changes, just ask. I'll be glad to supply 
them to you.  I also promise to support you actively during the beta of my
beta. ;-)  Thanks.

---
Kent Landfield                        Phone: 1-817-545-2502             
The Landfield Group                   FAX:   1-817-545-7650             
Email: [email-masked]             http://www.landfield.com/
Please send comp.sources.misc related mail to [email-masked].
Search the Usenet Hypertext FAQ Archive at http://www.faqs.org/faqs/

---

From: [email-masked] (Oskar Pearson)
Date: Thu, 24 Apr 1997 12:07:17 +0200

> Why couldn't I simply specify which ftpaccess file to use ?  If I could do 

I munged this a bit on our server (ftp.is.co.za and gamesdomain.is.co.za)
compiling 2 versions of wu-ftpd and modifying inetd (I didn't do that bit)
so that it would choose which ftpd to start depending on which IP alias
was connected to. The 2 compiled versions had different #defines for the
config files in them. The inetd is at
ftp://ftp.is.co.za/private/oskar/inetd.kezia.tar.gz
It is based on the linux inetd.
The program "netd" in inner-apps-0.05.tar.gz
(ftp://ftp.is.co.za/linux/networking/ipv6/inner.net or
ftp.inner.net/pub/ipv6) is designed to work with ipv6, but does this
elegantly with a config file similar to xinetd.

Currently (as of B12) the way that wu-ftpd reads the config files is a mess...
it's a good idea, but if you make a spelling mistake in the config file,
it just gets ignored. This could be fixed by creating some kind of list
of valid tags (so at least the first entry, such as "class" or "message"
would be checked)...

Oskar

---

From: "Steven K. Buehler" <[email-masked]>
Date: Thu, 24 Apr 1997 08:26:22 -0500

>	- the root ftp directory, 

Plus the readme files, the ownerships, the permissions.  I guess either I am running tcpwrappers without knowing it, or I am not sure what you are missing here.  I can't think of anything extra that is missing.  Could you tell me what else you get from this?

Curious in Illinois

======================================================
Steven K. Buehler
S & B Computers
Rockford Illinois, USA
Phone: 815-398-7169
Fax: 815-398-7266
======================================================