Subject: ftpck 1.4 - WU-FTPD Configuration Checker

From: Kent Landfield <[email-masked]>
Date: Thu, 8 May 1997 09:10:04 -0500 (CDT)

This is the second version of a utility to verify the various files required 
to run wu-ftpd.

Since the beginning, the only wu-ftpd configuration checker was "ckconfig".
All it did was simply check to see if the needed files were where they were
specified in pathnames.h.  Other than that, you had to look at the man pages,
examples and the source code to try and figure out what was the proper syntax.

ftpck is intended to check all files and fields in all the files to assure
proper syntax.  It checks to assure that all files referenced in the various
wu-ftpd system files exist.  It checks modes on files as well as modes on ftp
directories specified.

This is a second shot and is _much_ cleaner and more complete than the first.  
Please help me complete this.  It has already pointed out errors in my
configuration here and I'm sure it will help you as well.  I need suggestions
about what checks make sense and should be added.  Please help me create a
useful and accurate wu-ftpd configuration checker.

Usage:
======

  usage: ftpck [ -cFghprstuvx ] [-f accessfile]

  With no otions, all file are checked.
  Using 'check file options' below, you can only check one file per execution.

  Check file options
    -c:           Check ftpconversions file at /tmp/ftpd/ftpconversions
    -f ftpaccess: Check the specified ftpaccess file
    -F:           Check ftpaccess file at /tmp/ftpd/ftpaccess
    -g:           Check ftpgroups file at /tmp/ftpd/ftpgroups
    -h:           Check ftphosts file at /tmp/ftpd/ftphosts
    -p:           Check pid directory at /tmp/ftpd/ftp.pids-%s
    -s:           Check ftpservers file at /tmp/ftpd/ftpservers
    -u:           Check ftpusers file at /tmp/ftpd/ftpusers
    -x:           Check xferlog file at /tmp/ftpd/xferlog
  Other options
    -r:           Verify aliases and cdpaths usable in all ftp root directories
    -t:           Produce totals output
    -v:           Produce verbose output

Getting ftpck
==============
 
     You can get the current version of ftpck from

            ftp://ftp.landfield.com/wu-ftpd/ftpck/

     There is also web page at

         http://www.landfield.com/wu-ftpd/ftpck/ftpck.html
  
     that contains this information and will be updated as development
     continues.

Current development status
==========================

     May 7, 1997: This has been cleaned up greatly with all ftpaccess
     records now being checked. There are just a couple of accessfile 
     checks that still need to be added.  

     The plan is to:

         - assure complete ftpaccess file checking is done,
         - expand the verification checking for each of the 
           other wu-ftpd config files,
         - write a a utility that checks the permissions, modes, ownership,
           number of links, etc. of the individual ftp data directories.

     I could use some help.  Ideas are what I need most.

What does it test ?
===================

  This list will be expanding. Currently, the following things are checked. 
  These are only what I have had time to get in at present. 

  ftpaccess:

         1. The existence of the specified ftpaccess file is verified.
         2. Modes on each of the specified ftpaccess files are
            checked to assure they are 0600.

       In addition, each record in the file is verified. Please
       send suggestions to [email-masked] concerning tests
       that you would like to see done.

         1. alias directive
               o Improper number of fields
               o Checks if directory aliased exists for real users
               o Checks if directory aliased exists for anonymous users
         2. autogroup directive
               o Improper number of fields
               o Groupname specified is a valid system group
               o Checks each "class" specified to assure its a valid "class"
         3. banner directive
               o Improper number of fields
               o Checks if banner message file exists for real users
               o Checks if banner message file exists for guest users
         4. cdpath directive
               o Improper number of fields
               o Checks if directory aliased exists for real users
               o Checks if directory aliased exists for anonymous users
         5. class directive
               o Improper number of fields
               o Verify there is a valid typelist specified
               o Verify the address globbing passed in
         6. compress and tar directives
               o Improper number of fields
               o Invalid "yes/no" specified
               o Checks each "class" specified to assure it is
                 a valid "class"
         7. chmod, delete, overwrite, rename and umask
            directives
               o Improper number of fields
               o Invalid "yes/no" specified
               o Assures <typelist> is a comma-separated list
                 of any of the keywords "anonymous", "guest"
                 and "real".
         8. deny directive
               o Improper number of fields
               o Checks for valid Address, domain or
                 !nameserved (match_host TBD)
               o Checks to assure the message file exists
         9. email directive
               o Improper number of fields
        10. guestgroup directive
               o Improper number of fields
               o Groupnames specified are valid system groups
        11. guestserver directive
               o Improper number of fields
        12. limit directive
               o Improper number of fields
               o Check if valid class specified
               o Check is a number
               o Valid specified (valid_time TBD)
               o Message file exists in guest and real ftp directories
        13. log directive
               o Improper number of fields
               o Assures <typelist> is a comma-separated list
                 of any of the keywords "anonymous", "guest"
                 and "real".
               o Checks directions
               o Checks both the `log transfers' and `log
                 commands' entries.
        14. logfile directive (new virtual support directive)
               o Improper number of fields
               o Assure logfile exists at specified path
        15. loginfails directive
               o Improper number of fields
               o content is a number
        16. lslong and lsshort directives
               o Verify the specified executable exists
        17. message directive
               o Improper number of fields
               o Check the is valid
               o Verify any classes listed are valid system classes
        18. noretrieve directive
               o Improper number of fields
               o Check the to assure the file is available
        19. passwd-check directive
               o Improper number of fields
               o Check for validity
               o Check for validity
        20. path-filter directive
               o Improper number of fields
               o Check typelist specified is valid
               o Verify message file path exists
        21. private directive
               o Improper number of fields
               o Invalid "yes/no" specified
               o If "private yes" check to see if _PATH_PRIVATE exists
        22. readme directive
               o Improper number of fields
               o Check the is valid
               o Verify any classes listed are valid system classes
        23. root directive (new virtual support directive)
               o Improper number of fields
               o Verify specified ftpd root data directory exists
               o Check to assure path is a directory.
        24. shutdown directive
               o Improper number of fields
        25. upload directive
               o Improper number of fields
               o Check to assure maximum of 7 arguments
               o Make sure matches the ftp user passwd file homedir
               o Check if ARG2 is yes/no
               o Validate dirs/nodirs
               o Assure the mode specified is sane
               o Assure any specified user has a passwd file entry
               o Assure any specified group has a group file entry
        26. virtual directive
               o Improper number of fields
               o Make sure seems sane
               o Check if ARG1 is root/banner/logfile
               o Assure path exists (only from machine root)
               o Assure root path is a directory
               o Assure banner and logfiles are regular files

  ftpconversions:

    1. The existence of the ftpconversions file is verified.
    2. Modes on the ftpconversions file are checked to assure they
       are 0600.

  ftphosts:

    1. The existence of the ftphosts file is verified.
    2. Modes on the ftphosts file are checked to assure they are
       0600.

  ftppidnames:

    1. Checks the existence of the runtime pid file directory.

  ftpgroups:

    1. The existence of the ftpgroups file is verified.
    2. Modes on the ftpgroups file are checked to assure they are
       0600.

  ftpservers:

    1. The existence of the ftpservers file is verified if
       VIRTUAL_SERVER support compiled in.
    2. Checks to assure all ftpaccess files specified in the
       ftpservers file exist.
    3. All specified ftpaccess files are then themselves checked via
       the ftpaccess tests listed above.

  ftpusers:

    1. The existence of the ftpusers file is verified.
    2. Account names not longer than 8 characters.
    3. Assure only one item per line.
    4. Records are newline terminated.
    5. Modes on the ftpusers file are checked to assure they are
       0600.

  xferlogs:

    1. The existence of the xferlog files are verified. All xferlogs
       are checked if the site has indicated the use of virtual
       server support.
    2. Modes on the xferlog file are checked to assure they are
       0660.

Hope you find it useful.  All comments welcomed.

-- 
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: Kent Landfield <[email-masked]>
Date: Thu, 8 May 1997 10:37:00 -0500 (CDT)

I forgot to state that this was developed on a Solaris 2.5 box using gcc.

Also, as the distribution is configured, it needs to be unpacked 
under the wu-ftpd src/ directory.  The tar/shar files will create 
a subdirectory name ftpck.1.4.  You will need to edit the Makefile 
in the ftpck.1.4 directory and make sure things are right for your 
installation.  It is setup to use your existing pathnames.h and 
config.h files. 

Type make and build it.  Test it from that directory.  When you are 
satisfied it does the right things, type make install and the go verify 
your config.

Note: rdservers.c is not used unless you are one of the beta sites 
for my new way of doing virtual hosting.  If so, make sure you put 
-DVIRTUAL_SERVER in the CFLAGS.  If you are using the current virtual 
support then you do not need to do anything.