SUMMARY Additional: Application of Solaris 8 patch 112438-01 without reboot

From: Andrew J Caines (Andrew.J.Caines@wcom.com)
Date: Fri Apr 19 2002 - 18:03:23 EDT


Folks,

A couple of factors were not obvious to me during my initial tests which
are important to consider for anyone following this procedure.

The device major varies and should be taken from /etc/name_to_major.

The random device needs to be primed with some data before it will work.

I have scripted a simple tool to perform all the necessary steps after the
patch application. See attached.

Run setup_random and answer the questions. UID 0 required.

I have tested this and found no problems, but please let me know if you
have any problems, comments, criticisms or money you'd like to give me.

-Andrew-

-- 
 ________________________________________________________________
|  -Andrew J. Caines-   703-886-2689    Andrew.J.Caines@wcom.com |
| Unix Systems Engineer, WorldCom  Andrew.J.Caines+page@wcom.com |
#!/usr/bin/ksh
# Set up Solaris random device from patch 112438-01 without reboot
# Moderate error checking only since this should be straightforward.
#
# (c) 2002 Andrew J. Caines. Permission to modify and distribute is
# granted on condition the copyright message is included and modifications
# are clearly identified.
PATH=/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/proc/bin
Patch=${Patch:-112438}  # Just in case it ever changes
# Check patch is installed
if showrev -p | egrep -s $Patch
then
	echo "Patch $Patch is installed."
else
	echo "Patch $Patch is not installed. Install it and try again." >&2
	exit 1
fi
# Find device major
major=$(nawk '/^random/{print $2}' /etc/name_to_major)
# Make pseudodevices for both devices
echo "Making device nodes."
mknod /devices/pseudo/random@0:random c $major 0
mknod /devices/pseudo/random@0:urandom c $major 1
mode=$(nawk '/^random/{print $2}' /etc/minor_perm)
user=$(nawk '/^random/{print $3}' /etc/minor_perm)
group=$(nawk '/^random/{print $4}' /etc/minor_perm)
chown $user:$group /devices/pseudo/random@0:*random
chmod $mode /devices/pseudo/random@0:*random
# Make dev links
echo "Making device links."
cd /dev
ln -s ../devices/pseudo/random@0:random /dev/random
ln -s ../devices/pseudo/random@0:urandom /dev/urandom
# load the module
echo "Loading driver."
modload /kernel/drv/random
# Prime the pump
echo "Priming entropy pool."
cat /kernel/genunix > /dev/random 2>&- # Gives "/dev/random: cannot create"
cat /kernel/genunix > /dev/random      # Runs fine
echo "Finished. You now have the following random devices:"
ls -l /dev/*random /devices/pseudo/random@0:*random
# Test
echo "Do you want to test the new device? (y/n) "
read yn
case $yn in
     [Yy]*) echo "Running: dd if=/dev/random of=/tmp/random_test bs=512 count=1"
            dd if=/dev/random of=/tmp/random_test bs=512 count=1
	    echo "Running: strings /tmp/random_test"
	    echo "You should see a few lines of random garbage:"
	    ;;
     [Nn]*) echo "Your blind faith will be rewarded in the next life."
            echo "Your reward confiration code is:"
	    ;;
esac
strings /tmp/random_test
rm /tmp/random_test
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:13 EDT