Added optional whitelist feature

This commit is contained in:
2023-04-21 11:43:22 +02:00
parent 4da32724dc
commit ade06e1945
6 changed files with 39 additions and 5 deletions

22
run-rexuiz.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
if [ "$WHITELIST_ENABLED" = "true" ]; then
# Load in allowed IPs from file
mapfile -t allowed_ips < /home/rexuiz/.rexuiz/data/allowed_ips.txt
# Enable UFW firewall
ufw --force reset
ufw default deny incoming
ufw default allow outgoing
# Allow specified IPs
for ip in "${allowed_ips[@]}"
do
ufw allow from "$ip" to any port 26000 proto udp
done
ufw --force enable
fi
# Start server
su rexuiz -c "/home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64"