#!/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

# Stop the VPNC process
vpnc-disconnect

# Remove the nat masquerading
iptables --table nat --delete POSTROUTING --out-interface tun0 --jump MASQUERADE
