#!/bin/bash # Default policies sudo ufw default deny incoming sudo ufw default deny outgoing # Openvpn interface (adjust interface accordingly to your configuration) sudo ufw allow out on tun0 # Openvpn (adjust port accordingly to your vpn setup) sudo 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 ufw allow out to $OPTARG;; esac done