LoginSignup
1
1

Asterisk & fail2ban (Ubuntu) でハマったところを備忘録的に共有

Last updated at Posted at 2024-02-06

デフォルトで設定あるって情報あるのに動かないんだけど!

/etc/fail2ban/jail.local
[DEFAULT]
(略)

[asterisk]
enabled = true

[sshd]
(後略)

書き換え、ヨシッ!
systemctl start fail2ban.service
systemctl status fail2ban.service
>>>State: failed<<<
→お前がfailしとるやないかい!

原因を探るため、探検隊は/etc/fail2banの奥地へ赴いた…
→paths-default.conf, paths-debian.conf 関係なかった
→filter.d/asterisk.conf 問題なさそう
→jail.conf

/etc/fail2ban/jail.conf
(前略)
#
# Miscellaneous
#

[asterisk]

port     = 5060,5061
action_  = %(default/action_)s[name=%(__name__)s-tcp, protocol="tcp"]
           %(default/action_)s[name=%(__name__)s-udp, protocol="udp"]
logpath  = /var/log/asterisk/messages
maxretry = 10


[freeswitch]
(後略)

あれっ!logpathがおかしい!

末尾に.logを入れて正しいパスにしたら動きましたとさ
logpath = /var/log/asterisk/messages.log

おしまい!

追加DLC()

よく見たらfilter.dの中身chan_sip用でPJSIPに使えないやんけ!

AORで弾かれたIPをBANする正規表現
^Rejecting '<HOST>' due to a failure to pass ACL.* をfailregexに追加。
接続元IPが限定されているならとりあえず最低限は弾ける。これだけじゃ不十分だぞ!
他はWIP。WIPだから聞かんでクレメンス。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1