client_up 778 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. #set -o xtrace
  3. #logfile=/tmp/client_up
  4. #exec >> $logfile 2>&1
  5. #date
  6. echo ===========================================
  7. echo $common_name
  8. echo ===========================================
  9. ext_ovpn=`/sbin/ifconfig external | grep inet | /bin/sed 's/^ *inet addr://g' | /bin/sed 's/ .*//g'`
  10. echo 'Ext_Ovpn '$ext_ovpn
  11. paddr=`grep ifconfig-push "/etc/openvpn/ccd/$common_name" | sed 's/ifconfig-push //g' | sed 's/ .*//g'`
  12. echo 'Paddr '$paddr
  13. #if [ $? -eq 0 ]
  14. #then
  15. [[ ! -z $paddr ]] && /usr/bin/sudo /sbin/ip route add $paddr via $ext_ovpn
  16. #fi
  17. caddr=`grep iroute "/etc/openvpn/ccd/$common_name" | sed 's/iroute //g' | sed 's/ .*//g'`
  18. echo 'Caddr '$caddr
  19. #if [ $? -eq 0 ]
  20. #then
  21. [[ ! -z $caddr ]] && /usr/bin/sudo /sbin/ip route add $caddr via $ext_ovpn
  22. #fi
  23. exit 0