2007-10-26 22:44:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#Stunnel init for xcat:
|
|
|
|
XCATDEST=""
|
2008-04-09 20:22:46 +00:00
|
|
|
XCATPORT=3001
|
|
|
|
killall stunnel > /dev/null 2>&1
|
2007-10-26 22:44:33 +00:00
|
|
|
for parm in `cat /proc/cmdline`; do
|
|
|
|
key=`echo $parm|awk -F= '{print $1}'`
|
|
|
|
if [ "$key" == "xcatd" ]; then
|
|
|
|
XCATDEST=`echo $parm|awk -F= '{print $2}'`
|
2007-10-31 03:42:29 +00:00
|
|
|
XCATPORT=`echo $XCATDEST|awk -F: '{print $2}'`
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
mkdir -p /etc/stunnel
|
|
|
|
echo 'client=yes' > /etc/stunnel/stunnel.conf
|
|
|
|
echo 'foreground=yes' >> /etc/stunnel/stunnel.conf
|
2008-04-09 20:22:46 +00:00
|
|
|
echo 'output=/dev/null' >> /etc/stunnel/stunnel.conf
|
2007-10-26 22:44:33 +00:00
|
|
|
echo 'verify=0' >> /etc/stunnel/stunnel.conf
|
2008-04-09 20:22:46 +00:00
|
|
|
if [ ! -z "$XCATDEST" ]; then
|
|
|
|
echo '[xcatds]' >> /etc/stunnel/stunnel.conf
|
2008-04-14 15:17:26 +00:00
|
|
|
echo 'accept=127.0.0.1:301' >> /etc/stunnel/stunnel.conf
|
2008-04-09 20:22:46 +00:00
|
|
|
echo 'connect='$XCATDEST >> /etc/stunnel/stunnel.conf
|
|
|
|
fi
|
2007-10-31 03:42:29 +00:00
|
|
|
if [ -r /tmp/dhcpserver ]; then
|
2008-04-09 20:22:46 +00:00
|
|
|
let i=400;
|
|
|
|
for srv in `cat /tmp/dhcpserver`; do
|
|
|
|
echo "[xcatd$i]" >> /etc/stunnel/stunnel.conf
|
2008-04-14 15:17:26 +00:00
|
|
|
echo "accept=127.0.0.1:$i" >> /etc/stunnel/stunnel.conf
|
2008-04-09 20:22:46 +00:00
|
|
|
echo "connect="$srv":"$XCATPORT >> /etc/stunnel/stunnel.conf
|
|
|
|
let i=i+1
|
|
|
|
done
|
2007-10-31 03:42:29 +00:00
|
|
|
fi
|
2007-10-26 22:44:33 +00:00
|
|
|
mkdir -p /usr/var/run/stunnel
|
|
|
|
stunnel &
|
2008-04-09 20:22:46 +00:00
|
|
|
sleep 2
|