Commit 967c9c69 authored by Cool Fire (HN)'s avatar Cool Fire (HN)

Changed to Linux mail command instead of net/smtp

parent 39fe01d8
#!/usr/bin/env ruby
require 'date'
require 'net/smtp'
# Some configuration parameters
sender = 'noc@insomnia247.nl'
smtp_server = 'localhost'
fw_logfile = '/home/coolfire/fw_block.log'
f2b_logfile = '/var/log/fail2ban.log'
......@@ -94,11 +90,7 @@ iplist.each do |ip|
# Build mail body
mail = <<MESSAGE_END
From: Insomnia 24/7 abuse dept. <#{sender}>
To: Abuse contact <#{abuse_contact}>
Subject: Abuse from #{ip}
Dear sir/madam,
Dear #{abuse_contact},
We wish to inform we have been attacked from the following IP address:
#{ip}
......@@ -117,9 +109,7 @@ Fail2ban hits:
MESSAGE_END
# Send out mail
Net::SMTP.start(smtp_server) do |smtp|
smtp.send_message mail, sender, abuse_contact
end
%x(echo #{mail} | mail -s "Abuse from #{ip}" "abuse@insomnia247.nl" )
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment