Just another IT site ※IT系の記事は当方環境での実施内容となるため実施する場合は自己責任でお願いいたします。At Your Own Risk!! TURN BACK WHILE YOU CAN
PR

fail2banのiptablesの切り替え関連

※IT系の記事は当方環境での実施内容となるため実施する場合は自己責任でお願いいたします。スクリプトはAI生成のものも多いのでコピー&ペーストの際は文字コードに注意ください!

【conoha VPS AlmaLinux9構築④】セキュリティ設定 その2 | 文系の麺ジニア

Linuxサーバーのセキュリティについて説明 | はじめのiT

fail2banの設定をした – DreamerDreamのブログ

How to Install Fail2Ban with Firewalld on Rocky Linux 10 | Atlantic.Net

 

何もしなくても最近はインストール時に以下のファイルでfirewalld使用にオーバーライドされているっぽい。

/etc/fail2ban/jail.d/00-firewalld.conf

fail2banでブルートフォース攻撃からsshdを守る | せろとにんぱわー.

□fail2ban でうざいアクセスをシャットアウト -2- | Linux Install Memo

と思ったが、.localに変えてあげないと読み込まない?

How to Install Fail2Ban with Firewalld on Rocky Linux 10 | Atlantic.Net

スポンサーリンク
バッチ処理の自動化スキルは市場価値が高いです。今の自分の単価を調べてみませんか?
顧客常駐はもう嫌だ!社内SEへ転職するなら【社内SE転職ナビ】
Cursor・Claude Code・Codex AIスキルを学ぶなら
環境構築不要!AIエージェント開発を非エンジニアでも即実践【AI Agent Camp】

Step 3 – Configure Fail2Ban

By default, Fail2Ban is configured to use the iptables firewall, so you will need to configure Fail2Ban to work with Firewalld.

First, rename the Firewalld configuration file for Fail2Ban using the following command:

mv /etc/fail2ban/jail.d/00-firewalld.conf /etc/fail2ban/jail.d/00-firewalld.local

Next, copy the Fail2Ban default configuration file:

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Next, edit the jail.local file:

nano /etc/fail2ban/jail.local

Find the following lines:

banaction = iptables-multiport
banaction_allports = iptables-allports

And replace them with the following lines:

banaction = firewallcmd-rich-rules[actiontype=]
banaction_allports = firewallcmd-rich-rules[actiontype=]

Save and close the file, then restart the Fail2Ban to apply the changes:

systemctl restart fail2ban

At this point, Fail2Ban is configured to work with Firewalld.

タイトルとURLをコピーしました