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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#!/bin/sh
hostname=$(hostname)
copy_if()
{
local d=$1 ; shift
rm -f ${d}
local s
for s in "$@" ; do
test ! -r ${s} && continue
if test -r ${d} ; then
echo "duplicate ${d}: $@" 1>&2
exit 1
fi
mkdir -p $(dirname ${d})
cp -v ${s} ${d}
chmod u=r,go= ${d}
done
}
log_if() {
local d=$1
rm -f /tmp/${d}.log
if test -r ${2} ; then
ln -s $PWD/OUTPUT/${hostname}.${d}.log /tmp/${d}.log
fi
}
#
# Libreswan
#
# install stuff into ${etc}/ipsec.*
#
case $(uname) in
Linux ) etc=/etc ;;
*BSD ) etc=/usr/local/etc ;;
esac
rm -rf ${etc}/ipsec.d
mkdir ${etc}/ipsec.d
for s in conf secrets ; do
copy_if ${etc}/ipsec.${s} ${hostname}.${s} ipsec.${s}
done
log_if pluto ${etc}/ipsec.conf
#
# IKED
#
# Install stuff into /etc/*.conf
#
for n in iked.conf ; do
copy_if /etc/iked.conf ${hostname}.${n} ${n}
done
log_if iked /etc/iked.conf
#
# Racoon
#
# Install stuff into /etc/racoon/*
#
rm -rf /etc/racoon
for p in racoon.conf psk.txt ; do
copy_if /etc/racoon/${p} ${hostname}.${p} ${p}
done
log_if racoon /etc/racoon/racoon.conf
case $(uname) in
*BSD ) stty -oxtabs ;;
esac
|