home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / term-2.3.5 / README.security < prev    next >
Encoding:
Text File  |  1995-07-14  |  5.6 KB  |  190 lines

  1. WHAT IS THIS?
  2. ~~~~~~~~~~~~~
  3. Shared term allows other users to use the same term connection you are using.
  4. By environment variables you can disable/enable shared features.
  5.  
  6. You only need to install shared term on the end that you have users
  7. who want a shared term connection.  However for new commands to work,
  8. both ends should be running the same term version #.
  9.  
  10. OK, the following instructions allow you to share your term connection without
  11. allowing other users direct access to either the account on which term
  12. was started, or the remote *NIX account.  ("chroot", and "denyrsh" just don't
  13. cut it if users are clever with tupload, or willing to compile their
  14. own clients.  If you don't believe me, let me on your machine.)
  15.  
  16. If you don't want to use the shared term features, skip the following
  17. section of this file.  Just type follow the instructions in INSTALL.
  18.  
  19.  
  20. TERM MODES
  21. ~~~~~~~~~~
  22.  
  23. There are two basic ways you can install term for sharing.  The safest, most
  24. secure method is as root create a "term" group which contains no members.  Then
  25. as root, install "term" as a SGID program.  If this option is not possible, 
  26. then you can install term as a SUID program by installing as an ordinary user.
  27.  
  28. Here is a table that lists the differences:
  29.  
  30. Chmod    $TERMMODE    $TERMDIR -or-    Default        Connection
  31. Type            $TERMSHARE            Owner    Users
  32. -------    ---------------    ---------------    ---------------    ------- ----------------
  33. u+s    2 (Shared)    neither        $HOME/term    You    Anyone
  34. u+s    0 (Private)    $TERMDIR    $HOME        Anyone    Connection Owner
  35. g+s    1 (Shared)    $TERMSHARE    /usr/local/lib/term    Anyone    Anyone
  36. g+s    0 (Private)    $TERMDIR    $HOME        Anyone    Connection Owner
  37. -    0 (Private)    $TERMDIR    $HOME        Anyone    Anyone
  38.  
  39.  
  40. To install shared term, do the following:
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.  
  43. 1) (IF YOU ARE ROOT!)  Create a "term" group with no members
  44.    by adding the following line in /etc/group:
  45.  
  46.    term::16:root
  47.  
  48.    If 16 is already used by something else, choose an unused GID.
  49.  
  50.  
  51. 2) Follow the instructions in INSTALL for making and installing your binaries.
  52.  
  53. 3) To start "term" SHARED mode use:
  54.  
  55.    IF term was installed by ROOT:
  56.      With csh or tcsh:
  57.        setenv TERMMODE 1
  58.      With bash use:
  59.        export TERMMODE=1
  60.    otherwise
  61.      With csh or tcsh:
  62.        setenv TERMMODE 2
  63.      With bash use:
  64.        export TERMMODE=2
  65.  
  66.    NOTE!!!  All users who want to take advantage of the shared term 
  67.    connection should set the above environment variable.
  68.  
  69.  
  70. 4) To start clients compiled with term117 or earlier in shared mode.
  71.  
  72.    With TERMMODE=1:
  73.      With csh or tcsh:
  74.         setenv TERMDIR /usr/local/lib/term
  75.      With bash use:
  76.         export TERMDIR=/usr/local/lib/term
  77.    With TERMMODE=2:
  78.      With csh or tcsh
  79.     setenv TERMDIR $HOME/term
  80.      With bash use:
  81.         export TERMDIR=$HOME/term
  82.  
  83.    NOTE!!!  All users who want to take advantage of the shared term 
  84.    connection should set the above variables.
  85.  
  86. 5) To run in PRIVATE MODE: 
  87.  
  88.    With csh/tcsh:
  89.        setenv TERMMODE 0
  90.    With bash:
  91.        export TERMMODE=0
  92.  
  93. 6) If you have multiple modems, then you can have more than one connection
  94.    at a time.  To specify which connection to use you must start term
  95.    with a server name.  i.e.
  96.  
  97.        nohup term -v /dev/modem1 -l /tmp/logfile1 Connection1 &
  98.        nohup term -v /dev/modem2 -l /tmp/logfile2 Connection2 &
  99.  
  100.    then users should set the variable TERMSERVER to the connection name
  101.    they want to use.  i.e.
  102.  
  103.        setenv TERMSERVER Connection1
  104.  
  105.    for csh, tcsh, and etc.,  or
  106.  
  107.        export TERMSERVER=Connection1
  108.  
  109.    for bash, sh, ksh, and etc.
  110.  
  111.  
  112. PRIVILEGED COMMANDS:
  113. ~~~~~~~~~~~~~~~~~~~~
  114.  
  115. The primary differences between the sharable and the unsharable commands are:
  116.   - Sharable commands are SGID (set group id) programs if installed by root
  117.     or SUID (set user id) programs if installed by an ordinary user.
  118.   - The shared "term" directory is controlled by $TERMSHARE instead of
  119.     $TERMDIR
  120.  
  121. Some programs, even though they may be SUID or SGID, will still only be usable
  122. by the owner of the term-connection and root.  These are known as privileged
  123. commands.  The following clients are privileged.
  124.  
  125.   tupload, trsh, tshutdown
  126.  
  127. The other term clients:
  128.  
  129.   tmon, txconn, tredir
  130.  
  131. are available by anyone who can execute the binaries.
  132.  
  133. If you port program using termnet.h, anything that uses rcmd() will also
  134. be privileged.  Here is a listing of some of these programs:
  135.  
  136.   rlogin, rsh, rcp
  137.  
  138. Here are some non-privileged programs:
  139.  
  140.   finger, whois, talk, telnet, xarchie, xgopher, ytalk
  141.  
  142. Basically, if it allows the user to access an account without a password it
  143. will be privileged.
  144.  
  145.  
  146. HOW TO MAKE A COMMAND SHARED
  147. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148.  
  149. If you want to make a term command such as termftp or termtelnet shared,
  150. then do the following, which sets shared group permissions:
  151.  
  152.   IF YOU ARE ROOT:
  153.     chgrp term binary-file
  154.     chmod g+s binary-file
  155.   IF YOU ARE AN ORDINARY USER:
  156.         chmod u+s binary-file
  157.  
  158.  
  159. SECURITY TEST
  160. ~~~~~~~~~~~~~
  161.  
  162. If you are the first to port a program, it would probably pay to double
  163. check its security when in shared mode.
  164.  
  165. To test the command try to fork a shell with the command "id".  If "id"
  166. reports:
  167.    '... egid=16(term) ...' 
  168. then you have a security hole.
  169.  
  170. Also try to overwrite other peoples' files, or create files where you
  171. don't have write permission.
  172.  
  173. Here is an example of how I tested "ftp":
  174.  
  175. % ftp localhost
  176. Connected to localhost.
  177. 220 k9 FTP server (Linux k9 1.0.9 #5 Tue Jun 7 12:52:00 EST 1994 i486) ready.
  178. Name (localhost:bcr): bcr
  179. Password (localhost:bcr): 
  180. 331 Password required for bcr.
  181. 230 User bcr logged in.
  182. Remote system type is UNIX.
  183. Using binary mode to transfer files.
  184. ftp> !id
  185. uid=501(bcr) gid=100(users) groups=100(users)
  186.  
  187. In this case, this is my user id and group id, so "ftp" passes the test and
  188. this command is safe.
  189.  
  190.