#!/bin/bash # Default policies sudo /usr/bin/ufw default deny incoming sudo /usr/bin/ufw default deny outgoing # Openvpn interface (adjust interface accordingly to your configuration) sudo /usr/bin/ufw allow out on tun0 # Openvpn (adjust port accordingly to your vpn setup) sudo /usr/bin/ufw allow out to any port 1194 # process arguments while getopts "t:" opt; do case ${opt} in t) echo "allow outgoing traffic to $OPTARG" sudo /usr/bin/ufw allow out to $OPTARG;; esac done