home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / bug.chk.sun < prev    next >
Text File  |  1992-03-10  |  6KB  |  208 lines

  1. #!/bin/sh
  2. #
  3. #  Sun module for bug/vulnerability checking
  4. #
  5. ECHO=/bin/echo
  6. TEST=/bin/test
  7. LS=/bin/ls
  8. LS_OPTS="-slagL"
  9. ARCH=/bin/arch
  10. GREP=/bin/grep
  11. EGREP=/usr/bin/grep
  12. DMESG=/etc/dmesg
  13. AWK=/bin/awk
  14. SORT=/bin/sort
  15. UNIQ=/bin/uniq
  16.  
  17. # uncomment this if you don't do any kernel hacking... this will check
  18. # this as well as the object files that modify it.
  19. # KERNEL=/vmunix
  20.  
  21. BUG="$AWK -f ./bug_cmp"
  22. word_smithing="could have a hole/bug"
  23.  
  24. if $TEST ! -f ./bug_cmp ; then
  25.     $ECHO "Must have bug compare module, ./bug_cmp, to run..."
  26.     exit 2
  27.     fi
  28.  
  29. # what is the date?  We just need the month and year...
  30. # Format: Fri Feb  7 14:16:55 PST 1992
  31. if $TEST $# -eq "2" ; then
  32.     real_date="$1 $2"
  33. else
  34.     real_date=`$DATE | $AWK '{print $2, $NF}'`
  35.     fi
  36.  
  37. # try to find OS version... thanks brad (powell)!
  38. release_level=`$DMESG | $GREP SunOS | $AWK '{print $3}' | $SORT | $UNIQ`
  39. if $TEST -z "$release_level" ; then
  40.     release_level=`$EGREP '[3-4]\.[0-5]' /etc/motd | \
  41.         $AWK '{for (i=1;i<=NF;i++) if ($i ~ /[3-4]\.[0-5]/) print $i}'`
  42.     fi
  43.  
  44. # sendmail
  45. #
  46. # Patch ID# 100099-01 for SunOS 4.1
  47. # Patch ID# 100100-01 for SunOS 4.0, 4.0.1, 4.0.3
  48. # Patch ID# 100108-01 for Sun386i (sunOS 4.0.2)
  49. sendmail="/usr/lib/sendmail"
  50. fix_date="30 Jul 1990"
  51. cert_advis="CA-90:01"
  52. if $TEST -f "$sendmail" ; then
  53.     cur_date=`$LS $LS_OPTS $sendmail | $AWK '{print $8, $7, $9}'`
  54.     $ECHO $sendmail $fix_date $cur_date $cert_advis $real_date | $BUG
  55.     fi
  56.  
  57. # restore
  58. #
  59. # This problem affects
  60. # SunOS 4.0, 4.0.1, and 4.0.3 systems.  It does not appear in SunOS 3.5.
  61. # FIX: 1) Make restore non-setuid by becoming root and doing a 
  62. # chmod 750 /usr/etc/restore
  63. restore="/usr/etc/restore"
  64. cert_advis="CA-89:02"
  65. fix_date="26 Jul 1989"
  66. if $TEST -f "$restore" ; then
  67.     cur_date=`$LS $LS_OPTS $restore | $AWK '{print $8, $7, $9}'`
  68.     $ECHO $restore $fix_date $cur_date $cert_advis $real_date | $BUG
  69.     fi
  70.  
  71. # TIOCCONS
  72. #
  73. # Sun Patch ID : for SunOS 4.1, SunOS 4.1_PSR_A 100187-01
  74. # Sun Patch ID : for SunOS 4.1.1 100188-01
  75. fix_date="17 Dec 1990"
  76. cert_advis="CA-90:12"
  77. for TIOCCONS in /sys/sun*/OBJ/cons.o $KERNEL ; do
  78.     if $TEST -f "$TIOCCONS" ; then
  79.         date=`$LS $LS_OPTS $TIOCCONS | $AWK '{print $8, $7, $9}'`
  80.         $ECHO $TIOCCONS $fix_date $cur_date $cert_advis $real_date | $BUG
  81.         fi
  82.     done
  83.  
  84. # selection_svc
  85. #
  86. # Patch ID# 100085-03
  87. sel_svc="/bin/sunview1/selection_svc"
  88. fix_date="5 Sep 1990"
  89. cert_advis="CA-90:05"
  90. if $TEST -f "$sel_svc" ; then
  91.     cur_date=`$LS $LS_OPTS $sel_svc | $AWK '{print $8, $7, $9}'`
  92.     $ECHO $sel_svc $fix_date $cur_date $cert_advis $real_date | $BUG
  93.     fi
  94.  
  95. # lpd
  96. #
  97. # Patch ID# 100305-06
  98. lpd="/usr/lib/lpd"
  99. fix_date="12 Sep 1991"
  100. cert_advis="CA-91:10a"
  101. if $TEST -f "$lpd" ; then
  102.     cur_date=`$LS $LS_OPTS $lpd | $AWK '{print $8, $7, $9}'`
  103.     $ECHO $sel_svc $fix_date $cur_date $cert_advis $real_date | $BUG
  104.     fi
  105.  
  106. # /bin/mail
  107. #
  108. # Patch ID# 100224-01 - date in README is off by one year.
  109. bin_mail="/bin/mail"
  110. fix_date="15 Jan 1991"
  111. cert_advis="CA-91:01a"
  112. if $TEST -f "$bin_mail" ; then
  113.     cur_date=`$LS $LS_OPTS $bin_mail | $AWK '{print $8, $7, $9}'`
  114.     $ECHO $bin_mail $fix_date $cur_date $cert_advis $real_date | $BUG
  115.     fi
  116.  
  117. # telnetd and rlogind
  118. #
  119. # Patch ID# 100125-03
  120. fix_date="27 Mar 1991"
  121. cert_advis="CA-91:02a"
  122. telnetd="/usr/etc/in.telnetd"
  123. rlogind="/usr/etc/in.rlogind"
  124. if $TEST -f "$telnetd" ; then
  125.     cur_date=`$LS $LS_OPTS $telnetd | $AWK '{print $8, $7, $9}'`
  126.     $ECHO $telnetd $fix_date $cur_date $cert_advis $real_date | $BUG
  127.     fi
  128. $ECHO $release_level | $GREP 4.1.1 > /dev/null
  129. if $TEST $? -ne "0" -a -f "$rlogind" ; then
  130.     cur_date=`$LS $LS_OPTS $rlogind | $AWK '{print $8, $7, $9}'`
  131.     $ECHO $rlogind $fix_date $cur_date $cert_advis $real_date | $BUG
  132.     fi
  133.  
  134. # makeinstall and winstall
  135. #
  136. # 20 May 1991
  137. # SunOS Source Tape Installation Vulnerability
  138. # fix is to: chmod ug-s /usr/release/bin/{makeinstall, winstall}
  139. cert_advis="CA-91:07"
  140. makeinstall=/usr/release/bin/makeinstall
  141. winstall=/usr/release/bin/winstall
  142. (./is_able $makeinstall s s | $GREP SUID) > /dev/null 2>/dev/null
  143. if $TEST $? -eq "0" ; then
  144.     $ECHO "Warning!  $makeinstall $word_smithing!  ($cert_advis)"
  145.     fi
  146. (./is_able $winstall s s | $GREP SUID )> /dev/null 2>/dev/null
  147. if $TEST $? -eq "0" ; then
  148.     $ECHO "Warning!  $winstall $word_smithing!  ($cert_advis)"
  149.     fi
  150.  
  151.  
  152. # mountd
  153. #
  154. # Patch for SunOS /usr/etc/rpc.mountd
  155. # Patch ID# 100296-01
  156. fix_date="15 Jul 1991"
  157. cert_advis="CA-91:09"
  158. mountd="/usr/etc/rpc.mountd"
  159. if $TEST -f "$mountd" ; then
  160.     cur_date=`$LS $LS_OPTS $mountd | $AWK '{print $8, $7, $9}'`
  161.     $ECHO $mountd $fix_date $cur_date $cert_advis $real_date | $BUG
  162.     fi
  163.  
  164. # divide and conquer, er, multiply...
  165. #
  166. # 18 September 1991
  167. # SunOS SPARC Integer Division Vulnerability
  168. # Patch ID# 100376-01
  169. fix_date="18 Sep 1991"
  170. cert_advis="CA-91:16"
  171. for divide in /sys/sun4*/OBJ/crt.o $KERNEL ; do
  172.     if $TEST -f "$divide" ; then
  173.         cur_date=`$LS $LS_OPTS $divide | $AWK '{print $8, $7, $9}'`
  174.         $ECHO $divide $fix_date $cur_date $cert_advis $real_date | $BUG
  175.         fi
  176.     done
  177.  
  178. # NFS stuff
  179. #
  180. # Patch ID's# 100173-07, 100121-08, 100424-01
  181. # NFS Jumbo 4.1.1, NFS Jumbo 4.1, fsirand 4.1.1
  182. fix_date="6 Dec 1991"
  183. cert_advis="CA-91:21"
  184. for i in /sys/sun*/OBJ/nfs_subr.o $KERNEL ; do
  185.     if $TEST -f "$nfs" ; then
  186.         cur_date=`$LS $LS_OPTS $nfs | $AWK '{print $8, $7, $9}'`
  187.         $ECHO $nfs $fix_date $cur_date $cert_advis $real_date | $BUG
  188.         fi
  189.     done
  190.  
  191. # loadmodule
  192. #
  193. # SunOS OpenWindows V3.0 Patch
  194. # all sun4 and sun4c architectures running SunOS 4.1.1.
  195. # Patch ID# 1076118
  196. loadmodule="$OPENWINHOME/bin/loadmodule"
  197. fix_date="16 Dec 1991"
  198. cert_advis="CA-91:22"
  199. if $TEST -f "$loadmodule" ; then
  200.     host=`$ARCH`
  201.     if $TEST "$host" = "sun4" -o "$host" = "sun4c" ; then
  202.         cur_date=`$LS $LS_OPTS $loadmodule | $AWK '{print $8, $7, $9}'`
  203.         $ECHO $loadmodule $fix_date $cur_date $cert_advis $real_date | $BUG
  204.         fi
  205.     fi
  206.  
  207. # finis
  208.