Changes

From SME Server
Jump to navigationJump to search
190 bytes added ,  21:25, 30 July 2022
m
Line 25: Line 25:  
{{Note box|The SME feature [http://wiki.contribs.org/AutoBlock AutoBlock SSH] should be disabled to ensure that fail2ban controls SSH traffic and not the SME build-in firewall.}}
 
{{Note box|The SME feature [http://wiki.contribs.org/AutoBlock AutoBlock SSH] should be disabled to ensure that fail2ban controls SSH traffic and not the SME build-in firewall.}}
   −
== Installation sme8 and sme9 ==
+
==Koozali SME v9/v10==
Configure EPEL's repository:
  −
For SME 8.x,
     −
/sbin/e-smith/db yum_repositories set epel repository \
+
{{#smeversion: smeserver-fail2ban}}
Name 'Epel - EL5' \
  −
BaseUrl 'http://download.fedoraproject.org/pub/epel/5/$basearch' \
  −
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch' \
  −
EnableGroups no \
  −
GPGCheck yes \
  −
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
  −
Visible no \
  −
status disabled
     −
<onlyinclude>{{#ifeq:{{{transcludesection|epel9}}}|epel9|
+
== Installation Koozali SME==
For SME 9.x,
+
<tabs container><tab name="For SME 10">
  /sbin/e-smith/db yum_repositories set epel repository \
+
  yum --enablerepo=smecontribs install smeserver-fail2ban
Name 'Epel - EL6' \
+
</tab><tab name="For SME 9">
BaseUrl 'http://download.fedoraproject.org/pub/epel/6/$basearch' \
  −
MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch' \
  −
EnableGroups no \
  −
GPGCheck yes \
  −
GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
  −
Visible no \
  −
status disabled
  −
}}</onlyinclude>
     −
signal-event yum-modify
+
* install the rpms
 
  −
*install the rpms
  −
 
  −
yum --enablerepo=contribs --enablerepo=epel install smeserver-fail2ban
      +
yum --enablerepo=smecontribs install smeserver-fail2ban
    
* Apply the needed configuration:
 
* Apply the needed configuration:
Line 69: Line 48:  
  db configuration setprop masq status enabled
 
  db configuration setprop masq status enabled
 
  signal-event post-upgrade; signal-event reboot
 
  signal-event post-upgrade; signal-event reboot
      
{{warning box| Failing to run either of these command will completely lock network access next time iptables rules are reloaded}}
 
{{warning box| Failing to run either of these command will completely lock network access next time iptables rules are reloaded}}
 
{{warning box| The masq service must be enabled for fail2Ban to work correctly. If you disable it, Fail2ban won't ban anything}}
 
{{warning box| The masq service must be enabled for fail2Ban to work correctly. If you disable it, Fail2ban won't ban anything}}
 +
</tab>
 +
</tabs>
 +
{{warning box| Starting SME10 and smeserver-fail2ban 0.1.18-29, manual change of configuration is included in core backup, if you use .local files in  the folders action.d/                fail2ban.d/        filter.d/        jail.d/. Any change to rpm owned .conf file is not added in core backup. Use the .local files to override the conf file instead and it will be in the backup. See http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Configuration.}}
    
== Disable SME Feature AutoBlock SME 9 or greater ==
 
== Disable SME Feature AutoBlock SME 9 or greater ==
Line 85: Line 66:     
==DB command==
 
==DB command==
While there is a panel in the server-manager,  in the server-manager, you can manage the contrib by the db configuration, it is quite simple
+
While there is a panel in the server-manager, you can also manage the contrib by the db configuration, it is quite simple
    
  # config show fail2ban  
 
  # config show fail2ban  
Line 289: Line 270:  
           smeserver-sendmail[name="Recidive",dest=root]
 
           smeserver-sendmail[name="Recidive",dest=root]
    +
====Custom local filters====
 +
 +
You can add your custom rules by adding a filtername.local file in /etc/fail2ban/filters.d/
 +
wget https://bugs.koozali.org/attachment.cgi?id=6229 -O /etc/fail2ban/filters.d/apache-badbots.local
 +
 +
would be an example of local bad bots rules, be careful to test for your personal case. Some advanced rules could create a lot of false positive and lock out your users.
    
== Uninstall ==
 
== Uninstall ==
Line 378: Line 365:  
Paste this
 
Paste this
 
  <nowiki>#!/bin/bash
 
  <nowiki>#!/bin/bash
  echo -e \
+
      echo -e \
  "IP            \t"\
+
      "IP            \t"\
  "BanTime            \t"\
+
      "BanTime            \t"\
  "UnbanTime          \t"\
+
      "UnbanTime          \t"\
  "Jail"
+
      "Jail"
 
+
     
  for ban in $(db fail2ban show |awk -F\= ' $2=="ban" {print $1}');  
+
      for ban in $(db fail2ban show |awk -F\= ' $2=="ban" {print $1}');  
    do
+
        do
      IP=$(db fail2ban getprop $ban Host)
+
          IP=$(db fail2ban getprop $ban Host)
      Bantime=$(date +"%F %T" -d @$(db fail2ban getprop $ban BanTimestamp))
+
          Bantime=$(date +"%F %T" -d @$(db fail2ban getprop $ban BanTimestamp))
      UnBanTime=$(date +"%F %T" -d @$(db fail2ban getprop $ban UnbanTimestamp))
+
          UnBanTime=$(date +"%F %T" -d @$(db fail2ban getprop $ban UnbanTimestamp))
      LastJail=$(zgrep -H "Ban $IP" $(find /var/log/fail2ban -type f -ctime -7) |tail -1 |awk '{print $6}')  
+
          LastJail=$(zgrep -H "Ban $IP" $(find /var/log/fail2ban -type f -ctime -7) |tail -1 |awk '{print $6}')  
 
+
     
      printf "%-15s" "$IP"
+
          printf "%-15s" "$IP"
      echo -e "\t$Bantime\t$UnBanTime\t$LastJail"
+
          echo -e "\t$Bantime\t$UnBanTime\t$LastJail"
    done
+
        done
  </nowiki>
+
      </nowiki>
    
save, then make executable
 
save, then make executable
Line 403: Line 390:  
Output:
 
Output:
 
  <nowiki>IP            BanTime            UnbanTime          Jail
 
  <nowiki>IP            BanTime            UnbanTime          Jail
  46.246.39.228  2017-09-09 18:45:00 2017-09-10 18:45:00 [http-scan]
+
      46.246.39.228  2017-09-09 18:45:00 2017-09-10 18:45:00 [http-scan]
  124.239.180.102 2017-09-09 12:07:32 2017-09-10 12:07:32 [http-scan]
+
      124.239.180.102 2017-09-09 12:07:32 2017-09-10 12:07:32 [http-scan]
  212.237.54.93  2017-09-09 19:27:32 2017-09-10 19:27:32 [http-scan]
+
      212.237.54.93  2017-09-09 19:27:32 2017-09-10 19:27:32 [http-scan]
  </nowiki>
+
      </nowiki>
    
===WordPress===
 
===WordPress===
Line 417: Line 404:  
Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component=smeserver-fail2ban|noresultsmessage=No open bugs found.}}  
 
Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component=smeserver-fail2ban|noresultsmessage=No open bugs found.}}  
   −
===Changelog===
+
==Changelog==
 
Only released version in smecontrib are listed here.
 
Only released version in smecontrib are listed here.
  
3,054

edits

Navigation menu