#!/bin/bash
# Managed by Zoox Ansible role vpnc

set -euo pipefail

if [[ $UID != 0 ]];
then
    echo "Please run this script with sudo:"
    echo "sudo $0 $*"
    exit 1
fi

vpnc

# Setup the nat masquerading, this is required to route traffic over VPN tunnel
iptables --table nat --append POSTROUTING --out-interface tun0 --jump MASQUERADE
