Skip to content

Instantly share code, notes, and snippets.

@libcrack
Created July 28, 2016 15:27
Show Gist options
  • Select an option

  • Save libcrack/f5f04a58f6d2cf4485189e3eed95ee54 to your computer and use it in GitHub Desktop.

Select an option

Save libcrack/f5f04a58f6d2cf4485189e3eed95ee54 to your computer and use it in GitHub Desktop.
OpenVPN post-up script
#!/usr/bin/env bash
# Thu Jul 28 17:11:50 CEST 2016
#
# Parameters when this script is executed from openvpn(4)
# tun0 1500 1544 10.200.200.74 10.200.200.73 init
# $1 $2 $4 $4 $5 $6
#
iface="${1}"
server="${4}"
client="${5}"
net='10.0.0.0/24'
ip route -n 2>/dev/null | grep -q "${net}" && {
printf "Detected already present route to \e[31m${net}\e[0m\n"
printf "Deleting route to network \e[32m${net}\e[0m\n"
ip route delete "${net}"
}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment