home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / aix / 11297 next >
Encoding:
Internet Message Format  |  1992-11-04  |  3.4 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!rutgers!modus!gear!cadlab!albani
  2. From: albani@cadlab.sublink.org (Lanfranco Albani)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: shutdown for non-su
  5. Message-ID: <1992Nov03.144006.617@cadlab.sublink.org>
  6. Date: 3 Nov 92 14:40:06 GMT
  7. References: <1ad10ef0@p7.f36.n245.z2.fidonet.org> <BwH9Mn.8B9@austin.ibm.com>
  8. Organization: CAD.LAB S.p.A., Bologna, Italia
  9. Lines: 128
  10.  
  11. jerry@austin.ibm.com (Jerry Heyman) writes:
  12.  
  13. :  Title: Unix System Administration Handbook
  14. :  Author: Evi Nemeth, Gath Snyder, Scott Seebass
  15. :  Pub: Prentice Hall
  16. :  ISBN: 0-13-933441-6
  17. :
  18. :They give the code for a 'sudo' command.  This command allows selected users
  19. :to run as super-user for certain commands.  Each user has a separate list of
  20. :commands that they can run, and password verification/validation is required.
  21. :Any user trying to execute a command that they do not have authority to run
  22. :will cause an e-mail message to be generated and sent to root.
  23. :
  24. :The 'sudo' command can be found in Appendix A of the above book.
  25.  
  26.  
  27. **** BEWARE !!! ****
  28.  
  29. The listings in the Nemeth,Snyder & Seebass are bugged.
  30. These are the bug we have found (and corrected...):
  31.  
  32. file sudo.c
  33.  
  34. the '#include <strings.h>' was modified as:
  35.  
  36.         #include <string.h>
  37.  
  38. and the statement (last line)
  39.  
  40.         if(n = index(n, '.')) *n = 0;
  41.  
  42. become:
  43.  
  44.         if(n = strchr(n, '.')) *n = 0;
  45.  
  46.  
  47. in the function errexit() (page 474 if we have the same edition...)
  48. there is a bug.  This fragment is listed twice, the first *BEFORE* the 
  49. buffer 'cmd' is initialized!
  50.  
  51.         if((fd = popen(cmd, "w")) == NULL)
  52.         {
  53.             return;
  54.         }
  55.  
  56. also in the errexit() function the author uses /usr/ucb/mail.
  57.  
  58.         (void) sprintf(cmd,
  59.         "usr/ucb/mail -s \"HELP! %s@%s has problems.\" %s ",
  60.         progname, hostname, ALERTMAIL);
  61.         if((fp = popen(cmd, "w")) == NULL)
  62.         {
  63.             return;
  64.         }
  65.  
  66. We prefer use /usr/bin/mail:
  67.  
  68.         (void) sprintf(cmd, "/usr/bin/mail %s", ALERTMAIL);
  69.         if((fp = popen(cmd, "w")) == NULL)
  70.         {
  71.             return;
  72.         }
  73.         fprintf(fd,
  74.         "Subject: WARNING! %s@%s has problems\n",
  75.         progname, hostname);
  76.  
  77.  
  78. In the function checkdoer() (page 476...) there are a couple of bugs that
  79. are potentially very dangerous for security:
  80.  
  81.         if(strncmp(cp0, "all", 3) == 0)
  82.  
  83. is modified as:
  84.  
  85.         if(strcmp(cp0, "all\n") == 0)
  86.  
  87. and also this below:
  88.  
  89.         if(strncmp(cp2,ap,strlen(ap)) == 0)
  90.         {
  91.             (void) strncpy(res, cp0, cp1-cp0);
  92.                 /* copy command back */
  93.             return;
  94.         }
  95.  
  96. become:
  97.  
  98.         if(strncmp(cp2,ap,strlen(ap)) == 0)
  99.         {
  100.             (void) strncpy(res, cp0, cp1-cp0);
  101.                 /* copy command back */
  102.             res[cp1-cp0] = '\0'; /* forces string termination */
  103.             return;
  104.         }
  105.  
  106.  
  107. also in the mailmsg() there are the same problems as errexit():
  108.  
  109.         (void) sprintf(cmd,
  110.         "/usr/ucb/mail -s \"*SECURITY* %s@%s tried %s\" %s ",
  111.         user, hostname, *argv, ALERTMAIL);
  112.         if((fp = popen(cmd, "w")) == NULL)
  113.         {
  114.             return;
  115.         }
  116.  
  117. is modified as:
  118.  
  119.         (void) sprintf(cmd, "/usr/bin/mail %s", ALERTMAIL);
  120.         if((fp = popen(cmd, "w")) == NULL)
  121.         {
  122.             return;
  123.         }
  124.         fprintf(fd, "Subject: *SECURITY* %s@%s -> %s\n",
  125.         user, hostname, *argv);
  126.         
  127.  
  128.  
  129.  
  130. We are using sudo extensively, and we are very satisfied!
  131.  
  132. Bye, Lanfranco
  133.  
  134. -- 
  135. Lanfranco Albani - CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia
  136. Email: (work:) albani@cadlab.sublink.org, (home:) bob@allan.sublink.org
  137. Phone: (work:) ++39 (51) 6130360, (home:) ++39 (51) 727372; 
  138. Fax: ++39 (51) 6130294 (work only), Fidonet: 2:332/407.1138 (home only).
  139.