2007-10-26 22:44:33 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
2008-09-18 21:12:21 +00:00
|
|
|
#
|
|
|
|
# Raw commands to set BMCs to defaults
|
2008-09-30 13:59:10 +00:00
|
|
|
# dx320
|
|
|
|
# 0x2e 0x10 0x4d 0x4f 0x00 0xff
|
|
|
|
#
|
2008-09-18 21:12:21 +00:00
|
|
|
# dx340
|
|
|
|
# 0x30 0x13 0xff 0x00 0x00 0x00
|
|
|
|
#
|
2008-09-30 13:59:10 +00:00
|
|
|
# dx360/x3450
|
2008-09-18 21:12:21 +00:00
|
|
|
# 0x30 0x02 0x43 0x4c 0x52 0xaa
|
|
|
|
# 0x08 0x00 0x49 0x4e 0x54 0x45 0x4c
|
|
|
|
# 0x08 0x04
|
|
|
|
#
|
2008-09-06 22:36:02 +00:00
|
|
|
allowcred.awk &
|
|
|
|
CREDPID=$!
|
2007-10-26 22:44:33 +00:00
|
|
|
modprobe ipmi_si
|
|
|
|
modprobe ipmi_devintf
|
2007-10-31 03:42:29 +00:00
|
|
|
while ! getipmi
|
2007-10-26 22:44:33 +00:00
|
|
|
do
|
|
|
|
echo "Retrying retrieval of IPMI settings from server"
|
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TIMEOUT=15
|
2008-09-06 22:36:02 +00:00
|
|
|
kill $CREDPID
|
2007-10-26 22:44:33 +00:00
|
|
|
BMCIP=`grep bmcip /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
|
|
|
BMCGW=`grep gateway /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
|
|
|
BMCNM=`grep netmask /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
|
|
|
BMCUS=`grep username /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
|
|
|
BMCPW=`grep password /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
2008-10-30 15:22:31 +00:00
|
|
|
IPMIVER=`ipmitool mc info|grep ^IPMI|awk '{print $4}'`
|
2009-03-02 20:12:48 +00:00
|
|
|
IPMIMFG=`ipmitool mc info|grep "^Manufacturer ID"|awk '{print $4}'`
|
|
|
|
if [ "$IPMIMFG" == 2 ]; then #IBM
|
|
|
|
IBMFAM=`ipmitool raw 0x3a 0x50 |head -n 1| awk '{print $1 $2 $3 $4}'`
|
|
|
|
if [ "$IBMFAM" == "59554f4f" ]; then
|
|
|
|
#BMC YUOO family insists that username change on each set
|
|
|
|
if [ -z "$BMCUS" ]; then #blank user, set to foo first
|
|
|
|
ipmitool user set name 2 "foo";
|
|
|
|
else
|
|
|
|
TEMPUSER=`echo $BMCUS|sed -e 's/'^.//'`
|
|
|
|
if [ -z "$TEMPUSER" ]; then #was one character, set it to foo first
|
|
|
|
ipmitool user set name 2 "foo";
|
|
|
|
else #still non blank, can use tempuser as safe temporary value
|
|
|
|
ipmitool user set name 2 $TEMPUSER
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
BMCPORT=`grep bmcport /tmp/ipmi.data |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
|
|
|
if [ ! -z "$BMCPORT" ]; then
|
|
|
|
ipmitool raw 0xc 1 1 0xc0 $BMCPORT
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 ipsrc static; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 ipaddr $BMCIP; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 netmask $BMCNM; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2007-10-26 22:44:33 +00:00
|
|
|
if [ ! -z "$BMCGW" ]; then
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 defgw ipaddr $BMCGW; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user disable 1; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user disable 3; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user disable 4; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user enable 2; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user priv 2 4 1; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user set name 2 $BMCUS; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool user set password 2 $BMCPW; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2007-10-26 22:44:33 +00:00
|
|
|
echo "Set up following user table: "
|
|
|
|
ipmitool user list 1
|
|
|
|
|
2008-01-16 01:53:29 +00:00
|
|
|
|
|
|
|
echo "Enabling Channel 1: "
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool raw 0x6 0x40 0x1 0x42 0x44; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool raw 0x6 0x40 0x1 0x82 0x84; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
2008-01-16 01:53:29 +00:00
|
|
|
|
2008-10-30 15:22:31 +00:00
|
|
|
echo -n "Enabling ARP responses: "
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 arp respond on; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
echo -n .
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
|
|
|
echo
|
2008-01-16 01:53:29 +00:00
|
|
|
|
|
|
|
echo "Enabling IPMI v 1.5 MD5 LAN access:"
|
2008-10-02 19:01:40 +00:00
|
|
|
while ! ipmitool lan set 1 auth admin md5; do
|
|
|
|
sleep 1
|
2008-10-30 15:22:31 +00:00
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
2008-10-02 19:01:40 +00:00
|
|
|
done
|
2008-10-30 15:22:31 +00:00
|
|
|
TRIES=0
|
|
|
|
if [ ! "$IPMIVER" == "1.5" ]; then
|
|
|
|
echo "Enabling IPMI v 2.0 LAN access:"
|
2009-02-11 15:55:29 +00:00
|
|
|
SUPPORTEDSUITES=`ipmitool lan print 1|grep Suites|awk -F: '{print $2}'|sed -e 's/ 0//'`
|
|
|
|
PRIVS="X"
|
|
|
|
for priv in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
|
|
|
|
if echo $SUPPORTEDSUITES|grep $priv > /dev/null; then
|
|
|
|
PRIVS="$PRIVS"a
|
|
|
|
else
|
|
|
|
PRIVS="$PRIVS"X
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
while ! ipmitool lan set 1 cipher_privs $PRIVS; do
|
2008-10-30 15:22:31 +00:00
|
|
|
sleep 1
|
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
|
|
|
done
|
|
|
|
TRIES=0
|
2008-01-16 01:53:29 +00:00
|
|
|
|
2008-10-30 15:22:31 +00:00
|
|
|
echo "Enabling SOL for channel 1"
|
|
|
|
while ! ipmitool raw 0xc 0x21 0x1 0x1 0x1; do
|
|
|
|
sleep 1
|
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
|
|
|
done
|
|
|
|
TRIES=0
|
|
|
|
|
|
|
|
echo "Enabling SOL for user 2"
|
|
|
|
while ! ipmitool raw 6 0x4c 1 2 2 0 0 0; do
|
|
|
|
sleep 1
|
|
|
|
let TRIES=TRIES+1
|
|
|
|
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
|
|
|
done
|
|
|
|
fi
|
2008-01-16 01:53:29 +00:00
|
|
|
|
2008-09-22 23:40:33 +00:00
|
|
|
allowcred.awk &
|
|
|
|
CREDPID=$!
|
2008-10-30 15:22:31 +00:00
|
|
|
#frume.awk
|
2008-09-22 23:40:33 +00:00
|
|
|
kill $CREDPID
|
|
|
|
|
2008-05-21 18:03:46 +00:00
|
|
|
echo "Lighting Identify Light"
|
2008-10-02 19:01:40 +00:00
|
|
|
while :
|
2008-10-30 15:22:31 +00:00
|
|
|
do ipmitool raw 0 4 10 > /dev/null
|
2008-10-02 19:01:40 +00:00
|
|
|
sleep 5
|
|
|
|
done &
|
2008-05-21 18:03:46 +00:00
|
|
|
|