Files

20 lines
373 B
Plaintext
Raw Permalink Normal View History

2025-11-13 17:45:47 +07:00
#!/bin/bash
n="$(basename $0)"
quit() {
printf "%s: %s\n" "$n" "$1"
exit 1
}
usage() {
printf "UFW Allow Port for WireGuard interface.\n"
printf "usage: %s <tcp,udp> <XX>\n" "$n"
exit 0
}
[[ -z $1 && -z $2 ]] && usage
[[ -z $1 ]] && quit "Required Protocol (tcp,udp)"
[[ -z $2 ]] && quit "Required Port Number"
sudo ufw allow in on wg0 proto "$1" to any port "$2"