homebrew-core/Formula/fail2ban.rb
Brett Koonce 5fdc76d157 fail2ban 0.8.11
Closes Homebrew/homebrew#24978.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-12-06 18:50:56 -08:00

76 lines
2.3 KiB
Ruby

require 'formula'
class Fail2ban < Formula
homepage 'http://www.fail2ban.org/'
url 'https://github.com/fail2ban/fail2ban/archive/0.8.11.tar.gz'
sha1 'd38ec5e5b983ef45c87f3324a095df85c2003303'
depends_on :python
def install
rm 'setup.cfg'
inreplace 'setup.py' do |s|
s.gsub! /\/etc/, etc
s.gsub! /\/var/, var
end
# Replace hardcoded paths
inreplace 'fail2ban-client', '/usr/share/fail2ban', libexec
inreplace 'fail2ban-server', '/usr/share/fail2ban', libexec
inreplace 'fail2ban-regex', '/usr/share/fail2ban', libexec
inreplace 'fail2ban-client', '/etc', etc
inreplace 'fail2ban-regex', '/etc', etc
inreplace 'fail2ban-server', '/var', var
inreplace 'config/fail2ban.conf', '/var/run', (var/'run')
inreplace 'setup.py', '/usr/share/doc/fail2ban', (libexec/'doc')
python do
system python, "setup.py", "install", "--prefix=#{prefix}", "--install-lib=#{libexec}"
end
end
plist_options :startup => true
def plist; <<-EOS.undent
<?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>
<string>#{opt_prefix}/bin/fail2ban-client</string>
<string>-x</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
def caveats
<<-EOS.undent
#{python.standard_caveats if python}
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