flush_firewall.sh
***NOTA*** Editar el archivo e indicar el puerto SSH en el apartado #5
This commit is contained in:
commit
e30c62ee2f
1 changed files with 48 additions and 0 deletions
48
flush_firewall.sh
Normal file
48
flush_firewall.sh
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 1. Políticas por defecto
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -P FORWARD ACCEPT
|
||||
iptables -P OUTPUT ACCEPT
|
||||
|
||||
# 2. Limpieza total de reglas y cadenas personalizadas
|
||||
iptables -F
|
||||
iptables -X
|
||||
iptables -Z
|
||||
|
||||
# 3. Permitir tráfico de Loopback y conexiones ya establecidas
|
||||
iptables -A INPUT -i lo -j ACCEPT
|
||||
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
# 4. ICMP (Ping)
|
||||
iptables -A INPUT -p icmp -j ACCEPT
|
||||
|
||||
# 5. SSH (Puerto personalizado actual 22171 y estándar 22 por seguridad)
|
||||
iptables -A INPUT -p tcp --dport INDICAR-PORT -j ACCEPT
|
||||
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||
|
||||
# 6. REGLAS SEGÚN PLANTILLA HETZNER (FIREWALL-PBX-V2)
|
||||
|
||||
# ADMINISTRACION SOLO OFICINA (Sustituye la IP si cambia)
|
||||
iptables -A INPUT -s 186.96.24.214 -p tcp -j ACCEPT
|
||||
|
||||
# SERVICIO ZABBIX
|
||||
iptables -A INPUT -s 5.161.85.196 -p tcp -j ACCEPT
|
||||
|
||||
# TELINTA DATA NETWORK
|
||||
iptables -A INPUT -s 208.89.106.17 -p udp -j ACCEPT
|
||||
|
||||
# SERVIDOR VPN (OPEN VPN)
|
||||
iptables -A INPUT -s 2.29.9.161 -j ACCEPT
|
||||
|
||||
# RANGO EXTENSIONES PJSIP/SIP (UDP 5060:5066)
|
||||
iptables -A INPUT -p udp --dport 5060:5066 -j ACCEPT
|
||||
|
||||
# TLS (TCP 5061)
|
||||
iptables -A INPUT -p tcp --dport 5061 -j ACCEPT
|
||||
|
||||
# RTP (UDP 10000:20000)
|
||||
iptables -A INPUT -p udp --dport 10000:20000 -j ACCEPT
|
||||
|
||||
# 7. Regla por defecto al final (Bloquear todo lo demás)
|
||||
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
|
||||
Loading…
Reference in a new issue