Add forwarding script to Tank of Freedom II

This commit is contained in:
DeathByDenim 2024-02-11 14:23:51 -05:00
parent a6f858422a
commit 0ec5e1a2e2
Signed by: DeathByDenim
GPG Key ID: 89185F675E0AB7D5
2 changed files with 38 additions and 0 deletions

View File

@ -122,6 +122,8 @@ done
firewall-cmd --reload
systemctl restart nginx
cp "$(dirname "$0")"/scripts/forward_* /usr/local/bin
echo
echo "Installation complete. Password is ${systempassword}"
if [ -n "$failed_games" ]; then
@ -131,6 +133,10 @@ if [ -n "$failed_games" ]; then
echo "Use /usr/local/bin/redeploy.sh [game] to try again"
fi
echo "For games that don't have a proper game server, you can type"
echo " forward_GAMENAME.sh YOURIP"
echo "to forward traffic going to ${DOMAINNAME} to your IP"
cat > /usr/local/bin/redeploy.sh <<EOF
#!/bin/bash
export stk_version="latest"

View File

@ -0,0 +1,32 @@
#!/bin/bash
# Collection of scripts to deploy a server hosting several open-source games
# Copyright (C) 2022 Jarno van der Kolk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -e
if [ -z $1 ]; then
echo "Usage: $(basename $0) [YOUR IP]"
exit 1
fi
yourip="$1"
firewall-cmd --permanent --add-masquerade
firewall-cmd --permanent --add-port=3939/udp
firewall-cmd --permanent --add-port=3940/udp
firewall-cmd --permanent --add-forward-port=port=3939:proto=udp:toport=3939:toaddr=${yourip}
firewall-cmd --permanent --add-forward-port=port=3940:proto=udp:toport=3940:toaddr=${yourip}
firewall-cmd --reload