home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sun / admin / 5563 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  1.9 KB

  1. Path: sparky!uunet!mcsun!sun4nl!tuegate.tue.nl!svin02!wzv!rob
  2. From: rob@wzv.win.tue.nl (Rob J. Nauta)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: Re: creating restricted shell environments
  5. Message-ID: <3727@wzv.win.tue.nl>
  6. Date: 15 Aug 92 19:33:05 GMT
  7. References: <1992Aug6.135112.23720@lokkur.dexter.mi.us> <1992Aug10.171606.11806@oakhill.sps.mot.com> <1992Aug14.201534.1805@ultra.com>
  8. Organization: Sex, UNIX & Rock 'n Roll
  9. Lines: 47
  10.  
  11. rfj@ultra.com (Ray Jackson) writes:
  12.  
  13. |  I just tried setting up an account under 4.1.2 that runs /usr/lib/rsh.
  14. |It's not very restricted:
  15.  
  16. |$ cd /
  17. |cd: restricted
  18. |$ more /var/adm/messages
  19. |[stuff deleted]
  20. |!/bin/csh
  21. |/usr/lib/rsh: /bin/csh: restricted
  22. |------------------------
  23. |!csh
  24. |ultra% cd /
  25. |ultra% pwd
  26. |/
  27. |ultra% touch /tmp/test.rsh
  28. |ultra% ls -l /tmp/test.rsh
  29. |-rw-r--r--  1 raccnt          0 Aug 14 13:11 /tmp/test.rsh
  30. |ultra% 
  31.  
  32. |  Is there a way to make rsh really restricted?
  33.  
  34. If you set it up badly, it isn't restricted at all. Take the following
  35. precautions:
  36.  
  37. set the path to a separate directory containing only those commands
  38. needed. In your example 'more' was in the path. More isn't unsafe, it
  39. exec'ed the program via the shell, hence '/bin/csh' was restricted,
  40. but 'csh' wasn't. You probably put '/bin' in the PATH, which means you
  41. could just have typed 'csh' as well. Don't give the user unsafe
  42. commands, like a real shell, vi or cc, for example.
  43.  
  44. Make the user's home directory owned by root, and unwritable. Also
  45. do the same for the .profile.
  46.  
  47. In general, /usr/lib/rsh isn't that restricted. There are lots of tricks
  48. to break out of it. It's a seventies idea that has long been outdated.
  49. Try a custom-written C program as shell that doesn't allow exec's or
  50. shell escapes.
  51.  
  52. Rob
  53. -- 
  54. /-----------------------------------------------\               ,==.
  55. | Rob J. Nauta, UNIX computer security expert.    |               /@  |
  56. | rob@wzv.win.tue.nl, Phone: +31-40-837549    |              /_  <
  57. | Feel free to email me for free advice        |            =" `g'
  58.