Felhasználói eszközök

Eszközök a webhelyen


Oldalsáv

Index menü


Tagek listája

Szavak listája

tudasbazis:linux:fail2ban

fail2ban

Egy file-t csak egy jail-hez adjunk meg, mert nem minden esetben kezeli jól a fail2ban
Ha van logrotate beállítva az ellenőrzött fájlra, érdemes annak idejét kibővíteni a fail2ban általi bann-time-ra

Telepítés

  1. Csomag telepítése:
    apt-get install fail2ban
  2. Program beállítása:
    /etc/fail2ban/jail.conf
    [DEFAULT]
     
    # "ignoreip" can be an IP address, a CIDR mask or a DNS host
    ignoreip = 127.0.0.1/8 192.168.0.0/16
     
    # "bantime" is the number of seconds that a host is banned.
    # 86400 s = 1 day
    bantime = 86400
     
    ...
     
    # A host is banned if it has generated "maxretry" during the last "findtime"
    # seconds.
    # 604800 s = 7 days
    findtime = 604800
    maxretry = 10
     
    ...
     
    destemail = foo@bar.com
     
    ...
     
    # Choose default action.  To change, just override value of 'action' with the
    # interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local
    # globally (section [DEFAULT]) or per specific section
    action = %(action_)s
     
    ...
    #  majd a fájl többi részén a szolgáltatások engedélyezése / tiltása
  3. Hasznos, bekapcsolandó szolgáltatások:
    • ssh
    • ssh-ddos
    • apache
    • apache-overflows
    • postfix
    • dovecot
  4. Beállítások életbeléptetése:
    service fail2ban restart

Munin modul

  1. Munin plugin telepítése:
    ln -s /usr/share/munin/plugins/fail2ban /etc/munin/plugins/
     
    echo -n "
    [fail2ban]
    user root
    " >> /etc/munin/plugin-conf.d/munin-node
  2. Munin plugin tesztelése:
    munin-run fail2ban
  3. Változások életbeléptetése:
    service munin-node restart

Állapot lekérdezése

fail2ban-client status
 
fail2ban-client status mail
 
fail2ban-client status dovecot

Regexek tesztelése

fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/postfix.conf


tudasbazis/linux/fail2ban.txt · Utolsó módosítás: 2018.12.13 00:13 szerkesztette: tia