[Edit]
So I somehow manage to do it but I would like to have some opinion on it
So I created a connect.sh script that actually manage to do it but need to be configured, and I used the client-config-dir like this
if [ ! -f configDir/${common_name} ]; then
if ! grep -q "${common_name}" ipp.txt; then
regexCA="^CA.*";
outSet=255
if [[ ${common_name} =~ $regexCA ]]; then
i=2;
while grep -q "10.0.0.$i" ipp.txt ;
do
if [ $i == $outSet ] ; then
break ;
fi
((i=$i+1));
done
if [ $i == $outSet ] ; then
exit 1;
fi
echo "10.0.0.$i, ${common_name}" >> ipp.txt;
echo "ifconfig-push 10.0.0.$i 255.255.255.0" > configDir/${common_name};
echo "ifconfig-push 10.0.0.$i 255.255.255.0" > $1
else
i=2;
while grep -q "10.0.1.$i" ipp.txt ;
do
if [ $i == $outSet ]
then
break;
fi
((i=$i+1));
done
if [ $i == $outSet ] ; then
exit 1;
fi
echo "10.0.1.$i, ${common_name}" >> ipp.txt;
echo "ifconfig-push 10.0.1.$i 255.255.255.0" > configDir/${common_name};
echo "ifconfig-push 10.0.1.$i 255.255.255.0" > $1
fi
fi
fi
exit 0;
Tell me what you think about it
I will also need to think about how must I set up the gateway