•  
     

Configurando Firewall Linux - CentOS - HLDS - Server de Counter-Strike

Crie um arquivo com o nome myfirewall e adicione esse código:

Código: Selecionar todos


#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p udp -m udp --sport 1025:65355 --dport 27015 -j ACCEPT 
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v



Envie o myfirewall para /home e depois use esses comandos:

Código: Selecionar todos

cd /home
chmod +x myfirewall
./myfirewall


Isso bloqueia todas as portas e libera a porta 27015 do seu server e a 22 do SSH