Added Mordhau-Open-Ports.bash
This commit is contained in:
parent
7ce518369f
commit
8c72ea3f31
14
Mordhau/Mordhau-Open-Ports.bash
Executable file
14
Mordhau/Mordhau-Open-Ports.bash
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash --posix
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
firewall-cmd --add-port 7770-7779/tcp --permanent
|
||||||
|
firewall-cmd --add-port 27000-27009/tcp --permanent
|
||||||
|
firewall-cmd --add-port 15000-15009/tcp --permanent
|
||||||
|
firewall-cmd --add-port 26000-26009/tcp --permanent
|
||||||
|
|
||||||
|
echo "All ports open for Mordhau servers - reloading firewall-cmd..."
|
||||||
|
|
||||||
|
firewall-cmd --reload
|
||||||
|
|
||||||
|
echo "Finished opening ports."
|
@ -24,7 +24,6 @@ usage() {
|
|||||||
All above flags must be passed with arguments"
|
All above flags must be passed with arguments"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
printf '%s\n' "$1" >&2
|
printf '%s\n' "$1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -32,7 +31,7 @@ error() {
|
|||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|-\?|--help)
|
-h | -\? | --help)
|
||||||
usage # Display a usage synopsis.
|
usage # Display a usage synopsis.
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
@ -60,14 +59,19 @@ while :; do
|
|||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
*) # Default case: No more options, so break out of the loop.
|
*) # Default case: No more options, so break out of the loop.
|
||||||
break
|
break ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[[ "${IP}" == "" ]] && error "--ip requires an argument"
|
||||||
|
[[ "${FORWARD_PORT}" == "" ]] && error "--forward-port requires an argument"
|
||||||
|
[[ "${INBOUND_PORT}" == "" ]] && error "--inbound-port requires an argument"
|
||||||
|
|
||||||
firewall-cmd --permanent --add-forward-port=port="${INBOUND_PORT}":proto=tcp:toaddr="${IP}":toport="${FORWARD_PORT}"
|
firewall-cmd --permanent --add-forward-port=port="${INBOUND_PORT}":proto=tcp:toaddr="${IP}":toport="${FORWARD_PORT}"
|
||||||
firewall-cmd --permanent --add-port="${INBOUND_PORT}"/tcp
|
firewall-cmd --permanent --add-port="${INBOUND_PORT}"/tcp
|
||||||
firewall-cmd --add-masquerade
|
firewall-cmd --add-masquerade
|
||||||
|
firewall-cmd --reload
|
||||||
|
|
||||||
echo "Routing all data on ${INBOUND_PORT} to ${IP}${FORWARD_PORT}"
|
echo "Routing all data on ${INBOUND_PORT} to ${IP}:${FORWARD_PORT}"
|
Loading…
Reference in New Issue
Block a user