Hi everybody,
I installed a firewall on my new server. This is the configuration:
I just want to open web ports and mysql port. So the rules works for that. But I would like some advice. Do the rules seem effective to protect the server? I think about this part:
Is it effective against attacks like little ddos or flood SYN? I would like to protect my server against ddos attacks and flood SYN or just limit their impact. So are there other rules to protect the server against ddos attacks? How can I improve the syntax?
And I created the file /etc/abusive_hosts to use in combination with a script. I would like to know if there is some scripts which look at the port tcp to ban some IP and put them in this file. If you know some scripts like this, are they effective and can you show me some of them?
I installed a firewall on my new server. This is the configuration:
Code:
ext_if = "em0"
myserver = "myserverip"
# Déclaration du tableau référençant toutes les adresses IP affectées au
# pare-feu.
table <firewall> const { self }
# Ne pas filtrer sur l'interface de bouclage
set skip on lo0
# Normalisation de tous les paquets entrants.
scrub in all
# Mise en place d'une politique d'interdiction par défaut.
block all
# Activation de la protection contre l'usurpation sur toutes les
# interfaces.
block in quick from urpf-failed
# Antispoof bloque les paquets usurpés
antispoof quick for em0 inet
# Créer la table abusive_hosts pour bloquer les IP floodeuses
table <flooders> persist
block in quick from <flooders>
table <abusive_hosts> persist file "/etc/abusive_hosts"
block in quick from <abusive_hosts>
# Autoriser connexions mais les surveiller via mandataire TCP SYN et les limiter
pass in log on $ext_if proto tcp to $myserver port www synproxy state \
(max-src-conn 100, max-src-conn-rate 15/5, overload <flooders> flush)
# Autoriser les connexions sortantes tcp, udp et icmp sur l'interface
# externe.
# les connexions tcp seront modulées, et udp/icmp auront un suivi
# d'état.
pass out on $ext_if proto { tcp udp icmp } all modulate state
# Autoriser les connexions ssh sur l'interface externe du moment
# qu'elles ne sont pas destinées au pare-feu lui-même. Journaliser le
# paquet qui initie la session afin de pouvoir déterminer qui s'est
# connecté. Activer un service mandataire SYN.
# Les drapeaux par défaut "S/SA" seront automatiquement appliqués à la
# règle par PF.
pass in log on $ext_if proto tcp to port ssh synproxy state \
(max-src-conn 100, max-src-conn-rate 15/5, overload <flooders> flush)
# MySQL
pass in quick on $ext_if proto tcp from any \
to $ext_if port 3306 synproxy state
I just want to open web ports and mysql port. So the rules works for that. But I would like some advice. Do the rules seem effective to protect the server? I think about this part:
Code:
(max-src-conn 100, max-src-conn-rate 15/5, overload <flooders> flush)
Is it effective against attacks like little ddos or flood SYN? I would like to protect my server against ddos attacks and flood SYN or just limit their impact. So are there other rules to protect the server against ddos attacks? How can I improve the syntax?
And I created the file /etc/abusive_hosts to use in combination with a script. I would like to know if there is some scripts which look at the port tcp to ban some IP and put them in this file. If you know some scripts like this, are they effective and can you show me some of them?