Просмотр исходного кода

Merge pull request #1369 from cdnmall/patch-2

 improved fail2ban support for vsftpd
Serghey Rodin 8 лет назад
Родитель
Сommit
ca76ac2ba5
2 измененных файлов с 18 добавлено и 0 удалено
  1. 9 0
      install/vst-install-rhel.sh
  2. 9 0
      install/vst-install-ubuntu.sh

+ 9 - 0
install/vst-install-rhel.sh

@@ -1227,6 +1227,15 @@ if [ "$fail2ban" = 'yes' ]; then
         fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
         fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
         sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
         sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
     fi
     fi
+    if [ "$vsftpd" = 'yes' ]; then
+        #Create vsftpd Log File
+        if [ ! -f "/var/log/vsftpd.log" ]; then
+            touch /var/log/vsftpd.log
+        fi
+        fline=$(cat /etc/fail2ban/jail.local |grep -n vsftpd-iptables -A 2)
+        fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
+        sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
+    fi 
     chkconfig fail2ban on
     chkconfig fail2ban on
     /bin/mkdir -p /var/run/fail2ban
     /bin/mkdir -p /var/run/fail2ban
     sed -i "s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/fail2ban/g" /usr/lib/systemd/system/fail2ban.service
     sed -i "s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/fail2ban/g" /usr/lib/systemd/system/fail2ban.service

+ 9 - 0
install/vst-install-ubuntu.sh

@@ -1172,6 +1172,15 @@ if [ "$fail2ban" = 'yes' ]; then
         fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
         fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
         sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
         sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
     fi
     fi
+    if [ "$vsftpd" = 'yes' ]; then
+        #Create vsftpd Log File
+        if [ ! -f "/var/log/vsftpd.log" ]; then
+            touch /var/log/vsftpd.log
+        fi
+        fline=$(cat /etc/fail2ban/jail.local |grep -n vsftpd-iptables -A 2)
+        fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
+        sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
+    fi 
     update-rc.d fail2ban defaults
     update-rc.d fail2ban defaults
     service fail2ban start
     service fail2ban start
     check_result $? "fail2ban start failed"
     check_result $? "fail2ban start failed"