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 #!/usr/bin/env ruby
require 'date' require 'date'
require 'net/smtp'
# Some configuration parameters # Some configuration parameters
sender = 'noc@insomnia247.nl'
smtp_server = 'localhost'
fw_logfile = '/home/coolfire/fw_block.log' fw_logfile = '/home/coolfire/fw_block.log'
f2b_logfile = '/var/log/fail2ban.log' f2b_logfile = '/var/log/fail2ban.log'
...@@ -94,11 +90,7 @@ iplist.each do |ip| ...@@ -94,11 +90,7 @@ iplist.each do |ip|
# Build mail body # Build mail body
mail = <<MESSAGE_END mail = <<MESSAGE_END
From: Insomnia 24/7 abuse dept. <#{sender}> Dear #{abuse_contact},
To: Abuse contact <#{abuse_contact}>
Subject: Abuse from #{ip}
Dear sir/madam,
We wish to inform we have been attacked from the following IP address: We wish to inform we have been attacked from the following IP address:
#{ip} #{ip}
...@@ -117,9 +109,7 @@ Fail2ban hits: ...@@ -117,9 +109,7 @@ Fail2ban hits:
MESSAGE_END MESSAGE_END
# Send out mail # Send out mail
Net::SMTP.start(smtp_server) do |smtp| %x(echo #{mail} | mail -s "Abuse from #{ip}" "abuse@insomnia247.nl" )
smtp.send_message mail, sender, abuse_contact
end
end end
end 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