#!/bin/sh

# copy the certificates to the right baseconfig dirs.
source ../../umlsetup.sh

# first, move the private keys to the right place
for host in $OPENSWANHOSTS
do
	if [ -f $host.uml.freeswan.org/$host.uml.freeswan.org.key ]
	then
		mkdir -p ../baseconfigs/$host/etc/ipsec.d/private
		cp $host.uml.freeswan.org/$host.uml.freeswan.org.key ../baseconfigs/$host/etc/ipsec.d/private/$host.pem
	fi
done

mkdir -p ../baseconfigs/all/etc/ipsec.d/certs
# now, copy all certificates to "all" directory.
for host in $OPENSWANHOSTS
do
	if [ -f $host.uml.freeswan.org/$host.uml.freeswan.org.key ]
	then
		cp $host.uml.freeswan.org/$host.uml.freeswan.org.cert ../baseconfigs/all/etc/ipsec.d/certs
	fi
done

# copy the caCert to the right place
cp cacert.pem ../baseconfigs/all/etc/ipsec.d/cacerts/caCert.pem

# copy the crl to the right place
cp crls/nic.crl ../baseconfigs/all/etc/ipsec.d/crls/nic.crl


