20 lines
373 B
Plaintext
20 lines
373 B
Plaintext
|
|
#!/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"
|