install_qos_spamhaus
install_qos_spamhaus(){
clear
f_banner
echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
echo -e "\e[93m[+]\e[00m Installing Mod_Qos/Spamhaus"
echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
echo ""
apt-get -y install libapache2-mod-qos
cp templates/qos /etc/apache2/mods-available/qos.conf
apt-get -y install libapache2-mod-spamhaus
cp templates/spamhaus /etc/apache2/mods-available/spamhaus.conf
service apache2 restart
say_done
}
La función install_qos_spamhaus instala los módulos de apache Mod_Qos y Mod_SpamHaus que protegen el servidor de Ataques DOS como el Slowroris (qos), y contra ataques de Inyección DNS usados por los Spammers. Hace uso de las plantillas que se encuentran en templates/qos y templates/spamhaus.
Qos
<IfModule qos_module.so>
# minimum request rate (bytes/sec at request reading):
QS_SrvRequestRate 120
# limits the connections for this virtual host:
QS_SrvMaxConn 100
# allows keep-alive support till the server reaches 600 connections:
QS_SrvMaxConnClose 600
# allows max 50 connections from a single ip address:
QS_SrvMaxConnPerIP 50
#Maximum Number of active TCP connections
MaxClients 192
#Disable keep-alive when 70% of the TCP connections are occupied
QS_SrvMaxConnClose 70%
#Minimum request/response speed
QS_SrvMinDataRate 150 1200
# block clients violating some basic rules frequently (don't allows more than 20
# violations within 5 minutes):
QS_ClientEventBlockCount 20 300
QS_SetEnvIfStatus 400 QS_Block
QS_SetEnvIfStatus 401 QS_Block
QS_SetEnvIfStatus 403 QS_Block
QS_SetEnvIfStatus 404 QS_Block
QS_SetEnvIfStatus 405 QS_Block
QS_SetEnvIfStatus 406 QS_Block
QS_SetEnvIfStatus 408 QS_Block
QS_SetEnvIfStatus 411 QS_Block
QS_SetEnvIfStatus 413 QS_Block
QS_SetEnvIfStatus 414 QS_Block
QS_SetEnvIfStatus 417 QS_Block
QS_SetEnvIfStatus 500 QS_Block
QS_SetEnvIfStatus 503 QS_Block
QS_SetEnvIfStatus 505 QS_Block
QS_SetEnvIfStatus QS_SrvMinDataRate QS_Block
QS_SetEnvIfStatus NullConnection QS_Block
</IfModule>
spamhaus
MS_METHODS POST,PUT,OPTIONS,CONNECT
MS_WhiteList /etc/spamhaus.wl
MS_CacheSize 256