Subject: Virtual Host prototype

From: Kent Landfield <[email-masked]>
Date: Thu, 26 Jun 1997 23:58:39 -0500 (CDT)

First off... This is for those interested in Virtual Hosting.  If you have 
no interest in the virtual hosting enhancement effort underway, hit delete
now.

The new prototype is available at http://www.landfield.com/wu-ftpd/newvirt/.
THIS IS ALPHA/BETA CODE!  It is running here and I have had not problems
but we are building a prototype here...  This was developed on a Solaris 2.5
box and that is the only box it has been tested on.  Please send me your
changes (for those of you willing to test it) and I'll incorporate them.

The ftpaccess, ftpusers, ftpgroups, ftphosts and ftpconversions files    
can now all be specified on a per-domain basis.  We now have the ability 
to override the Master WU-FTPD config files with a local copy specific to 
that domain. If you do not wish to place a copy of one or all files listed 
above in the virtual host directory for that specific host then the master 
copy is used. This was amazingly simple. If you are interested in the how 
it was done part, take a look at the code in NEWVIRT ifdefs.

I made the associated changes to ftpshut, ckconfig and my new ftprestart.  
The only programs in the wu-ftpd suite that do not have the new virtual 
access file support is ftpcount and ftpck. (ftpck is coming.)

Here is the current status of what config files have virtual hosting 
support and which don't.
 
    Supported on a virtual host basis:
    ----------------------------------
    _PATH_FTPACCESS  
    _PATH_FTPUSERS   
    _PATH_PRIVATE    
    _PATH_FTPHOSTS   
    _PATH_CVT        
    
    Set in a virtual site's ftpaccess file
    --------------------------------------
    _PATH_XFERLOG  
    
    Supported on a site-wide basis:
    -------------------------------
    _PATH_FTPSERVERS
    _PATH_EXECPATH
    _PATH_PIDNAMES
    _PATH_UTMP 
    _PATH_WTMP
    _PATH_LASTLOG
    _PATH_BSHELL 
    _PATH_DEVNULL

For each virtual domain that you want to support, you have the option
to create an ftpaccess file specific for that domain. This will override 
completely what you have in the Master ftpaccess file.  This file must 
contain all directives as the merge code is not there yet. If you do not 
create an ftpaccess file for a specific domain, the domain will use the
Master ftpaccess file settings. (Merge is coming...)

Besides allowing any virtual server to be able to individually configure
the files mentioned, 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. 

I plan on sending these to Stan for inclusion in a upcoming version.  

Installation Notes: 
===================

1. Setup Virtual domain configuration directories:
--------------------------------------------------

You will need to make sure the proper files/directories are in-place. 
Here is my structure. (As noted before, I put everything in a single
directory structure for testing convenience. Actually I do that when 
I'm not testing as well...)

>From my pathnames.h

/*
** Master Copies - Possibly overridden by VIRTUAL Hosting Configuation
*/

#define _PATH_FTPACCESS  "/tmp/NewFtpd/ftpaccess"
#define _PATH_CVT        "/tmp/NewFtpd/ftpconversions"
#define _PATH_FTPUSERS   "/tmp/NewFtpd/ftpusers"
#define _PATH_PRIVATE    "/tmp/NewFtpd/ftpgroups"
#define _PATH_FTPSERVERS "/tmp/NewFtpd/ftpservers"
#define _PATH_FTPHOSTS   "/tmp/NewFtpd/ftphosts"

/* site-wide */
#define _PATH_PIDNAMES   "/tmp/NewFtpd/ftp.pids-%s"

2. Create an ftpservers file:
------------------------------

   You will need to create an ftpservers file.  A real simple sample is 
   shown below.

   #
   # ftpservers file
   #
   # Format:
   #   IP Address     Path to directory holding configuration 
   #   or hostname    files for this virtual domain
   #
   # ftpaccess file for the landfield.com domain
   #
   landfield.com      /tmp/NewFtpd/config/landfield.com
   #
   # ftpaccess file for the some.domain 
   #
   some.domain       /tmp/NewFtpd/config/some.domain
   #
   # ftpaccess file for the some.other.domain 
   #
   208.196.145.140 /tmp/NewFtpd/some.other.domain
   #

Make sure to create the directories you have listed. ;-)

3. Virtual ftpaccess files:
---------------------------

   The only additions to the ftpaccess file that you need to make over a
   non-virtual version is the "root" and "logfile" directives.  These act
   to assure the proper ftpd root directory is used for each of the supported
   virtual domains.  The logfile directive is used to specify where you want
   the transfer logs recorded for that specific virtual domain.  A sample is
   specfied below.

        root     /ftp
        logfile  /var/log/xferlog

4. Adding other virtual domain files
------------------------------------

    With this release you have the ability to create other configuration
    files on a per-virtual-domain basis.  Currently, the files you put into 
    the virtual domain directory you have listed in the ftpservers file 
    MUST be named:

    ftpaccess - virtual domain's access file
    ftpusers  - restrict the accounts that can use the web server,
    ftpgroups - SITE GROUP and SITE GPASS support,
    ftphosts  - allow or deny usernames access to that virtual server,
    ftpconversions - customize conversions available in the virtual domain.

    NOTE!!!: If you misspell any of them or name them something else, the 
             server WILL NOT find them.

And Finally:
============
Again, a better test strategy is to create an entire runtime directory 
dedicated to wu-ftpd such as /usr/local/wu-ftpd-test/ or /tmp/NewFtpd/
and make sure all the files and executables go there.  In that manner 
you will be able to do a hot swap if you ever want to/need to.

Please send comments, bugs, enhancements, etc to [email-masked].  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/