|
@@ -106,6 +106,16 @@ if [ "$vh" = "y" ]; then
|
|
|
chmod -R g+w /var/www/"$_domain"/
|
|
|
chmod -R g+r /var/www/"$_domain"/
|
|
|
|
|
|
+ #set fail2ban for vhost
|
|
|
+ # https://stackoverflow.com/a/65552146
|
|
|
+ cp "$_assets/fail2ban/jail.d/nginx-badbots.conf" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
|
|
+ sed -i -r "s/\[nginx-badbots\]/\[nginx-badbots-$_domain\]/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
|
|
+ sed -i -r "s/<FILTER>/\[nginx-badbots-$_domain\]/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
|
|
+ sed -i -r "s/<LOGPATH>/\/var\/www\/$_domain\/log\/error.log/g" "/etc/fail2ban/jail.d/nginx-badbots-$_domain.conf"
|
|
|
+
|
|
|
+ cp "$_assets/fail2ban/filter.d/nginx-badbots.conf" "/etc/fail2ban/filter.d/nginx-badbots-$_domain.conf"
|
|
|
+ sed -i -r "s/<HOST>/$_domain/g" "/etc/fail2ban/filter.d/nginx-badbots-$_domain.conf"
|
|
|
+
|
|
|
|
|
|
|
|
|
# create a shortcut to the site
|