fail2ban使用mutt发送邮件

post by rocdk890 / 2016-6-7 13:36 Tuesday linux技术
  相信很多人都知道sendmail发送邮件延迟很大,所以很多都选择mutt来进行邮件发送,fail2ban默认是使用sendmail来进行邮件发送,我们这里就要修改为使用mutt来进行邮件发送.
  系统:centos 6.x(64位)
1.安装mutt
具体怎么安装mutt请看这篇文章linux下安装mutt.

2.安装fail2ban
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
rpm -Uvh http://download.slogra.com/yum-x86_64/epel-release-6-8.noarch.rpm
wget -O /etc/yum.repos.d/shorewall.repo http://mirror.sysadminguide.net/shorewall/shorewall.repo

yum install shorewall gamin-python shorewall-shell shorewall-perl shorewall-common python-inotify python-ctypes fail2ban -y

3.修改为mutt发送邮件
cat /etc/fail2ban/action.d/mutt.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
#
[Definition]
# Option: actionstart
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = printf %%b "Hi,\n
The jail <name> has been started successfully.\n
Regards,\n
Fail2Ban"|mutt -s "[Fail2Ban] <name>: started on `uname -n`"<dest>
# Option: actionstop
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = printf %%b "Hi,\n
The jail <name> has been stopped.\n
Regards,\n
Fail2Ban"|mutt -s "[Fail2Ban] <name>: stopped on `uname -n`"<dest>
# Option: actioncheck
# Notes.: command executed once before each actionban command
# Values: CMD
#
actioncheck =
# Option: actionban
# Notes.: command executed when banning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionban = printf %%b "Hi,\n
The IP <ip> has just been banned by Fail2Ban after
<failures> attempts against <name>.\n
Regards,\n
Fail2Ban"|mutt -s "[Fail2Ban] <name>: banned <ip> from `uname -n`"<dest>
# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionunban =
[Init]
# Default name of the chain
#
name = default
# Destination/Addressee of the mutt
#
dest = root

然后在jail.conf文件下添加:
action = mutt[name=nginx, dest=rocdk@163.com]

这样就可以使用mutt来发送邮件了.

ps:http://drops.wooyun.org/tips/3029 
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-657.html

标签: 邮件 mutt fail2ban 发送

评论: