I'd use 'topology subnet' to assing IPs and the rough idea for the client-connect would be something like
#!/bin/bash
num_attempts=10
while [ $num_attempts -gt 0 ]
do
POOL=192.168.100
# generate the last IP digits randomly between 16 and 48
RANDIP=$POOL.`echo 16+32*$RANDOM/32768 | bc`
# not taken yet?
if [ ! -r /etc/openvpn/ip-pool/$RANDIP ]
then
# take it
touch /etc/openvpn/ip-pool/$RANDIP
# write out the ifconfig line to $1 which is picked up by openvpn
echo "push \"ifconfig $RANDIP 255.255.255.0\"" > $1
fi
let num_attempts--
done
echo "ERROR: could not assign a random address in 10 attempts - aborting!" 1>&2
and a 'client-disconnect' would delete the assigned IP:
#!/bin/bash
rm -f /etc/openvpn/ip-pool/$ifconfig_pool_remote_ip