Entradas

Mostrando las entradas de marzo, 2018

Agregar ó eliminar puertos del firewall de CentOS 7

Agregar servicio de firewalld: # systemctl enable firewalld Eliminar servicio de firewalld: # systemctl enable firewalld Agregar puertos: # firewall-cmd --zone=public --add-port=8080/tcp # firewall-cmd --runtime-to-permanent # firewall-cmd --reload # systemctl restart firewalld # firewall-cmd --zone=public --list-ports Eliminar puertos: # firewall-cmd --zone=public --remove-port=8080/tcp # firewall-cmd --runtime-to-permanent # firewall-cmd --reload # systemctl restart firewalld # firewall-cmd --zone=public --list-ports Ir a la fuente

Limpiar las reglas de Iptables

# Sigue los siguientes comandos para limpiar las Reglas de Iptables: iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT

Bloquear escaneo de puertos en CentOS 7

# Usa lo siguiente para bloquear el escaneo de puertos en CentOS. # flooding of RST packets, smurf attack Rejection iptables -A INPUT -p tcp -m tcp --tcp-flags RST RST -m limit --limit 2/second --limit-burst 2 -j ACCEPT # Protecting portscans # Attacking IP will be locked for 24 hours (3600 x 24 = 86400 Seconds) iptables -A INPUT -m recent --name portscan --rcheck --seconds 600 -j DROP iptables -A FORWARD -m recent --name portscan --rcheck --seconds 600 -j DROP # Remove attacking IP after 24 hours iptables -A INPUT -m recent --name portscan --remove iptables -A FORWARD -m recent --name portscan --remove # These rules add scanners to the portscan list, and log the attempt. iptables -A INPUT -p tcp -m tcp --dport 139 -m recent --name portscan --set -j LOG --log-prefix "portscan:" iptables -A INPUT -p tcp -m tcp --dport 139 -m recent --name portscan --set -j DROP iptables -A FORWARD -p tcp -m tcp --dport 139 -m recent --name portscan --set -j LOG --log-prefix ...

Instalar Devtoolset CentOS 7

Instalar Devtoolset CentOS 7: sudo yum install centos-release-scl sudo yum install devtoolset-7-gcc* scl enable devtoolset-7 bash which gcc gcc --version

Comandos Fail2ban

Fail2ban es un sistema contra los Crackers en la red, que quieren crackear tu sistema (romper la seguridad y entrar a tu servidor de forma ilícita). Fail2ban permite bloquear una IP por largos períodos de tiempo, usando iptables y otros servicios. Con esta guía pueden instalarlo y configurarlo: https://www.booleanworld.com/protecting-ssh-fail2ban/ Y estos son los comando más necesarios: fail2ban-client set <JAIL> addignoreip <IP> fail2ban-client set <JAIL> delignoreip <IP> fail2ban-client set <JAIL> unbanip <IP> fail2ban-client reload Ejemplo de uso: fail2ban-client set ssh-iptables unbanip 192.168.1.156 Vayan a la fuente