File: isnssetup

package info (click to toggle)
open-isns 0.101-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,420 kB
  • sloc: ansic: 19,981; sh: 3,211; python: 1,083; perl: 839; makefile: 214
file content (52 lines) | stat: -rwxr-xr-x 1,252 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
#
# isnssetup - bootstrap open-isns server
#
# Copyright (C) 2007 Olaf Kirch <olaf.kirch@oracle.com>
#
# This is a very simple script to bootstrap an iSNS server.
# It creates the necessary keys, enrolls a control node,
# and enrolls the local host as target and initiator.

hostname=`hostname -f`

if [ -f isnsd -a -d isnsadm ]; then
	PATH=.:$PATH
fi

# Massage the configuration file
for f in isnsadm.conf isnsdd.conf; do
	etcfile=/etc/isns/$f
	sed -e 's/^#*\(ServerAddress[[:space:]]*=\).*/\1 localhost/' \
	    -e 's/^#*\(Security[[:space:]]*=\).*/\1 1/' \
			$etcfile > $etcfile.tmp
	mv $etcfile.tmp $etcfile
done

echo "*** Initializing server security ***"
isnsd --init
cp /etc/isns/auth_key.pub /etc/isns/server_key.pub

if ps ax|grep isnsd | grep -qv grep; then
	killall -TERM isnsd
	sleep 1
fi
isnsd
sleep 1

echo "*** Registering control node policy ***"
rm -f /etc/isns/control.key
isnsadm --local \
	--keyfile=/etc/isns/control.key \
	--enroll isns.control \
	node-type=ALL functions=ALL object-type=ALL

echo "*** Registering control node ***"
isnsadm --local \
	--register control

echo "*** Registering policy for server ***"
isnsadm --control \
	--enroll $hostname \
	key=/etc/isns/auth_key.pub \
	node-type=target+initiator