fail2ban

  • 投稿日:
  • by
  • カテゴリ:

インストールのメモ

  1. インストールする。

    # apt install fail2ban
  2. /etc/fail2ban/jail.conf を変更する。以下はインストール状態からの変更点のみ。
    ignoreip = 127.0.0.1/8 ::1 # ban 対象としない IP アドレスを指定
    destemail = root@example.com # 送信先メールアドレスを設定
    # diff jail.conf jail.conf.org
    54c54
    < ignoreip = 127.0.0.1/8 ::1
    ---
    > #ignoreip = 127.0.0.1/8 ::1
    63c63
    < bantime = 10d
    ---
    > bantime = 10m
    70c70
    < maxretry = 3
    ---
    > maxretry = 5
    137c137
    < destemail = hogefuga@h-sol.jp
    ---
    > destemail = root@localhost
    #
  3. 不要(jail.confにsshdのエントリがあり)
    /etc/fail2ban/jail.d/sshd.conf を新規作成する。
    [sshd]
    enabled = true
    port	= 22
    logpath	= %(sshd_log)s
    backend	= %(sshd_backend)s
    action	= %(action_mw)s
  4. fail2ban をdaemonで起動する

    # update-rc.d fail2ban defaults

以上です。