Secure PHPMyadmin & TxAdmin

Whitelist_IP

Some hackers use indirect methods to bring down your FiveM server. One of their most well-known techniques is to overload your TxAdmin and PhpMyAdmin (apache2/nginx) with application requests. This results in the exhaustion of RAM/CPU resources, ultimately causing your FiveM server to crash as well. How can you secure against this on Linux? Simply execute the following commands during the startup of your VPS to only allow the IPs you've chosen for your TxAdmin and web server (PhpMyAdmin). Here's a list of iptables/ipset commands to achieve this on Linux via SSH (Just paste these commands in SSH, if no response is given, it means everything went smoothly):

apt-get update && apt-get install ipset -y
ipset create WL hash:ip maxelem 999999 
iptables -t raw -A PREROUTING -s 127.0.0.1 -j ACCEPT 
iptables -t raw -A PREROUTING -m set --match-set WL src -j ACCEPT 
iptables -t raw -A PREROUTING -p tcp --dport 40120 -j DROP 
iptables -t raw -A PREROUTING -p udp --dport 40120 -j DROP 
iptables -t raw -A PREROUTING -p tcp --dport 80 -j DROP 
iptables -t raw -A PREROUTING -p udp --dport 80 -j DROP

To authorize an IP address, simply type the following command, followed by the IP address you wish to allow:

ipset add WL IP_address

By running these commands, you effectively restrict access to your FiveM server, enhancing its security against potential hacker attacks.

Last updated