home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / bsd / 8978 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.6 KB  |  77 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!mdisea!uw-coco!nwnexus!wjones
  3. From: wjones@halcyon.com (Warren Jones)
  4. Subject: [386BSD] Running Kermit SUID
  5. Message-ID: <1992Nov17.062542.12140@nwnexus.WA.COM>
  6. Summary: Fix allows Kermit to run SUID, comments solicited.
  7. Keywords: Kermit 386BSD SUID
  8. Sender: sso@nwnexus.WA.COM (System Security Officer)
  9. Organization: Northwest Nexus Inc. (206) 455-3505
  10. Date: Tue, 17 Nov 1992 06:25:42 GMT
  11. Lines: 64
  12.  
  13. Has anyone else tried to make Kermit run SUID uucp under 386BSD ?
  14. Here's a fix I had to make to get it working the way I wanted.
  15. I'm using the newly released version 5A(186) from watsun.cc.columbia.edu.
  16. (You can find it in /kermit/bin/cku186.tar.Z.)
  17.  
  18. This is what seems like the proper setup to me:
  19.  
  20.     chown uucp kermit           # uucp owns kermit ...
  21.     chown uucp /dev/com*        #  ... and the serial ports ...
  22.     chown uucp /var/spool/uucp  #  ... and the lock directory.
  23.     chmod u+s  kermit           # Kermit runs SUID uucp
  24.  
  25. However, I found that on startup, Kermit trys to open /dev/tty
  26. to get the tty modes, and the open() fails when the EUID is uucp.
  27. This happens even though /dev/tty is world read and writeable:
  28.  
  29.     crw-rw-rw- 1 root  wheel  1, 0 Nov 16 16:25 /dev/tty
  30.  
  31. Everything seems to work OK if we make Kermit defer opening
  32. /dev/tty until it's made the EUID the same as the real UID.
  33.  
  34. A patch follows.  Comments are welcome.
  35. In particular, I'm hoping someone can tell me whether this
  36. behavior of 386BSD is a bug or a feature.
  37.  
  38. BTW, I'm running 386BSD 0.1.24, and haven't installed any
  39. kernel patches.
  40.  
  41. -------------------------- cut here ----------------------------------
  42. *** Save/ckutio.c    Tue Nov  3 10:48:06 1992
  43. --- ckutio.c    Mon Nov 16 17:47:05 1992
  44. ***************
  45. *** 917,923 ****
  46. --- 917,929 ----
  47.       int x;
  48.   
  49.       conbgt(0);                /* See if we're in the background */
  50. + #ifndef __386BSD__
  51. + /* 386BSD doesn't allow us to open /dev/tty in congm() if the */
  52. + /* EUID == uucp.  It's not clear whether this is a bug or a feature */
  53. + /* but it seems to work if we defer the call to congm() until */
  54. + /* after the call to priv_ini() ... see below. */
  55.       congm();                /* Get console modes */
  56. + #endif
  57.       signal(SIGALRM,SIG_IGN);        /* Ignore alarms */
  58.   
  59.   #ifdef ultrix
  60. ***************
  61. *** 939,944 ****
  62. --- 945,955 ----
  63.       if (x | 4) fprintf(stderr,"Fatal: C-Kermit setuid to root!\n");
  64.       exit(1);
  65.       }
  66. + #ifdef __386BSD__
  67. + /* If running SUID uucp under 386BSD, we can't open /dev/tty */
  68. + /* in congm() until after the call to priv_ini(). */
  69. +     congm();                /* Get console modes */
  70. + #endif
  71.       return(0);
  72.   }
  73.   
  74. -- 
  75. Warren Jones
  76. <wjones@halcyon.com>
  77.