home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / fsp / part01 / INFO next >
Encoding:
Text File  |  1992-12-18  |  15.7 KB  |  375 lines

  1.                         Interested party please email
  2.                         wen-king@vlsi.cs.caltech.edu
  3.     What is the purpose of FSP (V2.6):
  4.  
  5.     FSP is a set of programs that implements a public-access archive
  6.     similar to an anonymous-FTP archive.  It is not meant to be a
  7.     replacement for ftp; it is only meant to do what anonymous-ftp
  8.     does, but in a manner more acceptible to the provider of the
  9.     service and more friendly to the clients. 
  10.  
  11.     Providing anonymous-FTP service can be costly --- each active
  12.     session consumes one process slot in the OS and one stream socket
  13.     entry in the network sub-system.  The servers can also run
  14.     concurrently, adding to the system load.  A popular archive site
  15.     can easily be overwhelmed as a result.  Some were forced to
  16.     shutdown or and some impose inconvienent access restrictions. 
  17.  
  18.     Unlike FTP, FSP is connection-less and virtually state-less.  One
  19.     server handles requests from all clients machines.  Each active
  20.     client machine takes up 16-bytes in a dynamically extensible
  21.     table.  Since only one server exists on a server machine at any
  22.     time, the load added to the server machine is no more than one. 
  23.  
  24.     In exchange for allowing site operators to keep their sites open
  25.     and do away with cumbersome access restrictions, this is what the
  26.     clients accept with FSP: 
  27.  
  28.      1) Lower transfer rate.  The maximum rate is 1 kbyte per UDP
  29.         message round-trip time between the client and the server.
  30.     
  31.     In addition to the potential for more abundant sites and more
  32.     accessible sites, this is what the clients gain with FSP:
  33.  
  34.      1) Robustness.  Since FSP is connectionless, flucturations in
  35.         the network will not abort a FSP transaction.  Furthermore,
  36.         the 16-bytes of data for each client can be regenerated at
  37.         any point during any transaction.  Thus, if the server goes
  38.         down at any point during a transaction, the transaction will
  39.         resume when the server is restarted.  (like NFS) 
  40.  
  41.      2) Friendlier user interface.  FSP does not have its own command
  42.         interpretor like FTP.  Since it is connectionless, there is
  43.         no reason to carry much information from one command to the
  44.         next, and the commands can all be made into individual unix
  45.         programs.  For instance, there is one program you run to list
  46.         the directory and another you run to download a file. 
  47.  
  48.      3) Client protection.  FSP oversees a directory structure similar
  49.         to that of an anonymous-FTP.  However, a directory created
  50.         via FSP transaction is owned by the client machine that issued
  51.         the creation request.  The client can create and delete files
  52.         and subdirectories in that directory.  In addition, the client
  53.         can enable any of the two attributes for that directory: 
  54.  
  55.         A) Give all other clients the permission to create files
  56.            and subdirectries.
  57.  
  58.         B) Give all other clients the permission to delete files
  59.            and subdirectories.
  60.  
  61.         Note: A subdirectory can be deleted if it is empty and the
  62.           client owns the subdirectory.
  63.  
  64.      4) Server protection.  FSP server does not spawn sub-programs.
  65.         It will accept only paths that are downward relative to its
  66.         designated working directory.  On systems with symbolic links,
  67.         the server will follow symbolic links, but it does not follow
  68.         uplinks ("..").  Clients cannot create symbolic links and
  69.         care should be taken so that other users on the server machine
  70.         cannot create symbolic links in the server's work space. 
  71.  
  72.         It is also fairly difficult to formuate an attack to force a
  73.         shutdown of a FSP site by actions of a rogue site.  About the
  74.         only way to distrupt a FSP service is to flood the FSP site
  75.         with network packets.  FSP server prevents itself from
  76.         'counter-flooding' by filtering for legitimate requests using
  77.         the following method:
  78.  
  79.         A) Each request message contains a key.  For each client,
  80.            server database contains the keys to be used for the
  81.            next client request and for the previous client request.
  82.  
  83.         B) If the next request does not contain a key that matches
  84.            either of the two keys, it is accepted only if at least
  85.            one minute has elapsed since the last time a request
  86.            is accepted.  If the key does match the old key
  87.            (retransmit by client) it is accepted if the elapse time
  88.            is greater than 3 seconds.
  89.  
  90.         C) Every request message accepted is acknowledged with
  91.            one reply message.  The reply message contains a new
  92.            key to used for the next request.  The new key is
  93.            computed by the server with a pseudo-random number
  94.            generator. 
  95.  
  96.         Flooding is a ballant violation of network etiquette because
  97.         a site can be subjected to flooding attack whether it has FSP
  98.         running or not, and flooding congests every link and gateway
  99.         between the rogue client and the server.  As a further measure
  100.         of protection, the server loads a table of rogue clients on
  101.         startup.  The server will not respond to requests from any of
  102.         those clients.
  103.  
  104.     The software set:
  105.  
  106.     common_def.h    This C header file contains definitions common to
  107.             both the server code and the client code.
  108.  
  109.     client_def.h    This C header file contains definitions for the
  110.             client code.
  111.  
  112.     server_def.h    This C header file contains definitions for the
  113.             server code.
  114.  
  115.     udp_io.c    This file contains the lowest level routines that
  116.             deal with the unix inet sockets.  This file is
  117.             used by both the server code and the client code.
  118.  
  119.     server_main.c    Main routine and dispatch loop for the server.
  120.     server_host.c    Routines for maintaining client database.
  121.     server_file.c    Routines for file i/o.
  122.     server_lib.c    Routines for inet socket i/o.
  123.  
  124.     client_lib.c    Core routines of the client library.
  125.     client_util.c    Supplementry routines of the client library.
  126.     client_lock.c    udp packet multiplexing mechanism.
  127.  
  128.     bsd_src/    Directory containing additional sources derived
  129.             from those in public archive on uunet.uu.net.  It
  130.             contains a BSD random/srandom routine, a modified
  131.             BSD globbing routine, a modified "ls" source.
  132.  
  133.     fcdcmd.c    These compiles into individual client utilities.
  134.     fgetcmd.c    Those with a "cmd" in their name will do their
  135.     flscmd.c    own globbing on their argv base on directory
  136.     fprocmd.c    information obtained from the server.
  137.     frmcmd.c
  138.     frmdircmd.c
  139.     fcatcmd.c
  140.     fmkdir.c
  141.     fput.c
  142.     fver.c
  143.     fgrab.c
  144.  
  145.     merge.c        This file is used to call the other client programs
  146.             when program merging option is used.  Rather than
  147.             compiling into individual client utility programs,
  148.             users may opt to build a single program which
  149.             contains all client funtionalities, which are to
  150.             be distinguished at run time by the name used to
  151.             activate the program.  Significant space saving can
  152.             be achieved on some machines. 
  153.  
  154.     Compilation:
  155.  
  156.     FSP has been compiled and tested by me on a SS-2 running SunOs
  157.     4.1.1, a HP-9000 running HP UNIX, a VAX-780 running 4.3-tahoe,
  158.     and a 386 box running system-V UNIX with old Excelan ethernet
  159.     interface.  It has also been compiled on a variety of machines
  160.     by over hundreds users all over the world. 
  161.  
  162.     To compile the software, you must first successfully complete a
  163.     "make" in the bsd_src directory.  You may have to change a few
  164.     files.  In particular, you may have to edit "Makefile" and "tweak.h"
  165.     in bsd_src directory. 
  166.  
  167.     When that is done, you can edit the Makefile on the top directory
  168.     and run "make" in the top directory, or "make merge" if you want
  169.     to combine all client programs into one single file.  You may wish
  170.     to read through the rest of this document first before making
  171.     changes to the Makefile. 
  172.  
  173.     After "make" or "make merge" finished, you may use "make install"
  174.     or "make install-merge" to install the programs.  Man pages may be
  175.     installed by "make installm".
  176.  
  177.     IMPORTANT NOTE: You do not need to run the fspd process if you only
  178.     want to access existing fsp archives.  fspd processs is needed only
  179.     if you want to setup and archive for public access.
  180.  
  181.     Server Administration:
  182.  
  183.     The only things you need for setting up a FSP server is a work
  184.     directory for the service and and the FSP server itself (fspd).
  185.     fspd can run independently or it can be run under inetd.  When
  186.     running independently, fspd waits for messages through a UDP
  187.     socket whoes port number is defined in the Makefile.  When running
  188.     under inetd, fspd is involked as in.fspd.  inetd will spawn fspd
  189.     when a message arrives for the FSP socket.  The fspd process will
  190.     take over and stick around to wait on additional messages.  After
  191.     it has become idle for 2 minutes, fspd will exit and return control
  192.     to inetd. 
  193.  
  194.     Sample setup for inetd operation:
  195.  
  196.         In /etc/services file:
  197.  
  198.         fsp             21/udp          fspd
  199.  
  200.         In /etc/inetd.conf file:
  201.  
  202.         fsp dgram   udp wait ftp /usr/etc/fspd in.fspd
  203.  
  204.         In this sample, the same port number for ftp is used for the
  205.         fsp socket.  There will not be a conflict because ftp uses
  206.         stream protocol, and fsp uses UDP protocol.  The fspd program
  207.         in this example is ran under user 'ftp'. 
  208.  
  209.     In addition, fspd will accept these flags:
  210.  
  211.         -h absolute_path    Set fsp work directory.  Overrides the
  212.                 compiled-in default.
  213.  
  214.         -p udp_port_number  Set UDP port number.  Overrides the
  215.                 compiled-in default.
  216.  
  217.         -u uid_number       Assume this uid after startup.  If present,
  218.                 fspd will attempt a setuid() to this uid
  219.                 number.  It will exit if setuid() fails.
  220.  
  221.         -d                  Turn on debug mode.  The stdio files will
  222.                 remain open in debugging mode.
  223.  
  224.     When fspd starts, it chdir to its work directory where it looks
  225.     for (and reads in if found) a list of internet numbers in the
  226.     standard 4-part form: ddd.ddd.ddd.ddd in the file ".ROGUE_HOSTS".
  227.     This file is prepared by the FSP maintainer, and is used to
  228.     indicate that fspd should not respond to any requests from these
  229.     machines.   After that, it begins to service any requests it gets
  230.     on the UDP socket.
  231.  
  232.     If a file .OWN.XXXXXXXX, where XXXXXXXX is an 8-digit hex number,
  233.     exists in a directory in fspd's work space, the directory is owned
  234.     by the machine whoes inet number is XXXXXXXX (an integer stored
  235.     in the network byte order), where the number is printed as a
  236.     hexadecimal number.  If no such file exists, the directory has
  237.     no owner.  (Note, the 'dot' files are hidden from clients). 
  238.  
  239.     If the file .FSP_OK_DEL does not exists in a directory, only the
  240.     owner is allowed to remove items from that directory. 
  241.  
  242.     If the file .FSP_OK_ADD does not exists in a directory, only the
  243.     owner is allowed to add items into that directory. 
  244.  
  245.     Thus, you typically want to protect the top directory by leaving
  246.     out the .FSP_OK_DEL, .FSP_OK_ADD files, and .OWN.XXXXXXXX files
  247.     in the top directory. 
  248.  
  249.     Clients do not get to read the directory information directly.
  250.     Instead, fspd maintains a directory listing for each directory
  251.     in a cache file.  If the directory is writable by fspd, or if a
  252.     writable file in it is prepared beforehand, fspd will store the
  253.     directory information in .FSP_CONTENT file in that directory.
  254.     Otherwise, it will store the information in a pair of files (with
  255.     hashed names) in a special directory specified by the variable
  256.     DEF_DIRECTORY_CACHE in Makefile.  The later allows read-only
  257.     directories to be exported. 
  258.  
  259.     When a client requests information for a directory, the cache
  260.     file is created if it doesn't exist, and it is rebuilt if it is
  261.     out of date.  The information is accessed by having the client
  262.     read the directory listing file. Care is taken so that the client
  263.     will not get corrupted entries when the directory is changed while
  264.     the listing is being read.
  265.  
  266.     Files being uploaded are first written to a temporary file in the
  267.     work directory: .TXXXXXXXXYYYY where XXXXXXXX is the inet number
  268.     of the client, and YYYY is the port number of the client program.
  269.     When upload is compelete, the file is moved into the intended
  270.     location. 
  271.  
  272.     Sending it an 'alarm' signal will cause fspd to dump its current
  273.     client database into the file .HTAB_DUMP in the work directory.
  274.     This can be useful for debugging and for catching rogue clients.
  275.  
  276.     Client utilities:
  277.  
  278.     All inter-command states are kept in these three shell environment
  279.     variables.
  280.  
  281.         FSP_PORT        Port number of the fspd you wish to contact.
  282.         FSP_HOST        Host name or number of the fspd.
  283.         FSP_DIR        Your current working directory in the archive.
  284.  
  285.     When multiple client utilities are run at the same time on the
  286.     same client machine, packet multiplexing mechanisms can be used
  287.     to enable concurrent access to the same fsp database.  If none
  288.     of the mechanisms are selected at compile time, FSP_LOCALPORT
  289.     can be used to ensure that only once client utility can run at
  290.     any time.  In this case, FSP_LOCALPORT can be set to any port
  291.     number not current used on the client machine.
  292.  
  293.     FSP_TRACE can be set if you want status reports be printed while
  294.     files are being transferred.  FSP_DELAY variable can be used to
  295.     set the retransmit interval for client utilities (in thousandth
  296.     of a second).  The retransmit rate is adjusted in an exponential
  297.     manner, until the retry rate reaches 5 mintes per retry.
  298.  
  299.     FSP_BUF_SIZE can be set to a positive number less than or equal
  300.     to 1024.  When set, it determines the size of data to be send for
  301.     each request during file and directory information transfer.  The
  302.     default is 1024.  Some sites are connected via links that cannot
  303.     transmit buffers containing 1024 bytes of data in addition to the
  304.     header information.  Setting FSP_BUF_SIZE to a lower value will
  305.     allow these sites to access fsp archives.
  306.  
  307.     A typical setup looks like this:
  308.  
  309.         setenv FSP_PORT     21
  310.         setenv FSP_HOST     131.215.131.97
  311.         setenv FSP_DIR     /
  312.         setenv FSP_TRACE
  313.         setenv FSP_DELAY     3000
  314.         setenv FSP_BUF_SIZE  1024
  315.  
  316.     (All examples will be in csh.  However, it is assumed that similar
  317.      things can be done with other shells)
  318.  
  319.     For commands that do globbing using remote directory info, normal
  320.     shell globbing needs to be turned off.  In csh, it can be done
  321.     with a set of aliases: 
  322.  
  323.         alias fcd setenv FSP_DIR \`\(set noglob\; exec fcdcmd \!\*\)\`
  324.         alias fls    \(set noglob\; exec flscmd    \!\*\)
  325.         alias fget   \(set noglob\; exec fgetcmd   \!\*\)
  326.         alias fgrab  \(set noglob\; exec fgrabcmd  \!\*\)
  327.         alias fcat   \(set noglob\; exec fcatcmd   \!\*\)
  328.         alias frm    \(set noglob\; exec frmcmd    \!\*\)
  329.         alias frmdir \(set noglob\; exec frmdircmd \!\*\)
  330.         alias fpro   \(set noglob\; exec fprocmd   \!\*\)
  331.     
  332.     In addtion, these alias are useful:
  333.  
  334.         alias fpwd echo \$FSP_DIR on \$FSP_HOST port \$FSP_PORT
  335.         alias fsethost setenv FSP_DIR \/\; setenv FSP_HOST \!\:1\; \
  336.                            setenv FSP_PORT \!\:2
  337.  
  338.         The second one is a user contribution.  It allows one to set
  339.         the FSP_HOST, FSP_PORT, and to initialize FSP_DIR in one command.
  340.  
  341.     Commands:
  342.  
  343.         fver    display server's version number.
  344.         fcd        change current remote directory, like cd.
  345.         fls        list directory.  works like ls.
  346.         fget    get the named files.
  347.         fgrab    get the named file and delete it from remote directory.
  348.         fput    put the named files.
  349.         fcat    get the named files and send them to stdout.
  350.         fmkdir    make named directories.
  351.         frm        delete named files.
  352.         frmdir    delete named directories.
  353.  
  354.         fpro    no arg: display directory protection modes.
  355.                 +c: give others permission to create new items.
  356.                 -c: deny others permission to create new items.
  357.                 +d: give others permission to delete old items.
  358.                 -d: deny others permission to delete old items.
  359.  
  360.     ***********************************************************************
  361.  
  362.     This is a free software.  Be creative; make your own macros and tools
  363.     and let me know of any bugs and suggestions.
  364.  
  365.     A mailing list for the discussion of the FSP software is now available
  366.     (started Oct 2, 1992.)  To get on the list, send an email stating
  367.     that you want to be on the FSP list to the following address:
  368.  
  369.         listmaster@Germany.EU.net
  370.  
  371.     Articles to be distributed to the subscribers should be sent to the
  372.     following email address:
  373.  
  374.         fsp-discussion@Germany.EU.net
  375.