home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11522 < prev    next >
Encoding:
Text File  |  1992-07-28  |  5.0 KB  |  162 lines

  1. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!dtix!relay!afterlife!adm!news
  2. From: mcdonald@aedc-vax.af.mil
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: indigo security
  5. Message-ID: <31559@adm.brl.mil>
  6. Date: 28 Jul 92 17:12:40 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 152
  9.  
  10. Keystrokes of Kenny McDonald, in response to Robyn Landers:
  11. >
  12. >
  13. >    A teaching lab here at the University of Waterloo has just
  14. >purchased four Iris Indigos.  Our hardware people tell us 
  15. >that the video cable has to be kept pretty short (unlike the
  16. >video cable on say our 4D/340 with BNC connectors which we
  17. >have extended to a hundred feet or so).
  18. >This means that the Indigos have to be in the same room
  19. >as the monitors, leaving them vulnerable to malicious students.
  20. >
  21. >    It appears to me that it is pretty easy to break in as root:
  22. >1) turn the power off and on
  23. >(steps 2,3,4 omitted, but trust me they're obvious and easy)
  24. >5) presto, it boots single user and you're root.
  25. >
  26. >    I've sifted through the IRIX Site Admin's Guide on Security and
  27. >PROM monitor and have seen no way to password-protect the PROM
  28. >monitor, enforce direct uninterruptable boot to multiuser using initstate,
  29. >(unless shut down nicely), or otherwise prevent such a break-in.
  30. >I also haven't seen anything like Sun's "secure" option in
  31. >/etc/ttytab to require root's password when booting single user.
  32. >
  33. >    I really hope I've missed something.
  34. >Can anybody tell me what it is?  Thanks.
  35. >
  36. >
  37. >Robyn Landers
  38. >rblanders@math.uwaterloo.ca
  39. >University of Waterloo, Math Faculty Computing Facility
  40. >
  41.  
  42. On our SGI systems I run the following program called multichk from /.cshrc;
  43. It checks the run level to see what state you are running in when the root
  44. account is logged into.
  45.  
  46. ------------------------------------------------------------------------------
  47. #include <stdio.h>
  48. #include <signal.h>
  49. #include <pwd.h>
  50. #include <stdlib.h>
  51.  
  52. #define PASSLENGTH 10
  53.  
  54. int getPassword(argv)
  55. char *argv[];
  56. {
  57.     char        buffer[PASSLENGTH];
  58.     char        rootpass[PASSLENGTH];
  59.     char        altrootpass[PASSLENGTH];
  60.     char        cmd[100];
  61.     char        runstate[10];
  62.     char        *pss,*getpass();
  63.     struct passwd *pw;
  64.     char        *info = "Please enter the ROOT password to continue: ";
  65.     FILE        *fp;
  66.     int         done=0,count=0;
  67.  
  68. /* Hard-coded encrypted alternate maintenance password just in case the root */
  69. /* password cannot be read from /etc/passwd with getpwuid routine */
  70.  
  71.     strcpy(altrootpass,"7nhgQJhqMZaXE");
  72.     sprintf (cmd,"/bin/who -r | /usr/bin/tr -s \" \" \" \" 2> /dev/null | /usr/bin/cut -d\" \" -f4 2> /dev/null\0");
  73.     if ((fp = popen (cmd,"r")) == NULL) {
  74.        printf ("error: %s executing runstate command\n",argv[0]);
  75.        return(0);
  76.     }
  77.     fgets (runstate,25,fp);
  78.     runstate[strlen(runstate)-1] = '\0'; 
  79.     if (strcmp(runstate,"2")==0) {
  80.        printf ("runstate: multi-user\n");
  81.        return(1);
  82.     }
  83.     else printf ("runstate: not multi-user\n");
  84.     pw = getpwuid(0);
  85.     if (pw==NULL) {
  86.        printf ("Could not get root passwd!  You must enter alternate maintenance password!\n");
  87.        strcpy(rootpass,altrootpass);
  88.     }
  89.     else {
  90.        strcpy(rootpass, pw->pw_passwd);
  91.     }
  92.     while (!done) {
  93.         pss = getpass(info);
  94.         strcpy(buffer,pss);
  95.         done = !(strcmp(crypt(buffer, rootpass), rootpass) && strcmp(crypt(buffer,altrootpass), altrootpass));
  96.         count++;
  97.         if (!done && count==3) {
  98.            printf ("Runstate not multi-user & you don't seem to know the password!\n");
  99.            printf ("Last chance to enter the root password or alternate maintenance password!\n");
  100.            pss = getpass(info);
  101.            strcpy(buffer,pss);
  102.            done = !(strcmp(crypt(buffer, rootpass), rootpass) && strcmp(crypt(buffer,altrootpass), altrootpass));
  103.            if (done)
  104.               return(1);
  105.            else
  106.               return(0);
  107.         }
  108.     }
  109.     return(1);
  110. }
  111.  
  112. main(int argc, char *argv[])
  113. {
  114.    int retval;
  115.  
  116.    if (getuid()) {
  117.       printf ("You must be ROOT to run this program\n");
  118.       exit(1);
  119.    }
  120.    signal (SIGINT, SIG_IGN);
  121.    signal (SIGQUIT, SIG_IGN);
  122.    signal (SIGSEGV, SIG_IGN);
  123.    signal (SIGHUP, SIG_IGN);
  124.    signal (SIGABRT, SIG_IGN);
  125.    signal (SIGTSTP, SIG_IGN);
  126.    signal (SIGTERM, SIG_IGN);
  127.    retval = getPassword(argv);
  128.    if (!retval) {
  129.       printf ("ZAPP!\n");
  130.       system ("/etc/init 0");
  131.    }
  132.    else
  133.       printf ("AOK...here we go!\n");
  134. }
  135.  
  136. ------------------------------------------------------------------------------
  137.  
  138.  
  139. Our /.cshrc files look like this:
  140.  
  141. ------------------------------------------------------------------------------
  142. # ignore signals
  143. onintr -
  144. set history = 100
  145. if ( $?prompt ) then
  146.    /.multichk
  147. endif
  148. onintr
  149. ------------------------------------------------------------------------------
  150.  
  151.  
  152.  
  153.   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  154.   | Kenneth M. McDonald * OAO Corp * Arnold Engineering Development Center |
  155.   |          MS 120 * Arnold AFS, TN 37389-9998 * (615) 454-3413           |
  156.   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  157.   INTERNET:
  158.   mcdonald@aedc-vax.af.mil
  159.  
  160.   LOCAL:
  161.   c60244@ccfiris
  162.