2014-06-21 20:22:44 +00:00
|
|
|
require "formula"
|
2012-09-09 13:47:53 +00:00
|
|
|
|
|
|
|
class Fail2ban < Formula
|
2014-06-21 20:22:44 +00:00
|
|
|
homepage "http://www.fail2ban.org/"
|
2014-08-21 07:25:20 +00:00
|
|
|
url "https://github.com/fail2ban/fail2ban/archive/0.8.14.tar.gz"
|
|
|
|
sha1 "fb104335acf9d71552a4a1cec06fac1187846867"
|
2012-09-09 13:47:53 +00:00
|
|
|
|
2014-08-21 08:13:25 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "ab90e39f9669b929dd4ec43b9f736a1ab1cac652" => :mavericks
|
|
|
|
sha1 "3b2c563f7316ed9c485744e24ec6abc3bb242040" => :mountain_lion
|
|
|
|
sha1 "0c91986b55c0d35497ef0d4c42d992c9958c577e" => :lion
|
|
|
|
end
|
|
|
|
|
2012-09-09 13:47:53 +00:00
|
|
|
def install
|
2014-06-21 20:22:44 +00:00
|
|
|
rm "setup.cfg"
|
|
|
|
inreplace "setup.py" do |s|
|
2012-09-09 13:47:53 +00:00
|
|
|
s.gsub! /\/etc/, etc
|
|
|
|
s.gsub! /\/var/, var
|
|
|
|
end
|
|
|
|
|
|
|
|
# Replace hardcoded paths
|
2014-06-21 20:22:44 +00:00
|
|
|
inreplace "fail2ban-client", "/usr/share/fail2ban", libexec
|
|
|
|
inreplace "fail2ban-server", "/usr/share/fail2ban", libexec
|
|
|
|
inreplace "fail2ban-regex", "/usr/share/fail2ban", libexec
|
2012-09-09 13:47:53 +00:00
|
|
|
|
2014-06-21 20:22:44 +00:00
|
|
|
inreplace "fail2ban-client", "/etc", etc
|
|
|
|
inreplace "fail2ban-regex", "/etc", etc
|
2012-09-09 13:47:53 +00:00
|
|
|
|
2014-06-21 20:22:44 +00:00
|
|
|
inreplace "fail2ban-server", "/var", var
|
|
|
|
inreplace "config/fail2ban.conf", "/var/run", (var/"run")
|
2012-09-09 13:47:53 +00:00
|
|
|
|
2014-06-21 20:22:44 +00:00
|
|
|
inreplace "setup.py", "/usr/share/doc/fail2ban", (libexec/"doc")
|
2013-12-06 06:16:02 +00:00
|
|
|
|
2014-01-04 13:05:27 +00:00
|
|
|
system "python", "setup.py", "install", "--prefix=#{prefix}", "--install-lib=#{libexec}"
|
2012-09-09 13:47:53 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
plist_options :startup => true
|
|
|
|
|
|
|
|
def plist; <<-EOS.undent
|
2012-09-09 13:47:53 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
2014-03-06 05:28:31 +00:00
|
|
|
<string>#{opt_bin}/fail2ban-client</string>
|
2013-04-12 19:34:03 +00:00
|
|
|
<string>-x</string>
|
2012-09-09 13:47:53 +00:00
|
|
|
<string>start</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
2012-11-25 15:06:41 +00:00
|
|
|
EOS
|
2012-09-09 13:47:53 +00:00
|
|
|
end
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
def caveats
|
|
|
|
<<-EOS.undent
|
2012-09-09 13:47:53 +00:00
|
|
|
Before using Fail2Ban for the first time you should edit jail
|
|
|
|
configuration and enable the jails that you want to use, for instance
|
|
|
|
ssh-ipfw. Also make sure that they point to the correct configuration
|
|
|
|
path. I.e. on Mountain Lion the sshd logfile should point to
|
|
|
|
/var/log/system.log.
|
|
|
|
|
|
|
|
* #{etc}/fail2ban/jail.conf
|
|
|
|
|
|
|
|
The Fail2Ban wiki has two pages with instructions for MacOS X Server that
|
|
|
|
describes how to set up the Jails for the standard MacOS X Server
|
|
|
|
services for the respective releases.
|
|
|
|
|
|
|
|
10.4: http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.4)
|
|
|
|
10.5: http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5)
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|