> From: Leonardo Lagos [mailto:[EMAIL PROTECTED]]
> I've also installed patch 112438-01, to enable random support,
> but the file /dev/random is not in my system (I even rebooted
> the machine after installing the patch).

I had the same problem, it's some special kind of
"recognize new device drivers" boot that my system
support person didn't know how to do -- after he
went home I found these scripts on the web:

(There are two scripts here, separated by a line of four ==== signs.
The first is the newer (and is a followup to the second) but what I
actually did was manually type commands from the second script till
it worked...  heck of a way to program, eh?)

====

http://halplant.com:88/software/Solaris/scripts/setup_random

#!/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.
#
# Incoporating suggestions and changes from these SunManager list members:
# Thomas Anders <[EMAIL PROTECTED]>, Dan Astoorian <[EMAIL PROTECTED]>,
# Prƒmm Gerd <[EMAIL PROTECTED]>, Adam Mazza <[EMAIL PROTECTED]>.
# Script rewrite for functional changes and reliability improvement based
# on contribution from from Jeff Bledsoe.

PATH=/usr/bin:/usr/sbin

Patch=${Patch:-112438}  # Just in case it ever changes

# Set up tempfile
TmpFile=/tmp/.$$.$RANDOM ; rm -f $TmpFile ; touch $TmpFile; chmod 600 $TmpFile

function bailout
{ echo "$*. Exiting" >&2 ; exit 1
}

# Check patch is installed
echo "Checking for patch $Patch...\c"
if showrev -p | egrep -s "^Patch: ${Patch}-"
then    echo " installed."
else    bailout " not installed. Install it and try again."
fi

# Activate random kernel module with workaround for module dependency problem
echo "Removing random device from name_to_major"
name_to_major=$(</etc/name_to_major)
echo "$name_to_major" | sed '/random/d' > /etc/name_to_major

# Add driver to create device nodes and load module
echo "Adding driver to system"
add_drv -m '* 0644 root sys' random || bailout "Driver random failed to add"

# Report results
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) \c"
read yn
case $yn in
     [Yy]*) echo "Running: dd if=/dev/random of=$TmpFile bs=512 count=1"
            dd if=/dev/random of=$TmpFile bs=512 count=1
            echo "Running: strings $TmpFile"
            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 $TmpFile
rm -f $TmpFile

exit 0
   
################################################################################
# The remainder of this script never runs, but is left as refernce for use
# and locations of the relvant data and commands.

# 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 with half-decent data source
echo "Priming entropy pool."
alias primepool='dd if=/dev/mem bs=512 count=16 2>&- | crypt $RANDOM'
primepool > /dev/random 2>&- # Gives "/dev/random: cannot create"
primepool > /dev/random      # Runs fine

====

http://www.netsys.com/sunmgr/2002-04/msg00679.html

To: Sun Managers <[EMAIL PROTECTED]> 
Subject: SUMMARY Additional: Application of Solaris 8 patch 112438-01 without
reboot 
From: Andrew J Caines <[EMAIL PROTECTED]> 
Date: Fri, 19 Apr 2002 18:03:23 -0400 

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    [EMAIL PROTECTED] |
| Unix Systems Engineer, WorldCom  [EMAIL PROTECTED] |

#!/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
[EMAIL PROTECTED]
http://www.sunmanagers.org/mailman/listinfo/sunmanagers

-- 

Charles B. (Ben) Cranston
mailto:[EMAIL PROTECTED]
http://www.wam.umd.edu/~zben
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to